Add comments to avoid warnings from go lint

pull/6753/head
Anders F Björklund 2020-02-22 16:12:17 +01:00
parent 30945b4113
commit fa9f7f9794
12 changed files with 43 additions and 22 deletions

View File

@ -44,10 +44,16 @@ var statusFormat string
var output string var output string
const ( const (
// Additional states used by kubeconfig // # Additional states used by kubeconfig:
Configured = "Configured" // ~state.Saved
// Configured means configured
Configured = "Configured" // ~state.Saved
// Misconfigured means misconfigured
Misconfigured = "Misconfigured" // ~state.Error Misconfigured = "Misconfigured" // ~state.Error
// Additional states used for clarity
// # Additional states used for clarity:
// Nonexistent means nonexistent
Nonexistent = "Nonexistent" // ~state.None Nonexistent = "Nonexistent" // ~state.None
) )

View File

@ -19,8 +19,10 @@ package oci
const ( const (
// DefaultBindIPV4 is The default IP the container will listen on. // DefaultBindIPV4 is The default IP the container will listen on.
DefaultBindIPV4 = "127.0.0.1" DefaultBindIPV4 = "127.0.0.1"
Docker = "docker" // Docker is docker
Podman = "podman" Docker = "docker"
// Podman is podman
Podman = "podman"
// ProfileLabelKey is applied to any container or volume created by a specific minikube profile name.minikube.sigs.k8s.io=PROFILE_NAME // ProfileLabelKey is applied to any container or volume created by a specific minikube profile name.minikube.sigs.k8s.io=PROFILE_NAME
ProfileLabelKey = "name.minikube.sigs.k8s.io" ProfileLabelKey = "name.minikube.sigs.k8s.io"
// NodeRoleKey is used to identify if it is control plane or worker // NodeRoleKey is used to identify if it is control plane or worker

View File

@ -23,7 +23,8 @@ import (
) )
const ( const (
// Docker default bridge network is named "bridge" (https://docs.docker.com/network/bridge/#use-the-default-bridge-network) // DefaultNetwork is the Docker default bridge network named "bridge"
// (https://docs.docker.com/network/bridge/#use-the-default-bridge-network)
DefaultNetwork = "bridge" DefaultNetwork = "bridge"
// DefaultPodCIDR is The CIDR to be used for pods inside the node. // DefaultPodCIDR is The CIDR to be used for pods inside the node.
DefaultPodCIDR = "10.244.0.0/16" DefaultPodCIDR = "10.244.0.0/16"

View File

@ -28,8 +28,12 @@ import (
"k8s.io/minikube/pkg/minikube/config" "k8s.io/minikube/pkg/minikube/config"
) )
// enum to differentiate kubeadm command line parameters from kubeadm config file parameters (see the
// KubeadmExtraArgsWhitelist variable for more info)
const ( const (
KubeadmCmdParam = iota // KubeadmCmdParam is command parameters for kubeadm
KubeadmCmdParam = iota
// KubeadmConfigParam is config parameters for kubeadm
KubeadmConfigParam = iota KubeadmConfigParam = iota
) )

View File

@ -29,10 +29,11 @@ import (
var KubeadmYamlPath = path.Join(vmpath.GuestEphemeralDir, "kubeadm.yaml") var KubeadmYamlPath = path.Join(vmpath.GuestEphemeralDir, "kubeadm.yaml")
const ( const (
//DefaultCNIConfigPath is the configuration file for CNI networks
DefaultCNIConfigPath = "/etc/cni/net.d/k8s.conf" DefaultCNIConfigPath = "/etc/cni/net.d/k8s.conf"
KubeletServiceFile = "/lib/systemd/system/kubelet.service" // KubeletServiceFile is the file for the systemd kubelet.service
// enum to differentiate kubeadm command line parameters from kubeadm config file parameters (see the KubeletServiceFile = "/lib/systemd/system/kubelet.service"
// KubeadmExtraArgsWhitelist variable for more info) // KubeletSystemdConfFile is config for the systemd kubelet.service
KubeletSystemdConfFile = "/etc/systemd/system/kubelet.service.d/10-kubeadm.conf" KubeletSystemdConfFile = "/etc/systemd/system/kubelet.service.d/10-kubeadm.conf"
) )

View File

@ -182,6 +182,7 @@ func apiServerHealthz(ip net.IP, port int) (state.State, error) {
return state.Running, nil return state.Running, nil
} }
// KubeletStatus checks the kubelet status
func KubeletStatus(cr command.Runner) (state.State, error) { func KubeletStatus(cr command.Runner) (state.State, error) {
glog.Infof("Checking kubelet status ...") glog.Infof("Checking kubelet status ...")
rr, err := cr.RunCmd(exec.Command("sudo", "systemctl", "is-active", "kubelet")) rr, err := cr.RunCmd(exec.Command("sudo", "systemctl", "is-active", "kubelet"))

View File

@ -72,11 +72,8 @@ var (
GvisorConfigTomlTargetName = "gvisor-config.toml" GvisorConfigTomlTargetName = "gvisor-config.toml"
// MountProcessFileName is the filename of the mount process // MountProcessFileName is the filename of the mount process
MountProcessFileName = ".mount-process" MountProcessFileName = ".mount-process"
// SHASuffix is the suffix of a SHA-256 checksum file // SHASuffix is the suffix of a SHA-256 checksum file
)
var (
SHASuffix = ".sha256" SHASuffix = ".sha256"
// DefaultISOURL is the default location of the minikube.iso file // DefaultISOURL is the default location of the minikube.iso file
DefaultISOURL = fmt.Sprintf("https://storage.googleapis.com/%s/minikube-%s.iso", minikubeVersion.GetISOPath(), minikubeVersion.GetISOVersion()) DefaultISOURL = fmt.Sprintf("https://storage.googleapis.com/%s/minikube-%s.iso", minikubeVersion.GetISOPath(), minikubeVersion.GetISOVersion())
@ -88,13 +85,13 @@ var (
// DefaultMinipath is the default Minikube path (under the home directory) // DefaultMinipath is the default Minikube path (under the home directory)
DefaultMinipath = filepath.Join(homedir.HomeDir(), ".minikube") DefaultMinipath = filepath.Join(homedir.HomeDir(), ".minikube")
// KubeconfigEnvVar is the env var to check for the Kubernetes client config
// KubeconfigEnvVar is the env var to check for the Kubernetes client config
KubeconfigEnvVar = clientcmd.RecommendedConfigPathEnvVar KubeconfigEnvVar = clientcmd.RecommendedConfigPathEnvVar
// KubeconfigPath is the path to the Kubernetes client config // KubeconfigPath is the path to the Kubernetes client config
KubeconfigPath = clientcmd.RecommendedHomeFile KubeconfigPath = clientcmd.RecommendedHomeFile
// ImageRepositories contains all known image repositories
// ImageRepositories contains all known image repositories
ImageRepositories = map[string][]string{ ImageRepositories = map[string][]string{
"global": {""}, "global": {""},
"cn": {"registry.cn-hangzhou.aliyuncs.com/google_containers"}, "cn": {"registry.cn-hangzhou.aliyuncs.com/google_containers"},

View File

@ -284,7 +284,7 @@ func (r *Containerd) PauseContainers(ids []string) error {
return pauseCRIContainers(r.Runner, containerdNamespaceRoot, ids) return pauseCRIContainers(r.Runner, containerdNamespaceRoot, ids)
} }
// PauseContainers pauses a running container based on ID // UnpauseContainers unpauses a running container based on ID
func (r *Containerd) UnpauseContainers(ids []string) error { func (r *Containerd) UnpauseContainers(ids []string) error {
return unpauseCRIContainers(r.Runner, containerdNamespaceRoot, ids) return unpauseCRIContainers(r.Runner, containerdNamespaceRoot, ids)
} }

View File

@ -201,7 +201,7 @@ func (r *CRIO) PauseContainers(ids []string) error {
return pauseCRIContainers(r.Runner, "", ids) return pauseCRIContainers(r.Runner, "", ids)
} }
// PauseContainers pauses a running container based on ID // UnpauseContainers unpauses a running container based on ID
func (r *CRIO) UnpauseContainers(ids []string) error { func (r *CRIO) UnpauseContainers(ids []string) error {
return unpauseCRIContainers(r.Runner, "", ids) return unpauseCRIContainers(r.Runner, "", ids)
} }

View File

@ -27,11 +27,15 @@ import (
"k8s.io/minikube/pkg/minikube/out" "k8s.io/minikube/pkg/minikube/out"
) )
// ContainerState is the run state of a container
type ContainerState int type ContainerState int
const ( const (
// All is all of the states
All ContainerState = iota All ContainerState = iota
// Running is only running
Running Running
// Paused is only paused
Paused Paused
) )
@ -106,6 +110,7 @@ type Config struct {
KubernetesVersion string KubernetesVersion string
} }
// ListOptions are the options to use for listing containers
type ListOptions struct { type ListOptions struct {
// State is the container state to filter by (All, Running, Paused) // State is the container state to filter by (All, Running, Paused)
State ContainerState State ContainerState

View File

@ -43,10 +43,14 @@ import (
) )
var ( var (
DockerEnv []string // DockerEnv contains the environment variables
DockerOpt []string DockerEnv []string
// DockerOpt contains the option parameters
DockerOpt []string
// ExtraOptions contains extra options (if any)
ExtraOptions config.ExtraOptionSlice ExtraOptions config.ExtraOptionSlice
AddonList []string // AddonList contains the list of addons
AddonList []string
) )
// configureRuntimes does what needs to happen to get a runtime going. // configureRuntimes does what needs to happen to get a runtime going.

View File

@ -31,6 +31,6 @@ const (
GuestCertAuthDir = "/usr/share/ca-certificates" GuestCertAuthDir = "/usr/share/ca-certificates"
// GuestCertStoreDir is where system SSL certificates are installed // GuestCertStoreDir is where system SSL certificates are installed
GuestCertStoreDir = "/etc/ssl/certs" GuestCertStoreDir = "/etc/ssl/certs"
// Where gvisor bootstraps from // GuestGvisorDir is where gvisor bootstraps from
GuestGvisorDir = "/tmp/gvisor" GuestGvisorDir = "/tmp/gvisor"
) )