From fa9f7f9794937baf6b86e11a7cc656cb2ec2ec3a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Anders=20F=20Bj=C3=B6rklund?= Date: Sat, 22 Feb 2020 16:12:17 +0100 Subject: [PATCH] Add comments to avoid warnings from go lint --- cmd/minikube/cmd/status.go | 12 +++++++++--- pkg/drivers/kic/oci/types.go | 6 ++++-- pkg/drivers/kic/types.go | 3 ++- pkg/minikube/bootstrapper/bsutil/extraconfig.go | 6 +++++- pkg/minikube/bootstrapper/bsutil/files.go | 7 ++++--- pkg/minikube/bootstrapper/bsutil/kverify/kverify.go | 1 + pkg/minikube/constants/constants.go | 9 +++------ pkg/minikube/cruntime/containerd.go | 2 +- pkg/minikube/cruntime/crio.go | 2 +- pkg/minikube/cruntime/cruntime.go | 5 +++++ pkg/minikube/node/config.go | 10 +++++++--- pkg/minikube/vmpath/constants.go | 2 +- 12 files changed, 43 insertions(+), 22 deletions(-) diff --git a/cmd/minikube/cmd/status.go b/cmd/minikube/cmd/status.go index c529ff1505..0fb1c79284 100644 --- a/cmd/minikube/cmd/status.go +++ b/cmd/minikube/cmd/status.go @@ -44,10 +44,16 @@ var statusFormat string var output string const ( - // Additional states used by kubeconfig - Configured = "Configured" // ~state.Saved + // # Additional states used by kubeconfig: + + // Configured means configured + Configured = "Configured" // ~state.Saved + // Misconfigured means misconfigured Misconfigured = "Misconfigured" // ~state.Error - // Additional states used for clarity + + // # Additional states used for clarity: + + // Nonexistent means nonexistent Nonexistent = "Nonexistent" // ~state.None ) diff --git a/pkg/drivers/kic/oci/types.go b/pkg/drivers/kic/oci/types.go index ffc71f57c0..d2b6eca033 100644 --- a/pkg/drivers/kic/oci/types.go +++ b/pkg/drivers/kic/oci/types.go @@ -19,8 +19,10 @@ package oci const ( // DefaultBindIPV4 is The default IP the container will listen on. DefaultBindIPV4 = "127.0.0.1" - Docker = "docker" - Podman = "podman" + // Docker is docker + 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 = "name.minikube.sigs.k8s.io" // NodeRoleKey is used to identify if it is control plane or worker diff --git a/pkg/drivers/kic/types.go b/pkg/drivers/kic/types.go index 12e179c7eb..8ff884a318 100644 --- a/pkg/drivers/kic/types.go +++ b/pkg/drivers/kic/types.go @@ -23,7 +23,8 @@ import ( ) 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" // DefaultPodCIDR is The CIDR to be used for pods inside the node. DefaultPodCIDR = "10.244.0.0/16" diff --git a/pkg/minikube/bootstrapper/bsutil/extraconfig.go b/pkg/minikube/bootstrapper/bsutil/extraconfig.go index 109bb45f07..94851f6892 100644 --- a/pkg/minikube/bootstrapper/bsutil/extraconfig.go +++ b/pkg/minikube/bootstrapper/bsutil/extraconfig.go @@ -28,8 +28,12 @@ import ( "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 ( - KubeadmCmdParam = iota + // KubeadmCmdParam is command parameters for kubeadm + KubeadmCmdParam = iota + // KubeadmConfigParam is config parameters for kubeadm KubeadmConfigParam = iota ) diff --git a/pkg/minikube/bootstrapper/bsutil/files.go b/pkg/minikube/bootstrapper/bsutil/files.go index df6cb7472f..c184eca3c9 100644 --- a/pkg/minikube/bootstrapper/bsutil/files.go +++ b/pkg/minikube/bootstrapper/bsutil/files.go @@ -29,10 +29,11 @@ import ( var KubeadmYamlPath = path.Join(vmpath.GuestEphemeralDir, "kubeadm.yaml") const ( + //DefaultCNIConfigPath is the configuration file for CNI networks DefaultCNIConfigPath = "/etc/cni/net.d/k8s.conf" - KubeletServiceFile = "/lib/systemd/system/kubelet.service" - // enum to differentiate kubeadm command line parameters from kubeadm config file parameters (see the - // KubeadmExtraArgsWhitelist variable for more info) + // KubeletServiceFile is the file for the systemd kubelet.service + KubeletServiceFile = "/lib/systemd/system/kubelet.service" + // KubeletSystemdConfFile is config for the systemd kubelet.service KubeletSystemdConfFile = "/etc/systemd/system/kubelet.service.d/10-kubeadm.conf" ) diff --git a/pkg/minikube/bootstrapper/bsutil/kverify/kverify.go b/pkg/minikube/bootstrapper/bsutil/kverify/kverify.go index 5b05f13794..aa076cecb9 100644 --- a/pkg/minikube/bootstrapper/bsutil/kverify/kverify.go +++ b/pkg/minikube/bootstrapper/bsutil/kverify/kverify.go @@ -182,6 +182,7 @@ func apiServerHealthz(ip net.IP, port int) (state.State, error) { return state.Running, nil } +// KubeletStatus checks the kubelet status func KubeletStatus(cr command.Runner) (state.State, error) { glog.Infof("Checking kubelet status ...") rr, err := cr.RunCmd(exec.Command("sudo", "systemctl", "is-active", "kubelet")) diff --git a/pkg/minikube/constants/constants.go b/pkg/minikube/constants/constants.go index dbf74c4747..96495d083e 100644 --- a/pkg/minikube/constants/constants.go +++ b/pkg/minikube/constants/constants.go @@ -72,11 +72,8 @@ var ( GvisorConfigTomlTargetName = "gvisor-config.toml" // MountProcessFileName is the filename of the mount process MountProcessFileName = ".mount-process" + // SHASuffix is the suffix of a SHA-256 checksum file - -) - -var ( SHASuffix = ".sha256" // 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()) @@ -88,13 +85,13 @@ var ( // DefaultMinipath is the default Minikube path (under the home directory) 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 // KubeconfigPath is the path to the Kubernetes client config KubeconfigPath = clientcmd.RecommendedHomeFile - // ImageRepositories contains all known image repositories + // ImageRepositories contains all known image repositories ImageRepositories = map[string][]string{ "global": {""}, "cn": {"registry.cn-hangzhou.aliyuncs.com/google_containers"}, diff --git a/pkg/minikube/cruntime/containerd.go b/pkg/minikube/cruntime/containerd.go index 3e94fc6020..626ed2c8d0 100644 --- a/pkg/minikube/cruntime/containerd.go +++ b/pkg/minikube/cruntime/containerd.go @@ -284,7 +284,7 @@ func (r *Containerd) PauseContainers(ids []string) error { 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 { return unpauseCRIContainers(r.Runner, containerdNamespaceRoot, ids) } diff --git a/pkg/minikube/cruntime/crio.go b/pkg/minikube/cruntime/crio.go index 4b2ad5df0a..45c552fa87 100644 --- a/pkg/minikube/cruntime/crio.go +++ b/pkg/minikube/cruntime/crio.go @@ -201,7 +201,7 @@ func (r *CRIO) PauseContainers(ids []string) error { 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 { return unpauseCRIContainers(r.Runner, "", ids) } diff --git a/pkg/minikube/cruntime/cruntime.go b/pkg/minikube/cruntime/cruntime.go index 812d469000..380bed2b68 100644 --- a/pkg/minikube/cruntime/cruntime.go +++ b/pkg/minikube/cruntime/cruntime.go @@ -27,11 +27,15 @@ import ( "k8s.io/minikube/pkg/minikube/out" ) +// ContainerState is the run state of a container type ContainerState int const ( + // All is all of the states All ContainerState = iota + // Running is only running Running + // Paused is only paused Paused ) @@ -106,6 +110,7 @@ type Config struct { KubernetesVersion string } +// ListOptions are the options to use for listing containers type ListOptions struct { // State is the container state to filter by (All, Running, Paused) State ContainerState diff --git a/pkg/minikube/node/config.go b/pkg/minikube/node/config.go index ce76ded6b4..7682d85b27 100644 --- a/pkg/minikube/node/config.go +++ b/pkg/minikube/node/config.go @@ -43,10 +43,14 @@ import ( ) var ( - DockerEnv []string - DockerOpt []string + // DockerEnv contains the environment variables + DockerEnv []string + // DockerOpt contains the option parameters + DockerOpt []string + // ExtraOptions contains extra options (if any) ExtraOptions config.ExtraOptionSlice - AddonList []string + // AddonList contains the list of addons + AddonList []string ) // configureRuntimes does what needs to happen to get a runtime going. diff --git a/pkg/minikube/vmpath/constants.go b/pkg/minikube/vmpath/constants.go index aa0d66e2ea..60b259825f 100644 --- a/pkg/minikube/vmpath/constants.go +++ b/pkg/minikube/vmpath/constants.go @@ -31,6 +31,6 @@ const ( GuestCertAuthDir = "/usr/share/ca-certificates" // GuestCertStoreDir is where system SSL certificates are installed GuestCertStoreDir = "/etc/ssl/certs" - // Where gvisor bootstraps from + // GuestGvisorDir is where gvisor bootstraps from GuestGvisorDir = "/tmp/gvisor" )