mirror of
				https://github.com/optim-enterprises-bv/kubernetes.git
				synced 2025-11-04 12:18:16 +00:00 
			
		
		
		
	Fix cmd/kubelet/app lint issues
This commit is contained in:
		@@ -19,7 +19,7 @@ package options
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
import (
 | 
					import (
 | 
				
			||||||
	"fmt"
 | 
						"fmt"
 | 
				
			||||||
	_ "net/http/pprof"
 | 
						_ "net/http/pprof" // Enable pprof HTTP handlers.
 | 
				
			||||||
	"path/filepath"
 | 
						"path/filepath"
 | 
				
			||||||
	"runtime"
 | 
						"runtime"
 | 
				
			||||||
	"strings"
 | 
						"strings"
 | 
				
			||||||
@@ -47,10 +47,11 @@ import (
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
const defaultRootDir = "/var/lib/kubelet"
 | 
					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:
 | 
					// 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 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)
 | 
					// - its value cannot be safely shared between nodes at the same time (e.g. a hostname);
 | 
				
			||||||
//   KubeletConfiguration is intended to be shared between nodes
 | 
					//   KubeletConfiguration is intended to be shared between nodes.
 | 
				
			||||||
// In general, please try to avoid adding flags or configuration fields,
 | 
					// In general, please try to avoid adding flags or configuration fields,
 | 
				
			||||||
// we already have a confusingly large amount of them.
 | 
					// we already have a confusingly large amount of them.
 | 
				
			||||||
type KubeletFlags struct {
 | 
					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 {
 | 
					func ValidateKubeletFlags(f *KubeletFlags) error {
 | 
				
			||||||
	// ensure that nobody sets DynamicConfigDir if the dynamic config feature gate is turned off
 | 
						// ensure that nobody sets DynamicConfigDir if the dynamic config feature gate is turned off
 | 
				
			||||||
	if f.DynamicConfigDir.Provided() && !utilfeature.DefaultFeatureGate.Enabled(features.DynamicKubeletConfig) {
 | 
						if f.DynamicConfigDir.Provided() && !utilfeature.DefaultFeatureGate.Enabled(features.DynamicKubeletConfig) {
 | 
				
			||||||
@@ -336,7 +338,7 @@ func NewKubeletServer() (*KubeletServer, error) {
 | 
				
			|||||||
	}, nil
 | 
						}, 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 {
 | 
					func ValidateKubeletServer(s *KubeletServer) error {
 | 
				
			||||||
	// please add any KubeletConfiguration validation to the kubeletconfigvalidation.ValidateKubeletConfiguration function
 | 
						// please add any KubeletConfiguration validation to the kubeletconfigvalidation.ValidateKubeletConfiguration function
 | 
				
			||||||
	if err := kubeletconfigvalidation.ValidateKubeletConfiguration(&s.KubeletConfiguration); err != nil {
 | 
						if err := kubeletconfigvalidation.ValidateKubeletConfiguration(&s.KubeletConfiguration); err != nil {
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -25,7 +25,6 @@ import (
 | 
				
			|||||||
	"math/rand"
 | 
						"math/rand"
 | 
				
			||||||
	"net"
 | 
						"net"
 | 
				
			||||||
	"net/http"
 | 
						"net/http"
 | 
				
			||||||
	_ "net/http/pprof"
 | 
					 | 
				
			||||||
	"net/url"
 | 
						"net/url"
 | 
				
			||||||
	"os"
 | 
						"os"
 | 
				
			||||||
	"path"
 | 
						"path"
 | 
				
			||||||
@@ -989,7 +988,7 @@ func RunKubelet(kubeServer *options.KubeletServer, kubeDeps *kubelet.Dependencie
 | 
				
			|||||||
		kubeDeps.OSInterface = kubecontainer.RealOS{}
 | 
							kubeDeps.OSInterface = kubecontainer.RealOS{}
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	k, err := CreateAndInitKubelet(&kubeServer.KubeletConfiguration,
 | 
						k, err := createAndInitKubelet(&kubeServer.KubeletConfiguration,
 | 
				
			||||||
		kubeDeps,
 | 
							kubeDeps,
 | 
				
			||||||
		&kubeServer.ContainerRuntimeOptions,
 | 
							&kubeServer.ContainerRuntimeOptions,
 | 
				
			||||||
		kubeServer.ContainerRuntime,
 | 
							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,
 | 
						kubeDeps *kubelet.Dependencies,
 | 
				
			||||||
	crOptions *config.ContainerRuntimeOptions,
 | 
						crOptions *config.ContainerRuntimeOptions,
 | 
				
			||||||
	containerRuntime string,
 | 
						containerRuntime string,
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -7,8 +7,6 @@ cmd/kubeadm/app/apis/kubeadm/v1alpha3
 | 
				
			|||||||
cmd/kubeadm/app/apis/kubeadm/v1beta1
 | 
					cmd/kubeadm/app/apis/kubeadm/v1beta1
 | 
				
			||||||
cmd/kubeadm/app/util/config
 | 
					cmd/kubeadm/app/util/config
 | 
				
			||||||
cmd/kubeadm/app/util/system
 | 
					cmd/kubeadm/app/util/system
 | 
				
			||||||
cmd/kubelet/app
 | 
					 | 
				
			||||||
cmd/kubelet/app/options
 | 
					 | 
				
			||||||
pkg/apis/abac/latest
 | 
					pkg/apis/abac/latest
 | 
				
			||||||
pkg/apis/admission
 | 
					pkg/apis/admission
 | 
				
			||||||
pkg/apis/admission/v1beta1
 | 
					pkg/apis/admission/v1beta1
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user