Fix cmd/kubelet/app lint issues

pull/564/head
Aldo Culquicondor 2019-02-11 13:18:25 -05:00
parent 836db5c90e
commit 17a635448a
3 changed files with 9 additions and 10 deletions

View File

@ -19,7 +19,7 @@ package options
import (
"fmt"
_ "net/http/pprof"
_ "net/http/pprof" // Enable pprof HTTP handlers.
"path/filepath"
"runtime"
"strings"
@ -47,10 +47,11 @@ import (
const defaultRootDir = "/var/lib/kubelet"
// KubeletFlags contains configuration flags for the Kubelet.
// A configuration field should go in KubeletFlags instead of KubeletConfiguration if any of these are true:
// - its value will never, or cannot safely be changed during the lifetime of a node
// - its value cannot be safely shared between nodes at the same time (e.g. a hostname)
// KubeletConfiguration is intended to be shared between nodes
// - its value will never, or cannot safely be changed during the lifetime of a node, or
// - its value cannot be safely shared between nodes at the same time (e.g. a hostname);
// KubeletConfiguration is intended to be shared between nodes.
// In general, please try to avoid adding flags or configuration fields,
// we already have a confusingly large amount of them.
type KubeletFlags struct {
@ -245,6 +246,7 @@ func NewKubeletFlags() *KubeletFlags {
}
}
// ValidateKubeletFlags validates Kubelet's configuration flags and returns an error if they are invalid.
func ValidateKubeletFlags(f *KubeletFlags) error {
// ensure that nobody sets DynamicConfigDir if the dynamic config feature gate is turned off
if f.DynamicConfigDir.Provided() && !utilfeature.DefaultFeatureGate.Enabled(features.DynamicKubeletConfig) {
@ -336,7 +338,7 @@ func NewKubeletServer() (*KubeletServer, error) {
}, nil
}
// validateKubeletServer validates configuration of KubeletServer and returns an error if the input configuration is invalid
// ValidateKubeletServer validates configuration of KubeletServer and returns an error if the input configuration is invalid.
func ValidateKubeletServer(s *KubeletServer) error {
// please add any KubeletConfiguration validation to the kubeletconfigvalidation.ValidateKubeletConfiguration function
if err := kubeletconfigvalidation.ValidateKubeletConfiguration(&s.KubeletConfiguration); err != nil {

View File

@ -25,7 +25,6 @@ import (
"math/rand"
"net"
"net/http"
_ "net/http/pprof"
"net/url"
"os"
"path"
@ -989,7 +988,7 @@ func RunKubelet(kubeServer *options.KubeletServer, kubeDeps *kubelet.Dependencie
kubeDeps.OSInterface = kubecontainer.RealOS{}
}
k, err := CreateAndInitKubelet(&kubeServer.KubeletConfiguration,
k, err := createAndInitKubelet(&kubeServer.KubeletConfiguration,
kubeDeps,
&kubeServer.ContainerRuntimeOptions,
kubeServer.ContainerRuntime,
@ -1065,7 +1064,7 @@ func startKubelet(k kubelet.Bootstrap, podCfg *config.PodConfig, kubeCfg *kubele
}
}
func CreateAndInitKubelet(kubeCfg *kubeletconfiginternal.KubeletConfiguration,
func createAndInitKubelet(kubeCfg *kubeletconfiginternal.KubeletConfiguration,
kubeDeps *kubelet.Dependencies,
crOptions *config.ContainerRuntimeOptions,
containerRuntime string,

View File

@ -7,8 +7,6 @@ cmd/kubeadm/app/apis/kubeadm/v1alpha3
cmd/kubeadm/app/apis/kubeadm/v1beta1
cmd/kubeadm/app/util/config
cmd/kubeadm/app/util/system
cmd/kubelet/app
cmd/kubelet/app/options
pkg/apis/abac/latest
pkg/apis/admission
pkg/apis/admission/v1beta1