diff --git a/cmd/kube-apiserver/app/testing/testserver.go b/cmd/kube-apiserver/app/testing/testserver.go index 2e52f23b871..56b23788d13 100644 --- a/cmd/kube-apiserver/app/testing/testserver.go +++ b/cmd/kube-apiserver/app/testing/testserver.go @@ -97,9 +97,8 @@ func NewDefaultTestServerOptions() *TestServerInstanceOptions { // and location of the tmpdir are returned. // // Note: we return a tear-down func instead of a stop channel because the later will leak temporary -// -// files that because Golang testing's call to os.Exit will not give a stop channel go routine -// enough time to remove temporary files. +// files that because Golang testing's call to os.Exit will not give a stop channel go routine +// enough time to remove temporary files. func StartTestServer(t Logger, instanceOptions *TestServerInstanceOptions, customFlags []string, storageConfig *storagebackend.Config) (result TestServer, err error) { if instanceOptions == nil { instanceOptions = NewDefaultTestServerOptions() diff --git a/cmd/kube-controller-manager/app/controllermanager.go b/cmd/kube-controller-manager/app/controllermanager.go index 1eb5afde855..d69373d64c4 100644 --- a/cmd/kube-controller-manager/app/controllermanager.go +++ b/cmd/kube-controller-manager/app/controllermanager.go @@ -28,6 +28,7 @@ import ( "time" "github.com/spf13/cobra" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/apimachinery/pkg/runtime/schema" utilruntime "k8s.io/apimachinery/pkg/util/runtime" @@ -387,8 +388,7 @@ func (c ControllerContext) IsControllerEnabled(name string) bool { type InitFunc func(ctx context.Context, controllerCtx ControllerContext) (controller controller.Interface, enabled bool, err error) // ControllerInitializersFunc is used to create a collection of initializers -// -// given the loopMode. +// given the loopMode. type ControllerInitializersFunc func(loopMode ControllerLoopMode) (initializers map[string]InitFunc) var _ ControllerInitializersFunc = NewControllerInitializers @@ -746,8 +746,7 @@ func leaderElectAndRun(c *config.CompletedConfig, lockIdentity string, electionC } // createInitializersFunc creates a initializersFunc that returns all initializer -// -// with expected as the result after filtering through filterFunc. +// with expected as the result after filtering through filterFunc. func createInitializersFunc(filterFunc leadermigration.FilterFunc, expected leadermigration.FilterResult) ControllerInitializersFunc { return func(loopMode ControllerLoopMode) map[string]InitFunc { initializers := make(map[string]InitFunc) diff --git a/cmd/kube-controller-manager/app/testing/testserver.go b/cmd/kube-controller-manager/app/testing/testserver.go index 148b9c9953d..408309930f3 100644 --- a/cmd/kube-controller-manager/app/testing/testserver.go +++ b/cmd/kube-controller-manager/app/testing/testserver.go @@ -58,9 +58,8 @@ type Logger interface { // and location of the tmpdir are returned. // // Note: we return a tear-down func instead of a stop channel because the later will leak temporary -// -// files that because Golang testing's call to os.Exit will not give a stop channel go routine -// enough time to remove temporary files. +// files that because Golang testing's call to os.Exit will not give a stop channel go routine +// enough time to remove temporary files. func StartTestServer(t Logger, customFlags []string) (result TestServer, err error) { stopCh := make(chan struct{}) var errCh chan error diff --git a/cmd/kube-scheduler/app/testing/testserver.go b/cmd/kube-scheduler/app/testing/testserver.go index 819c7a2a7b9..f621b842b03 100644 --- a/cmd/kube-scheduler/app/testing/testserver.go +++ b/cmd/kube-scheduler/app/testing/testserver.go @@ -59,9 +59,8 @@ type Logger interface { // and location of the tmpdir are returned. // // Note: we return a tear-down func instead of a stop channel because the later will leak temporary -// -// files that because Golang testing's call to os.Exit will not give a stop channel go routine -// enough time to remove temporary files. +// files that because Golang testing's call to os.Exit will not give a stop channel go routine +// enough time to remove temporary files. func StartTestServer(t Logger, customFlags []string) (result TestServer, err error) { ctx, cancel := context.WithCancel(context.Background()) diff --git a/cmd/kubeadm/app/cmd/init.go b/cmd/kubeadm/app/cmd/init.go index 4399364574a..7b68a7446e0 100644 --- a/cmd/kubeadm/app/cmd/init.go +++ b/cmd/kubeadm/app/cmd/init.go @@ -89,8 +89,7 @@ type initData struct { // newCmdInit returns "kubeadm init" command. // NB. initOptions is exposed as parameter for allowing unit testing of -// -// the newInitOptions method, that implements all the command options validation logic +// the newInitOptions method, that implements all the command options validation logic func newCmdInit(out io.Writer, initOptions *initOptions) *cobra.Command { if initOptions == nil { initOptions = newInitOptions() diff --git a/cmd/kubeadm/app/cmd/join.go b/cmd/kubeadm/app/cmd/join.go index 2c524a00d29..9c668d94c3b 100644 --- a/cmd/kubeadm/app/cmd/join.go +++ b/cmd/kubeadm/app/cmd/join.go @@ -156,8 +156,7 @@ type joinData struct { // newCmdJoin returns "kubeadm join" command. // NB. joinOptions is exposed as parameter for allowing unit testing of -// -// the newJoinData method, that implements all the command options validation logic +// the newJoinData method, that implements all the command options validation logic func newCmdJoin(out io.Writer, joinOptions *joinOptions) *cobra.Command { if joinOptions == nil { joinOptions = newJoinOptions() diff --git a/cmd/kubeadm/app/cmd/util/join.go b/cmd/kubeadm/app/cmd/util/join.go index 95f0e7d4aae..b44f7c3fbc5 100644 --- a/cmd/kubeadm/app/cmd/util/join.go +++ b/cmd/kubeadm/app/cmd/util/join.go @@ -38,15 +38,13 @@ var joinCommandTemplate = template.Must(template.New("join").Parse(`` + )) // GetJoinWorkerCommand returns the kubeadm join command for a given token and -// -// Kubernetes cluster (the current cluster in the kubeconfig file) +// Kubernetes cluster (the current cluster in the kubeconfig file) func GetJoinWorkerCommand(kubeConfigFile, token string, skipTokenPrint bool) (string, error) { return getJoinCommand(kubeConfigFile, token, "", false, skipTokenPrint, false) } // GetJoinControlPlaneCommand returns the kubeadm join command for a given token and -// -// Kubernetes cluster (the current cluster in the kubeconfig file) +// Kubernetes cluster (the current cluster in the kubeconfig file) func GetJoinControlPlaneCommand(kubeConfigFile, token, key string, skipTokenPrint, skipCertificateKeyPrint bool) (string, error) { return getJoinCommand(kubeConfigFile, token, key, true, skipTokenPrint, skipCertificateKeyPrint) } diff --git a/cmd/kubeadm/app/util/config/cluster.go b/cmd/kubeadm/app/util/config/cluster.go index 855a87f76e3..6a2fbb414f2 100644 --- a/cmd/kubeadm/app/util/config/cluster.go +++ b/cmd/kubeadm/app/util/config/cluster.go @@ -160,8 +160,7 @@ func GetNodeRegistration(kubeconfigFile string, client clientset.Interface, node // getNodeNameFromKubeletConfig gets the node name from a kubelet config file // TODO: in future we want to switch to a more canonical way for doing this e.g. by having this -// -// information in the local kubelet config.yaml +// information in the local kubelet config.yaml func getNodeNameFromKubeletConfig(fileName string) (string, error) { // loads the kubelet.conf file config, err := clientcmd.LoadFromFile(fileName) diff --git a/pkg/apis/certificates/types.go b/pkg/apis/certificates/types.go index 9a43f796c16..730ec9c3ad4 100644 --- a/pkg/apis/certificates/types.go +++ b/pkg/apis/certificates/types.go @@ -92,8 +92,9 @@ type CertificateSigningRequestSpec struct { // usages specifies a set of usage contexts the key will be // valid for. - // See: https://tools.ietf.org/html/rfc5280#section-4.2.1.3 - // https://tools.ietf.org/html/rfc5280#section-4.2.1.12 + // See: + // https://tools.ietf.org/html/rfc5280#section-4.2.1.3 + // https://tools.ietf.org/html/rfc5280#section-4.2.1.12 Usages []KeyUsage // Information about the requesting user. @@ -192,8 +193,9 @@ type CertificateSigningRequestList struct { } // KeyUsages specifies valid usage contexts for keys. -// See: https://tools.ietf.org/html/rfc5280#section-4.2.1.3 +// See: // +// https://tools.ietf.org/html/rfc5280#section-4.2.1.3 // https://tools.ietf.org/html/rfc5280#section-4.2.1.12 type KeyUsage string diff --git a/pkg/controller/controller_ref_manager.go b/pkg/controller/controller_ref_manager.go index 0b3a397f8f8..740c98d32a8 100644 --- a/pkg/controller/controller_ref_manager.go +++ b/pkg/controller/controller_ref_manager.go @@ -143,9 +143,8 @@ type PodControllerRefManager struct { // If CanAdopt() returns a non-nil error, all adoptions will fail. // // NOTE: Once CanAdopt() is called, it will not be called again by the same -// -// PodControllerRefManager instance. Create a new instance if it makes -// sense to check CanAdopt() again (e.g. in a different sync pass). +// PodControllerRefManager instance. Create a new instance if it makes +// sense to check CanAdopt() again (e.g. in a different sync pass). func NewPodControllerRefManager( podControl PodControlInterface, controller metav1.Object, @@ -284,9 +283,8 @@ type ReplicaSetControllerRefManager struct { // If CanAdopt() returns a non-nil error, all adoptions will fail. // // NOTE: Once CanAdopt() is called, it will not be called again by the same -// -// ReplicaSetControllerRefManager instance. Create a new instance if it -// makes sense to check CanAdopt() again (e.g. in a different sync pass). +// ReplicaSetControllerRefManager instance. Create a new instance if it +// makes sense to check CanAdopt() again (e.g. in a different sync pass). func NewReplicaSetControllerRefManager( rsControl RSControlInterface, controller metav1.Object, @@ -423,9 +421,8 @@ type ControllerRevisionControllerRefManager struct { // If canAdopt() returns a non-nil error, all adoptions will fail. // // NOTE: Once canAdopt() is called, it will not be called again by the same -// -// ControllerRevisionControllerRefManager instance. Create a new instance if it -// makes sense to check canAdopt() again (e.g. in a different sync pass). +// ControllerRevisionControllerRefManager instance. Create a new instance if it +// makes sense to check canAdopt() again (e.g. in a different sync pass). func NewControllerRevisionControllerRefManager( crControl ControllerRevisionControlInterface, controller metav1.Object, diff --git a/pkg/controller/cronjob/utils.go b/pkg/controller/cronjob/utils.go index e14fbe74c99..3a16082cf26 100644 --- a/pkg/controller/cronjob/utils.go +++ b/pkg/controller/cronjob/utils.go @@ -58,8 +58,7 @@ func deleteFromActiveList(cj *batchv1.CronJob, uid types.UID) { } // getNextScheduleTime gets the time of next schedule after last scheduled and before now -// -// it returns nil if no unmet schedule times. +// it returns nil if no unmet schedule times. // // If there are too many (>100) unstarted times, it will raise a warning and but still return // the list of missed times. diff --git a/pkg/controller/deployment/util/deployment_util.go b/pkg/controller/deployment/util/deployment_util.go index cb2fac36342..c8f12613b72 100644 --- a/pkg/controller/deployment/util/deployment_util.go +++ b/pkg/controller/deployment/util/deployment_util.go @@ -303,7 +303,7 @@ var annotationsToSkip = map[string]bool{ // skipCopyAnnotation returns true if we should skip copying the annotation with the given annotation key // TODO: How to decide which annotations should / should not be copied? // -// See https://github.com/kubernetes/kubernetes/pull/20035#issuecomment-179558615 +// See https://github.com/kubernetes/kubernetes/pull/20035#issuecomment-179558615 func skipCopyAnnotation(key string) bool { return annotationsToSkip[key] } diff --git a/pkg/controller/disruption/disruption_test.go b/pkg/controller/disruption/disruption_test.go index 83db2c3b8dc..6b0a95fa8d8 100644 --- a/pkg/controller/disruption/disruption_test.go +++ b/pkg/controller/disruption/disruption_test.go @@ -278,7 +278,6 @@ func updatePodOwnerToRs(t *testing.T, pod *v1.Pod, rs *apps.ReplicaSet) { pod.OwnerReferences = append(pod.OwnerReferences, controllerReference) } -// pod, podName := newPod(t, name) func updatePodOwnerToSs(t *testing.T, pod *v1.Pod, ss *apps.StatefulSet) { var controllerReference metav1.OwnerReference var trueVar = true diff --git a/pkg/controller/statefulset/stateful_set.go b/pkg/controller/statefulset/stateful_set.go index 214d5e18ebc..bc75933b1ee 100644 --- a/pkg/controller/statefulset/stateful_set.go +++ b/pkg/controller/statefulset/stateful_set.go @@ -290,8 +290,7 @@ func (ssc *StatefulSetController) deletePod(obj interface{}) { // It also reconciles ControllerRef by adopting/orphaning. // // NOTE: Returned Pods are pointers to objects from the cache. -// -// If you need to modify one, you need to copy it first. +// If you need to modify one, you need to copy it first. func (ssc *StatefulSetController) getPodsForStatefulSet(ctx context.Context, set *apps.StatefulSet, selector labels.Selector) ([]*v1.Pod, error) { // List all pods to include the pods that don't match the selector anymore but // has a ControllerRef pointing to this StatefulSet. diff --git a/pkg/controller/volume/attachdetach/populator/desired_state_of_world_populator.go b/pkg/controller/volume/attachdetach/populator/desired_state_of_world_populator.go index 9ee2dab3bb0..4948c26afaa 100644 --- a/pkg/controller/volume/attachdetach/populator/desired_state_of_world_populator.go +++ b/pkg/controller/volume/attachdetach/populator/desired_state_of_world_populator.go @@ -48,12 +48,10 @@ type DesiredStateOfWorldPopulator interface { // NewDesiredStateOfWorldPopulator returns a new instance of DesiredStateOfWorldPopulator. // loopSleepDuration - the amount of time the populator loop sleeps between -// -// successive executions +// successive executions // // podManager - the kubelet podManager that is the source of truth for the pods -// -// that exist on this host +// that exist on this host // // desiredStateOfWorld - the cache to populate func NewDesiredStateOfWorldPopulator( diff --git a/pkg/controlplane/instance.go b/pkg/controlplane/instance.go index 6c662e22827..db60aae7db0 100644 --- a/pkg/controlplane/instance.go +++ b/pkg/controlplane/instance.go @@ -343,8 +343,7 @@ func (c *Config) Complete() CompletedConfig { // New returns a new instance of Master from the given config. // Certain config fields will be set to a default value if unset. // Certain config fields must be specified, including: -// -// KubeletClientConfig +// KubeletClientConfig func (c completedConfig) New(delegationTarget genericapiserver.DelegationTarget) (*Instance, error) { if reflect.DeepEqual(c.ExtraConfig.KubeletClientConfig, kubeletclient.KubeletClientConfig{}) { return nil, fmt.Errorf("Master.New() called with empty config.KubeletClientConfig") diff --git a/pkg/generated/openapi/zz_generated.openapi.go b/pkg/generated/openapi/zz_generated.openapi.go index 9944cdbfb75..cb69ec8f781 100644 --- a/pkg/generated/openapi/zz_generated.openapi.go +++ b/pkg/generated/openapi/zz_generated.openapi.go @@ -15266,7 +15266,7 @@ func schema_k8sio_api_certificates_v1beta1_CertificateSigningRequestSpec(ref com }, }, SchemaProps: spec.SchemaProps{ - Description: "allowedUsages specifies a set of usage contexts the key will be valid for. See: https://tools.ietf.org/html/rfc5280#section-4.2.1.3\n https://tools.ietf.org/html/rfc5280#section-4.2.1.12\nValid values are:\n \"signing\",\n \"digital signature\",\n \"content commitment\",\n \"key encipherment\",\n \"key agreement\",\n \"data encipherment\",\n \"cert sign\",\n \"crl sign\",\n \"encipher only\",\n \"decipher only\",\n \"any\",\n \"server auth\",\n \"client auth\",\n \"code signing\",\n \"email protection\",\n \"s/mime\",\n \"ipsec end system\",\n \"ipsec tunnel\",\n \"ipsec user\",\n \"timestamping\",\n \"ocsp signing\",\n \"microsoft sgc\",\n \"netscape sgc\"", + Description: "allowedUsages specifies a set of usage contexts the key will be valid for. See:\n\thttps://tools.ietf.org/html/rfc5280#section-4.2.1.3\n\thttps://tools.ietf.org/html/rfc5280#section-4.2.1.12\n\nValid values are:\n \"signing\",\n \"digital signature\",\n \"content commitment\",\n \"key encipherment\",\n \"key agreement\",\n \"data encipherment\",\n \"cert sign\",\n \"crl sign\",\n \"encipher only\",\n \"decipher only\",\n \"any\",\n \"server auth\",\n \"client auth\",\n \"code signing\",\n \"email protection\",\n \"s/mime\",\n \"ipsec end system\",\n \"ipsec tunnel\",\n \"ipsec user\",\n \"timestamping\",\n \"ocsp signing\",\n \"microsoft sgc\",\n \"netscape sgc\"", Type: []string{"array"}, Items: &spec.SchemaOrArray{ Schema: &spec.Schema{ diff --git a/pkg/kubelet/kubelet.go b/pkg/kubelet/kubelet.go index fac27f9a9df..c20b70fd1f0 100644 --- a/pkg/kubelet/kubelet.go +++ b/pkg/kubelet/kubelet.go @@ -32,11 +32,13 @@ import ( "time" "github.com/opencontainers/selinux/go-selinux" + "k8s.io/client-go/informers" cadvisorapi "github.com/google/cadvisor/info/v1" libcontaineruserns "github.com/opencontainers/runc/libcontainer/userns" "go.opentelemetry.io/otel/trace" + "k8s.io/mount-utils" "k8s.io/utils/integer" netutils "k8s.io/utils/net" @@ -1572,15 +1574,15 @@ func (kl *Kubelet) Run(updates <-chan kubetypes.PodUpdate) { // Arguments: // // updateType - whether this is a create (first time) or an update, should -// -// only be used for metrics since this method must be reentrant +// only be used for metrics since this method must be reentrant // // pod - the pod that is being set up -// mirrorPod - the mirror pod known to the kubelet for this pod, if any -// podStatus - the most recent pod status observed for this pod which can // -// be used to determine the set of actions that should be taken during -// this loop of syncPod +// mirrorPod - the mirror pod known to the kubelet for this pod, if any +// +// podStatus - the most recent pod status observed for this pod which can +// be used to determine the set of actions that should be taken during +// this loop of syncPod // // The workflow is: // - If the pod is being created, record pod worker start latency diff --git a/pkg/kubelet/lifecycle/predicate.go b/pkg/kubelet/lifecycle/predicate.go index 2e06c266f73..96808cf7100 100644 --- a/pkg/kubelet/lifecycle/predicate.go +++ b/pkg/kubelet/lifecycle/predicate.go @@ -185,8 +185,7 @@ func rejectPodAdmissionBasedOnOSSelector(pod *v1.Pod, node *v1.Node) bool { // rejectPodAdmissionBasedOnOSField rejects pods if their OS field doesn't match runtime.GOOS. // TODO: Relax this restriction when we start supporting LCOW in kubernetes where podOS may not match -// -// node's OS. +// node's OS. func rejectPodAdmissionBasedOnOSField(pod *v1.Pod) bool { if pod.Spec.OS == nil { return false diff --git a/pkg/kubelet/pluginmanager/cache/types.go b/pkg/kubelet/pluginmanager/cache/types.go index 6b0a9a430f0..aef225d31cb 100644 --- a/pkg/kubelet/pluginmanager/cache/types.go +++ b/pkg/kubelet/pluginmanager/cache/types.go @@ -36,14 +36,12 @@ package cache // // The pluginwatcher module follows strictly and sequentially this state machine for each *plugin name*. // e.g: If you are Registering a plugin foo, you cannot get a DeRegister call for plugin foo -// -// until the Register("foo") call returns. Nor will you get a Validate("foo", "Different endpoint", ...) -// call until the Register("foo") call returns. +// until the Register("foo") call returns. Nor will you get a Validate("foo", "Different endpoint", ...) +// call until the Register("foo") call returns. // // ReRegistration: Socket created with same plugin name, usually for a plugin update // e.g: plugin with name foo registers at foo.com/foo-1.9.7 later a plugin with name foo -// -// registers at foo.com/foo-1.9.9 +// registers at foo.com/foo-1.9.9 // // DeRegistration: When ReRegistration happens only the deletion of the new socket will trigger a DeRegister call type PluginHandler interface { diff --git a/pkg/kubelet/pluginmanager/reconciler/reconciler.go b/pkg/kubelet/pluginmanager/reconciler/reconciler.go index 0c14c1c4cb7..68b5fd764f8 100644 --- a/pkg/kubelet/pluginmanager/reconciler/reconciler.go +++ b/pkg/kubelet/pluginmanager/reconciler/reconciler.go @@ -47,18 +47,15 @@ type Reconciler interface { // NewReconciler returns a new instance of Reconciler. // -// loopSleepDuration - the amount of time the reconciler loop sleeps between -// -// successive executions -// syncDuration - the amount of time the syncStates sleeps between -// successive executions -// // operationExecutor - used to trigger register/unregister operations safely +// (prevents more than one operation from being triggered on the same +// socket path) // -// (prevents more than one operation from being triggered on the same -// socket path) +// loopSleepDuration - the amount of time the reconciler loop sleeps between +// successive executions // // desiredStateOfWorld - cache containing the desired state of the world +// // actualStateOfWorld - cache containing the actual state of the world func NewReconciler( operationExecutor operationexecutor.OperationExecutor, diff --git a/pkg/kubelet/volumemanager/populator/desired_state_of_world_populator.go b/pkg/kubelet/volumemanager/populator/desired_state_of_world_populator.go index a18df61916d..95fbbdc587e 100644 --- a/pkg/kubelet/volumemanager/populator/desired_state_of_world_populator.go +++ b/pkg/kubelet/volumemanager/populator/desired_state_of_world_populator.go @@ -81,12 +81,10 @@ type podStateProvider interface { // // kubeClient - used to fetch PV and PVC objects from the API server // loopSleepDuration - the amount of time the populator loop sleeps between -// -// successive executions +// successive executions // // podManager - the kubelet podManager that is the source of truth for the pods -// -// that exist on this host +// that exist on this host // // desiredStateOfWorld - the cache to populate func NewDesiredStateOfWorldPopulator( diff --git a/pkg/kubelet/volumemanager/reconciler/reconciler_common.go b/pkg/kubelet/volumemanager/reconciler/reconciler_common.go index c88bb156b63..e51ddd85e5f 100644 --- a/pkg/kubelet/volumemanager/reconciler/reconciler_common.go +++ b/pkg/kubelet/volumemanager/reconciler/reconciler_common.go @@ -60,33 +60,33 @@ type Reconciler interface { // NewReconciler returns a new instance of Reconciler. // // controllerAttachDetachEnabled - if true, indicates that the attach/detach -// -// controller is responsible for managing the attach/detach operations for -// this node, and therefore the volume manager should not +// controller is responsible for managing the attach/detach operations for +// this node, and therefore the volume manager should not // // loopSleepDuration - the amount of time the reconciler loop sleeps between -// -// successive executions +// successive executions // // waitForAttachTimeout - the amount of time the Mount function will wait for -// -// the volume to be attached +// the volume to be attached // // nodeName - the Name for this node, used by Attach and Detach methods -// desiredStateOfWorld - cache containing the desired state of the world -// actualStateOfWorld - cache containing the actual state of the world -// populatorHasAddedPods - checker for whether the populator has finished // -// adding pods to the desiredStateOfWorld cache at least once after sources -// are all ready (before sources are ready, pods are probably missing) +// desiredStateOfWorld - cache containing the desired state of the world +// +// actualStateOfWorld - cache containing the actual state of the world +// +// populatorHasAddedPods - checker for whether the populator has finished +// adding pods to the desiredStateOfWorld cache at least once after sources +// are all ready (before sources are ready, pods are probably missing) // // operationExecutor - used to trigger attach/detach/mount/unmount operations -// -// safely (prevents more than one operation from being triggered on the same -// volume) +// safely (prevents more than one operation from being triggered on the same +// volume) // // mounter - mounter passed in from kubelet, passed down unmount path +// // hostutil - hostutil passed in from kubelet +// // volumePluginMgr - volume plugin manager passed from kubelet func NewReconciler( kubeClient clientset.Interface, diff --git a/pkg/kubelet/volumemanager/volume_manager.go b/pkg/kubelet/volumemanager/volume_manager.go index ee58b2fcaa7..e7a962aa67e 100644 --- a/pkg/kubelet/volumemanager/volume_manager.go +++ b/pkg/kubelet/volumemanager/volume_manager.go @@ -165,12 +165,10 @@ type podStateProvider interface { // VolumeManager interface. // // kubeClient - kubeClient is the kube API client used by DesiredStateOfWorldPopulator -// -// to communicate with the API server to fetch PV and PVC objects +// to communicate with the API server to fetch PV and PVC objects // // volumePluginMgr - the volume plugin manager used to access volume plugins. -// -// Must be pre-initialized. +// Must be pre-initialized. func NewVolumeManager( controllerAttachDetachEnabled bool, nodeName k8stypes.NodeName, diff --git a/pkg/probe/http/http.go b/pkg/probe/http/http.go index 025418becb3..9fff5744e4b 100644 --- a/pkg/probe/http/http.go +++ b/pkg/probe/http/http.go @@ -36,8 +36,7 @@ const ( // New creates Prober that will skip TLS verification while probing. // followNonLocalRedirects configures whether the prober should follow redirects to a different hostname. -// -// If disabled, redirects to other hosts will trigger a warning result. +// If disabled, redirects to other hosts will trigger a warning result. func New(followNonLocalRedirects bool) Prober { tlsConfig := &tls.Config{InsecureSkipVerify: true} return NewWithTLSConfig(tlsConfig, followNonLocalRedirects) @@ -45,8 +44,7 @@ func New(followNonLocalRedirects bool) Prober { // NewWithTLSConfig takes tls config as parameter. // followNonLocalRedirects configures whether the prober should follow redirects to a different hostname. -// -// If disabled, redirects to other hosts will trigger a warning result. +// If disabled, redirects to other hosts will trigger a warning result. func NewWithTLSConfig(config *tls.Config, followNonLocalRedirects bool) Prober { // We do not want the probe use node's local proxy set. transport := utilnet.SetTransportDefaults( diff --git a/pkg/proxy/service.go b/pkg/proxy/service.go index ba22d0cf8db..ceae54eb202 100644 --- a/pkg/proxy/service.go +++ b/pkg/proxy/service.go @@ -429,14 +429,16 @@ func (sm *ServicePortMap) apply(changes *ServiceChangeTracker, UDPStaleClusterIP // - produce a string set which stores all other ServicePortMap's ServicePortName.String(). // // For example, -// - A{} -// - B{{"ns", "cluster-ip", "http"}: {"172.16.55.10", 1234, "TCP"}} -// - A updated to be {{"ns", "cluster-ip", "http"}: {"172.16.55.10", 1234, "TCP"}} -// - produce string set {"ns/cluster-ip:http"} -// - A{{"ns", "cluster-ip", "http"}: {"172.16.55.10", 345, "UDP"}} -// - B{{"ns", "cluster-ip", "http"}: {"172.16.55.10", 1234, "TCP"}} -// - A updated to be {{"ns", "cluster-ip", "http"}: {"172.16.55.10", 1234, "TCP"}} -// - produce string set {"ns/cluster-ip:http"} +// +// A{} +// B{{"ns", "cluster-ip", "http"}: {"172.16.55.10", 1234, "TCP"}} +// A updated to be {{"ns", "cluster-ip", "http"}: {"172.16.55.10", 1234, "TCP"}} +// produce string set {"ns/cluster-ip:http"} +// +// A{{"ns", "cluster-ip", "http"}: {"172.16.55.10", 345, "UDP"}} +// B{{"ns", "cluster-ip", "http"}: {"172.16.55.10", 1234, "TCP"}} +// A updated to be {{"ns", "cluster-ip", "http"}: {"172.16.55.10", 1234, "TCP"}} +// produce string set {"ns/cluster-ip:http"} func (sm *ServicePortMap) merge(other ServicePortMap) sets.String { // existingPorts is going to store all identifiers of all services in `other` ServicePortMap. existingPorts := sets.NewString() diff --git a/pkg/scheduler/framework/plugins/interpodaffinity/filtering.go b/pkg/scheduler/framework/plugins/interpodaffinity/filtering.go index b84fc8a788b..35d75d258b4 100644 --- a/pkg/scheduler/framework/plugins/interpodaffinity/filtering.go +++ b/pkg/scheduler/framework/plugins/interpodaffinity/filtering.go @@ -150,8 +150,8 @@ func podMatchesAllAffinityTerms(terms []framework.AffinityTerm, pod *v1.Pod) boo } // calculates the following for each existing pod on each node: -// (1) Whether it has PodAntiAffinity -// (2) Whether any AffinityTerm matches the incoming pod +// 1. Whether it has PodAntiAffinity +// 2. Whether any AffinityTerm matches the incoming pod func (pl *InterPodAffinity) getExistingAntiAffinityCounts(ctx context.Context, pod *v1.Pod, nsLabels labels.Set, nodes []*framework.NodeInfo) topologyToMatchedTermCount { topoMaps := make([]topologyToMatchedTermCount, len(nodes)) index := int32(-1) diff --git a/plugin/pkg/auth/authorizer/node/graph.go b/plugin/pkg/auth/authorizer/node/graph.go index bd5feea89f2..e7e5337a168 100644 --- a/plugin/pkg/auth/authorizer/node/graph.go +++ b/plugin/pkg/auth/authorizer/node/graph.go @@ -327,8 +327,7 @@ func (g *Graph) recomputeDestinationIndex_locked(n graph.Node) { // AddPod should only be called once spec.NodeName is populated. // It sets up edges for the following relationships (which are immutable for a pod once bound to a node): // -// pod -> node -// +// pod -> node // secret -> pod // configmap -> pod // pvc -> pod diff --git a/staging/src/k8s.io/api/certificates/v1/types.go b/staging/src/k8s.io/api/certificates/v1/types.go index af5efb5165b..92b2018e761 100644 --- a/staging/src/k8s.io/api/certificates/v1/types.go +++ b/staging/src/k8s.io/api/certificates/v1/types.go @@ -274,8 +274,9 @@ type CertificateSigningRequestList struct { } // KeyUsage specifies valid usage contexts for keys. -// See: https://tools.ietf.org/html/rfc5280#section-4.2.1.3 +// See: // +// https://tools.ietf.org/html/rfc5280#section-4.2.1.3 // https://tools.ietf.org/html/rfc5280#section-4.2.1.12 // // +enum diff --git a/staging/src/k8s.io/api/certificates/v1beta1/generated.proto b/staging/src/k8s.io/api/certificates/v1beta1/generated.proto index e246fba021c..f70f01ef7ab 100644 --- a/staging/src/k8s.io/api/certificates/v1beta1/generated.proto +++ b/staging/src/k8s.io/api/certificates/v1beta1/generated.proto @@ -124,8 +124,10 @@ message CertificateSigningRequestSpec { // allowedUsages specifies a set of usage contexts the key will be // valid for. - // See: https://tools.ietf.org/html/rfc5280#section-4.2.1.3 - // https://tools.ietf.org/html/rfc5280#section-4.2.1.12 + // See: + // https://tools.ietf.org/html/rfc5280#section-4.2.1.3 + // https://tools.ietf.org/html/rfc5280#section-4.2.1.12 + // // Valid values are: // "signing", // "digital signature", diff --git a/staging/src/k8s.io/api/certificates/v1beta1/types.go b/staging/src/k8s.io/api/certificates/v1beta1/types.go index fe7aab9704d..7e5a5c198a6 100644 --- a/staging/src/k8s.io/api/certificates/v1beta1/types.go +++ b/staging/src/k8s.io/api/certificates/v1beta1/types.go @@ -89,8 +89,10 @@ type CertificateSigningRequestSpec struct { // allowedUsages specifies a set of usage contexts the key will be // valid for. - // See: https://tools.ietf.org/html/rfc5280#section-4.2.1.3 - // https://tools.ietf.org/html/rfc5280#section-4.2.1.12 + // See: + // https://tools.ietf.org/html/rfc5280#section-4.2.1.3 + // https://tools.ietf.org/html/rfc5280#section-4.2.1.12 + // // Valid values are: // "signing", // "digital signature", @@ -229,8 +231,9 @@ type CertificateSigningRequestList struct { } // KeyUsages specifies valid usage contexts for keys. -// See: https://tools.ietf.org/html/rfc5280#section-4.2.1.3 +// See: // +// https://tools.ietf.org/html/rfc5280#section-4.2.1.3 // https://tools.ietf.org/html/rfc5280#section-4.2.1.12 type KeyUsage string diff --git a/staging/src/k8s.io/api/certificates/v1beta1/types_swagger_doc_generated.go b/staging/src/k8s.io/api/certificates/v1beta1/types_swagger_doc_generated.go index d3f318150cb..6991257cdab 100644 --- a/staging/src/k8s.io/api/certificates/v1beta1/types_swagger_doc_generated.go +++ b/staging/src/k8s.io/api/certificates/v1beta1/types_swagger_doc_generated.go @@ -55,7 +55,7 @@ var map_CertificateSigningRequestSpec = map[string]string{ "request": "Base64-encoded PKCS#10 CSR data", "signerName": "Requested signer for the request. It is a qualified name in the form: `scope-hostname.io/name`. If empty, it will be defaulted:\n 1. If it's a kubelet client certificate, it is assigned\n \"kubernetes.io/kube-apiserver-client-kubelet\".\n 2. If it's a kubelet serving certificate, it is assigned\n \"kubernetes.io/kubelet-serving\".\n 3. Otherwise, it is assigned \"kubernetes.io/legacy-unknown\".\nDistribution of trust for signers happens out of band. You can select on this field using `spec.signerName`.", "expirationSeconds": "expirationSeconds is the requested duration of validity of the issued certificate. The certificate signer may issue a certificate with a different validity duration so a client must check the delta between the notBefore and and notAfter fields in the issued certificate to determine the actual duration.\n\nThe v1.22+ in-tree implementations of the well-known Kubernetes signers will honor this field as long as the requested duration is not greater than the maximum duration they will honor per the --cluster-signing-duration CLI flag to the Kubernetes controller manager.\n\nCertificate signers may not honor this field for various reasons:\n\n 1. Old signer that is unaware of the field (such as the in-tree\n implementations prior to v1.22)\n 2. Signer whose configured maximum is shorter than the requested duration\n 3. Signer whose configured minimum is longer than the requested duration\n\nThe minimum valid value for expirationSeconds is 600, i.e. 10 minutes.", - "usages": "allowedUsages specifies a set of usage contexts the key will be valid for. See: https://tools.ietf.org/html/rfc5280#section-4.2.1.3\n https://tools.ietf.org/html/rfc5280#section-4.2.1.12\nValid values are:\n \"signing\",\n \"digital signature\",\n \"content commitment\",\n \"key encipherment\",\n \"key agreement\",\n \"data encipherment\",\n \"cert sign\",\n \"crl sign\",\n \"encipher only\",\n \"decipher only\",\n \"any\",\n \"server auth\",\n \"client auth\",\n \"code signing\",\n \"email protection\",\n \"s/mime\",\n \"ipsec end system\",\n \"ipsec tunnel\",\n \"ipsec user\",\n \"timestamping\",\n \"ocsp signing\",\n \"microsoft sgc\",\n \"netscape sgc\"", + "usages": "allowedUsages specifies a set of usage contexts the key will be valid for. See:\n\thttps://tools.ietf.org/html/rfc5280#section-4.2.1.3\n\thttps://tools.ietf.org/html/rfc5280#section-4.2.1.12\n\nValid values are:\n \"signing\",\n \"digital signature\",\n \"content commitment\",\n \"key encipherment\",\n \"key agreement\",\n \"data encipherment\",\n \"cert sign\",\n \"crl sign\",\n \"encipher only\",\n \"decipher only\",\n \"any\",\n \"server auth\",\n \"client auth\",\n \"code signing\",\n \"email protection\",\n \"s/mime\",\n \"ipsec end system\",\n \"ipsec tunnel\",\n \"ipsec user\",\n \"timestamping\",\n \"ocsp signing\",\n \"microsoft sgc\",\n \"netscape sgc\"", "username": "Information about the requesting user. See user.Info interface for details.", "uid": "UID information about the requesting user. See user.Info interface for details.", "groups": "Group information about the requesting user. See user.Info interface for details.", diff --git a/staging/src/k8s.io/api/core/v1/toleration.go b/staging/src/k8s.io/api/core/v1/toleration.go index 9341abf8919..e803d518b5c 100644 --- a/staging/src/k8s.io/api/core/v1/toleration.go +++ b/staging/src/k8s.io/api/core/v1/toleration.go @@ -28,15 +28,13 @@ func (t *Toleration) MatchToleration(tolerationToMatch *Toleration) bool { // ToleratesTaint checks if the toleration tolerates the taint. // The matching follows the rules below: -// (1) Empty toleration.effect means to match all taint effects, // -// otherwise taint effect must equal to toleration.effect. -// -// (2) If toleration.operator is 'Exists', it means to match all taint values. -// (3) Empty toleration.key means to match all taint keys. -// -// If toleration.key is empty, toleration.operator must be 'Exists'; -// this combination means to match all taint values and all taint keys. +// 1. Empty toleration.effect means to match all taint effects, +// otherwise taint effect must equal to toleration.effect. +// 2. If toleration.operator is 'Exists', it means to match all taint values. +// 3. Empty toleration.key means to match all taint keys. +// If toleration.key is empty, toleration.operator must be 'Exists'; +// this combination means to match all taint values and all taint keys. func (t *Toleration) ToleratesTaint(taint *Taint) bool { if len(t.Effect) > 0 && t.Effect != taint.Effect { return false diff --git a/staging/src/k8s.io/apiextensions-apiserver/pkg/apiserver/schema/cel/compilation.go b/staging/src/k8s.io/apiextensions-apiserver/pkg/apiserver/schema/cel/compilation.go index 2cede89841a..5ead877b803 100644 --- a/staging/src/k8s.io/apiextensions-apiserver/pkg/apiserver/schema/cel/compilation.go +++ b/staging/src/k8s.io/apiextensions-apiserver/pkg/apiserver/schema/cel/compilation.go @@ -96,7 +96,7 @@ func getBaseEnv() (*cel.Env, error) { // CompilationResult for each ValidationRule, or an error. declType is expected to be a CEL DeclType corresponding // to the structural schema. // Each CompilationResult may contain: -// / - non-nil Program, nil Error: The program was compiled successfully +// - non-nil Program, nil Error: The program was compiled successfully // - nil Program, non-nil Error: Compilation resulted in an error // - nil Program, nil Error: The provided rule was empty so compilation was not attempted // diff --git a/staging/src/k8s.io/apiextensions-apiserver/pkg/cmd/server/testing/testserver.go b/staging/src/k8s.io/apiextensions-apiserver/pkg/cmd/server/testing/testserver.go index 324d1be096d..0b8e43d2fc7 100644 --- a/staging/src/k8s.io/apiextensions-apiserver/pkg/cmd/server/testing/testserver.go +++ b/staging/src/k8s.io/apiextensions-apiserver/pkg/cmd/server/testing/testserver.go @@ -69,9 +69,8 @@ func NewDefaultTestServerOptions() *TestServerInstanceOptions { // and location of the tmpdir are returned. // // Note: we return a tear-down func instead of a stop channel because the later will leak temporary -// -// files that because Golang testing's call to os.Exit will not give a stop channel go routine -// enough time to remove temporary files. +// files that because Golang testing's call to os.Exit will not give a stop channel go routine +// enough time to remove temporary files. func StartTestServer(t Logger, _ *TestServerInstanceOptions, customFlags []string, storageConfig *storagebackend.Config) (result TestServer, err error) { stopCh := make(chan struct{}) var errCh chan error diff --git a/staging/src/k8s.io/apimachinery/pkg/api/meta/help.go b/staging/src/k8s.io/apimachinery/pkg/api/meta/help.go index 899d3e8a667..1bf6b06d47f 100644 --- a/staging/src/k8s.io/apimachinery/pkg/api/meta/help.go +++ b/staging/src/k8s.io/apimachinery/pkg/api/meta/help.go @@ -40,8 +40,7 @@ var ( // IsListType returns true if the provided Object has a slice called Items. // TODO: Replace the code in this check with an interface comparison by -// -// creating and enforcing that lists implement a list accessor. +// creating and enforcing that lists implement a list accessor. func IsListType(obj runtime.Object) bool { switch t := obj.(type) { case runtime.Unstructured: diff --git a/staging/src/k8s.io/apimachinery/pkg/labels/selector.go b/staging/src/k8s.io/apimachinery/pkg/labels/selector.go index a64c66aca08..5e601424051 100644 --- a/staging/src/k8s.io/apimachinery/pkg/labels/selector.go +++ b/staging/src/k8s.io/apimachinery/pkg/labels/selector.go @@ -149,14 +149,12 @@ type Requirement struct { // NewRequirement is the constructor for a Requirement. // If any of these rules is violated, an error is returned: -// (1) The operator can only be In, NotIn, Equals, DoubleEquals, Gt, Lt, NotEquals, Exists, or DoesNotExist. -// (2) If the operator is In or NotIn, the values set must be non-empty. -// (3) If the operator is Equals, DoubleEquals, or NotEquals, the values set must contain one value. -// (4) If the operator is Exists or DoesNotExist, the value set must be empty. -// (5) If the operator is Gt or Lt, the values set must contain only one value, which will be interpreted as an integer. -// (6) The key is invalid due to its length, or sequence -// -// of characters. See validateLabelKey for more details. +// 1. The operator can only be In, NotIn, Equals, DoubleEquals, Gt, Lt, NotEquals, Exists, or DoesNotExist. +// 2. If the operator is In or NotIn, the values set must be non-empty. +// 3. If the operator is Equals, DoubleEquals, or NotEquals, the values set must contain one value. +// 4. If the operator is Exists or DoesNotExist, the value set must be empty. +// 5. If the operator is Gt or Lt, the values set must contain only one value, which will be interpreted as an integer. +// 6. The key is invalid due to its length, or sequence of characters. See validateLabelKey for more details. // // The empty string is a valid value in the input values set. // Returned error, if not nil, is guaranteed to be an aggregated field.ErrorList @@ -213,22 +211,15 @@ func (r *Requirement) hasValue(value string) bool { // Matches returns true if the Requirement matches the input Labels. // There is a match in the following cases: -// (1) The operator is Exists and Labels has the Requirement's key. -// (2) The operator is In, Labels has the Requirement's key and Labels' -// -// value for that key is in Requirement's value set. -// -// (3) The operator is NotIn, Labels has the Requirement's key and -// -// Labels' value for that key is not in Requirement's value set. -// -// (4) The operator is DoesNotExist or NotIn and Labels does not have the -// -// Requirement's key. -// -// (5) The operator is GreaterThanOperator or LessThanOperator, and Labels has -// -// the Requirement's key and the corresponding value satisfies mathematical inequality. +// 1. The operator is Exists and Labels has the Requirement's key. +// 2. The operator is In, Labels has the Requirement's key and Labels' +// value for that key is in Requirement's value set. +// 3. The operator is NotIn, Labels has the Requirement's key and +// Labels' value for that key is not in Requirement's value set. +// 4. The operator is DoesNotExist or NotIn and Labels does not have the +// Requirement's key. +// 5. The operator is GreaterThanOperator or LessThanOperator, and Labels has +// the Requirement's key and the corresponding value satisfies mathematical inequality. func (r *Requirement) Matches(ls Labels) bool { switch r.operator { case selection.In, selection.Equals, selection.DoubleEquals: @@ -872,15 +863,14 @@ func (p *Parser) parseExactValue() (sets.String, error) { // "x in (foo,,baz),y,z notin ()" // // Note: -// -// (1) Inclusion - " in " - denotes that the KEY exists and is equal to any of the -// VALUEs in its requirement -// (2) Exclusion - " notin " - denotes that the KEY is not equal to any -// of the VALUEs in its requirement or does not exist -// (3) The empty string is a valid VALUE -// (4) A requirement with just a KEY - as in "y" above - denotes that -// the KEY exists and can be any VALUE. -// (5) A requirement with just !KEY requires that the KEY not exist. +// 1. Inclusion - " in " - denotes that the KEY exists and is equal to any of the +// VALUEs in its requirement +// 2. Exclusion - " notin " - denotes that the KEY is not equal to any +// of the VALUEs in its requirement or does not exist +// 3. The empty string is a valid VALUE +// 4. A requirement with just a KEY - as in "y" above - denotes that +// the KEY exists and can be any VALUE. +// 5. A requirement with just !KEY requires that the KEY not exist. func Parse(selector string, opts ...field.PathOption) (Selector, error) { parsedSelector, err := parse(selector, field.ToPath(opts...)) if err == nil { diff --git a/staging/src/k8s.io/apimachinery/pkg/runtime/schema/group_version.go b/staging/src/k8s.io/apimachinery/pkg/runtime/schema/group_version.go index b21eb664e3f..54ccb7a74c7 100644 --- a/staging/src/k8s.io/apimachinery/pkg/runtime/schema/group_version.go +++ b/staging/src/k8s.io/apimachinery/pkg/runtime/schema/group_version.go @@ -191,8 +191,7 @@ func (gv GroupVersion) Identifier() string { // if none of the options match the group. It prefers a match to group and version over just group. // TODO: Move GroupVersion to a package under pkg/runtime, since it's used by scheme. // TODO: Introduce an adapter type between GroupVersion and runtime.GroupVersioner, and use LegacyCodec(GroupVersion) -// -// in fewer places. +// in fewer places. func (gv GroupVersion) KindForGroupVersionKinds(kinds []GroupVersionKind) (target GroupVersionKind, ok bool) { for _, gvk := range kinds { if gvk.Group == gv.Group && gvk.Version == gv.Version { @@ -240,8 +239,7 @@ func (gv GroupVersion) WithResource(resource string) GroupVersionResource { // GroupVersions can be used to represent a set of desired group versions. // TODO: Move GroupVersions to a package under pkg/runtime, since it's used by scheme. // TODO: Introduce an adapter type between GroupVersions and runtime.GroupVersioner, and use LegacyCodec(GroupVersion) -// -// in fewer places. +// in fewer places. type GroupVersions []GroupVersion // Identifier implements runtime.GroupVersioner interface. diff --git a/staging/src/k8s.io/apimachinery/pkg/runtime/scheme.go b/staging/src/k8s.io/apimachinery/pkg/runtime/scheme.go index 18b25a994b8..a5b116718d5 100644 --- a/staging/src/k8s.io/apimachinery/pkg/runtime/scheme.go +++ b/staging/src/k8s.io/apimachinery/pkg/runtime/scheme.go @@ -118,8 +118,7 @@ func (s *Scheme) Converter() *conversion.Converter { // API group and version that would never be updated. // // TODO: there is discussion about removing unversioned and replacing it with objects that are manifest into -// -// every version with particular schemas. Resolve this method at that point. +// every version with particular schemas. Resolve this method at that point. func (s *Scheme) AddUnversionedTypes(version schema.GroupVersion, types ...Object) { s.addObservedVersion(version) s.AddKnownTypes(version, types...) diff --git a/staging/src/k8s.io/apimachinery/pkg/runtime/serializer/codec_factory.go b/staging/src/k8s.io/apimachinery/pkg/runtime/serializer/codec_factory.go index 21944f2d8fd..ff982084204 100644 --- a/staging/src/k8s.io/apimachinery/pkg/runtime/serializer/codec_factory.go +++ b/staging/src/k8s.io/apimachinery/pkg/runtime/serializer/codec_factory.go @@ -259,8 +259,7 @@ func (f CodecFactory) SupportedMediaTypes() []runtime.SerializerInfo { // invoke CodecForVersions. Callers that need only to read data should use UniversalDecoder(). // // TODO: make this call exist only in pkg/api, and initialize it with the set of default versions. -// -// All other callers will be forced to request a Codec directly. +// All other callers will be forced to request a Codec directly. func (f CodecFactory) LegacyCodec(version ...schema.GroupVersion) runtime.Codec { return versioning.NewDefaultingCodecForScheme(f.scheme, f.legacySerializer, f.universal, schema.GroupVersions(version), runtime.InternalGroupVersioner) } diff --git a/staging/src/k8s.io/apimachinery/pkg/util/mergepatch/util.go b/staging/src/k8s.io/apimachinery/pkg/util/mergepatch/util.go index e3962756822..a20efd18715 100644 --- a/staging/src/k8s.io/apimachinery/pkg/util/mergepatch/util.go +++ b/staging/src/k8s.io/apimachinery/pkg/util/mergepatch/util.go @@ -88,8 +88,7 @@ func toYAML(v interface{}) (string, error) { // supports JSON merge patch semantics. // // NOTE: Numbers with different types (e.g. int(0) vs int64(0)) will be detected as conflicts. -// -// Make sure the unmarshaling of left and right are consistent (e.g. use the same library). +// Make sure the unmarshaling of left and right are consistent (e.g. use the same library). func HasConflicts(left, right interface{}) (bool, error) { switch typedLeft := left.(type) { case map[string]interface{}: diff --git a/staging/src/k8s.io/apiserver/pkg/endpoints/discovery/aggregated/etag.go b/staging/src/k8s.io/apiserver/pkg/endpoints/discovery/aggregated/etag.go index d74e376c7dd..01cc682efd0 100644 --- a/staging/src/k8s.io/apiserver/pkg/endpoints/discovery/aggregated/etag.go +++ b/staging/src/k8s.io/apiserver/pkg/endpoints/discovery/aggregated/etag.go @@ -35,8 +35,7 @@ import ( // - Replies with 304 Not Modified, if If-None-Match header matches hash // // hash should be the value of calculateETag on object. If hash is empty, then -// -// the object is simply serialized without E-Tag functionality +// the object is simply serialized without E-Tag functionality func ServeHTTPWithETag( object runtime.Object, hash string, diff --git a/staging/src/k8s.io/apiserver/pkg/server/options/authorization.go b/staging/src/k8s.io/apiserver/pkg/server/options/authorization.go index c31ce47f8ca..9b2dcb3fff7 100644 --- a/staging/src/k8s.io/apiserver/pkg/server/options/authorization.go +++ b/staging/src/k8s.io/apiserver/pkg/server/options/authorization.go @@ -38,9 +38,8 @@ import ( // DelegatingAuthorizationOptions provides an easy way for composing API servers to delegate their authorization to // the root kube API server. // WARNING: never assume that every authenticated incoming request already does authorization. -// -// The aggregator in the kube API server does this today, but this behaviour is not -// guaranteed in the future. +// The aggregator in the kube API server does this today, but this behaviour is not +// guaranteed in the future. type DelegatingAuthorizationOptions struct { // RemoteKubeConfigFile is the file to use to connect to a "normal" kube API server which hosts the // SubjectAccessReview.authorization.k8s.io endpoint for checking tokens. diff --git a/staging/src/k8s.io/apiserver/pkg/storage/etcd3/latency_tracker.go b/staging/src/k8s.io/apiserver/pkg/storage/etcd3/latency_tracker.go index 96d592e7907..f60210f96c7 100644 --- a/staging/src/k8s.io/apiserver/pkg/storage/etcd3/latency_tracker.go +++ b/staging/src/k8s.io/apiserver/pkg/storage/etcd3/latency_tracker.go @@ -47,8 +47,7 @@ func NewETCDLatencyTracker(delegate clientv3.KV) clientv3.KV { // tracking function TrackStorageLatency is thread safe. // // NOTE: Compact is an asynchronous process and is not associated with -// -// any request, so we will not be tracking its latency. +// any request, so we will not be tracking its latency. type clientV3KVLatencyTracker struct { clientv3.KV } diff --git a/staging/src/k8s.io/apiserver/pkg/util/flowcontrol/conc_alloc.go b/staging/src/k8s.io/apiserver/pkg/util/flowcontrol/conc_alloc.go index 43603907114..904f4fce2f6 100644 --- a/staging/src/k8s.io/apiserver/pkg/util/flowcontrol/conc_alloc.go +++ b/staging/src/k8s.io/apiserver/pkg/util/flowcontrol/conc_alloc.go @@ -108,11 +108,12 @@ const epsilon = 0.0000001 // if possible otherwise returns an error saying why it is impossible. // `allocs` sums to `requiredSum`. // For each J in [0, len(classes)): -// (1) `classes[J].lowerBound <= allocs[J] <= classes[J].upperBound` and -// (2) exactly one of the following is true: -// (2a) `allocs[J] == fairProp * classes[J].target`, -// (2b) `allocs[J] == classes[J].lowerBound && classes[J].lowerBound > fairProp * classes[J].target`, or -// (2c) `allocs[J] == classes[J].upperBound && classes[J].upperBound < fairProp * classes[J].target`. +// 1. `classes[J].lowerBound <= allocs[J] <= classes[J].upperBound` and +// 2. exactly one of the following is true: +// 2a. `allocs[J] == fairProp * classes[J].target`, +// 2b. `allocs[J] == classes[J].lowerBound && classes[J].lowerBound > fairProp * classes[J].target`, or +// 2c. `allocs[J] == classes[J].upperBound && classes[J].upperBound < fairProp * classes[J].target`. +// // Each allocProblemItem is required to have `target >= lowerBound >= 0` and `upperBound >= lowerBound`. // A target smaller than MinTarget is treated as if it were MinTarget. func computeConcurrencyAllocation(requiredSum int, classes []allocProblemItem) ([]float64, float64, error) { diff --git a/staging/src/k8s.io/apiserver/pkg/util/flowcontrol/fairqueuing/testing/eventclock/fake.go b/staging/src/k8s.io/apiserver/pkg/util/flowcontrol/fairqueuing/testing/eventclock/fake.go index f23cae11d4f..95ddb5b854f 100644 --- a/staging/src/k8s.io/apiserver/pkg/util/flowcontrol/fairqueuing/testing/eventclock/fake.go +++ b/staging/src/k8s.io/apiserver/pkg/util/flowcontrol/fairqueuing/testing/eventclock/fake.go @@ -40,8 +40,7 @@ type waitGroupCounter struct { } // compile time assertion that waitGroupCounter meets requirements -// -// of GoRoutineCounter +// of GoRoutineCounter var _ counter.GoRoutineCounter = (*waitGroupCounter)(nil) func (wgc *waitGroupCounter) Add(delta int) { diff --git a/staging/src/k8s.io/apiserver/pkg/util/flowcontrol/watch_tracker.go b/staging/src/k8s.io/apiserver/pkg/util/flowcontrol/watch_tracker.go index 287b100cfd8..b7b9c886bfc 100644 --- a/staging/src/k8s.io/apiserver/pkg/util/flowcontrol/watch_tracker.go +++ b/staging/src/k8s.io/apiserver/pkg/util/flowcontrol/watch_tracker.go @@ -195,9 +195,8 @@ func (w *watchTracker) forgetWatch(identifier *watchIdentifier, index *indexValu // GetInterestedWatchCount implements WatchTracker interface. // // TODO(wojtek-t): As of now, requestInfo for object creation (POST) doesn't -// -// contain the Name field set. Figure out if we can somehow get it for the -// more accurate cost estimation. +// contain the Name field set. Figure out if we can somehow get it for the +// more accurate cost estimation. // // TODO(wojtek-t): Figure out how to approach DELETECOLLECTION calls. func (w *watchTracker) GetInterestedWatchCount(requestInfo *request.RequestInfo) int { diff --git a/staging/src/k8s.io/client-go/kubernetes/typed/events/v1beta1/event_expansion.go b/staging/src/k8s.io/client-go/kubernetes/typed/events/v1beta1/event_expansion.go index 464fff91167..562f8d5e45e 100644 --- a/staging/src/k8s.io/client-go/kubernetes/typed/events/v1beta1/event_expansion.go +++ b/staging/src/k8s.io/client-go/kubernetes/typed/events/v1beta1/event_expansion.go @@ -82,8 +82,7 @@ func (e *events) UpdateWithEventNamespace(event *v1beta1.Event) (*v1beta1.Event, // It returns the copy of the event that the server returns, or an error. // The namespace and name of the target event is deduced from the event. // The namespace must either match this event client's namespace, or this event client must -// -// have been created with the "" namespace. +// have been created with the "" namespace. func (e *events) PatchWithEventNamespace(event *v1beta1.Event, data []byte) (*v1beta1.Event, error) { if e.ns != "" && event.Namespace != e.ns { return nil, fmt.Errorf("can't patch an event with namespace '%v' in namespace '%v'", event.Namespace, e.ns) diff --git a/staging/src/k8s.io/client-go/rest/client.go b/staging/src/k8s.io/client-go/rest/client.go index 2cf821bcd7a..60df7e568c3 100644 --- a/staging/src/k8s.io/client-go/rest/client.go +++ b/staging/src/k8s.io/client-go/rest/client.go @@ -52,8 +52,7 @@ type Interface interface { // ClientContentConfig controls how RESTClient communicates with the server. // // TODO: ContentConfig will be updated to accept a Negotiator instead of a -// -// NegotiatedSerializer and NegotiatedSerializer will be removed. +// NegotiatedSerializer and NegotiatedSerializer will be removed. type ClientContentConfig struct { // AcceptContentTypes specifies the types the client will accept and is optional. // If not set, ContentType will be used to define the Accept header diff --git a/staging/src/k8s.io/client-go/tools/watch/until.go b/staging/src/k8s.io/client-go/tools/watch/until.go index 81d4ff0ddff..27080c16cd2 100644 --- a/staging/src/k8s.io/client-go/tools/watch/until.go +++ b/staging/src/k8s.io/client-go/tools/watch/until.go @@ -101,8 +101,7 @@ func UntilWithoutRetry(ctx context.Context, watcher watch.Interface, conditions // It guarantees you to see all events and in the order they happened. // Due to this guarantee there is no way it can deal with 'Resource version too old error'. It will fail in this case. // (See `UntilWithSync` if you'd prefer to recover from all the errors including RV too old by re-listing -// -// those items. In normal code you should care about being level driven so you'd not care about not seeing all the edges.) +// those items. In normal code you should care about being level driven so you'd not care about not seeing all the edges.) // // The most frequent usage for Until would be a test where you want to verify exact order of events ("edges"). func Until(ctx context.Context, initialResourceVersion string, watcherClient cache.Watcher, conditions ...ConditionFunc) (*watch.Event, error) { diff --git a/staging/src/k8s.io/client-go/util/testing/fake_openapi_handler.go b/staging/src/k8s.io/client-go/util/testing/fake_openapi_handler.go index b6e4d6683b8..b957b420e1c 100644 --- a/staging/src/k8s.io/client-go/util/testing/fake_openapi_handler.go +++ b/staging/src/k8s.io/client-go/util/testing/fake_openapi_handler.go @@ -41,9 +41,9 @@ type FakeOpenAPIServer struct { // API server. // // specsPath - Give a path to some test data organized so that each GroupVersion +// has its own OpenAPI V3 JSON file. // -// has its own OpenAPI V3 JSON file. -// i.e. apps/v1beta1 is stored in /apps/v1beta1.json +// i.e. apps/v1beta1 is stored in /apps/v1beta1.json func NewFakeOpenAPIV3Server(specsPath string) (*FakeOpenAPIServer, error) { mux := &testMux{ counts: map[string]int{}, diff --git a/staging/src/k8s.io/cloud-provider/app/testing/testserver.go b/staging/src/k8s.io/cloud-provider/app/testing/testserver.go index a0a86150886..734322afdfe 100644 --- a/staging/src/k8s.io/cloud-provider/app/testing/testserver.go +++ b/staging/src/k8s.io/cloud-provider/app/testing/testserver.go @@ -60,9 +60,8 @@ type Logger interface { // and location of the tmpdir are returned. // // Note: we return a tear-down func instead of a stop channel because the later will leak temporary -// -// files that because Golang testing's call to os.Exit will not give a stop channel go routine -// enough time to remove temporary files. +// files that because Golang testing's call to os.Exit will not give a stop channel go routine +// enough time to remove temporary files. func StartTestServer(t Logger, customFlags []string) (result TestServer, err error) { stopCh := make(chan struct{}) var errCh chan error diff --git a/staging/src/k8s.io/code-generator/cmd/go-to-protobuf/protobuf/parser.go b/staging/src/k8s.io/code-generator/cmd/go-to-protobuf/protobuf/parser.go index 1d27f958068..c4cf66e7447 100644 --- a/staging/src/k8s.io/code-generator/cmd/go-to-protobuf/protobuf/parser.go +++ b/staging/src/k8s.io/code-generator/cmd/go-to-protobuf/protobuf/parser.go @@ -109,8 +109,7 @@ func RewriteGeneratedGogoProtobufFile(name string, extractFn ExtractFunc, option // as being "optional" (they may be nil on the wire). This allows protobuf to serialize a map or slice and // properly discriminate between empty and nil (which is not possible in protobuf). // TODO: move into upstream gogo-protobuf once https://github.com/gogo/protobuf/issues/181 -// -// has agreement +// has agreement func rewriteOptionalMethods(decl ast.Decl, isOptional OptionalFunc) { switch t := decl.(type) { case *ast.FuncDecl: diff --git a/staging/src/k8s.io/component-base/metrics/metric.go b/staging/src/k8s.io/component-base/metrics/metric.go index cf5bccfa7b9..b3d0dd264f5 100644 --- a/staging/src/k8s.io/component-base/metrics/metric.go +++ b/staging/src/k8s.io/component-base/metrics/metric.go @@ -97,9 +97,8 @@ func (r *lazyMetric) lazyInit(self kubeCollector, fqName string) { // 2. if the metric is manually disabled via a CLI flag. // // Disclaimer: disabling a metric via a CLI flag has higher precedence than -// -// deprecation and will override show-hidden-metrics for the explicitly -// disabled metric. +// deprecation and will override show-hidden-metrics for the explicitly +// disabled metric. func (r *lazyMetric) preprocessMetric(version semver.Version) { disabledMetricsLock.RLock() defer disabledMetricsLock.RUnlock() diff --git a/staging/src/k8s.io/component-base/metrics/value.go b/staging/src/k8s.io/component-base/metrics/value.go index b525bb602ac..4a405048cf8 100644 --- a/staging/src/k8s.io/component-base/metrics/value.go +++ b/staging/src/k8s.io/component-base/metrics/value.go @@ -60,8 +60,7 @@ func NewConstMetric(desc *Desc, valueType ValueType, value float64, labelValues // NewLazyMetricWithTimestamp is a helper of NewMetricWithTimestamp. // // Warning: the Metric 'm' must be the one created by NewLazyConstMetric(), -// -// otherwise, no stability guarantees would be offered. +// otherwise, no stability guarantees would be offered. func NewLazyMetricWithTimestamp(t time.Time, m Metric) Metric { if m == nil { return nil diff --git a/staging/src/k8s.io/controller-manager/pkg/leadermigration/config/default.go b/staging/src/k8s.io/controller-manager/pkg/leadermigration/config/default.go index de8a2c9e0e5..362893b4071 100644 --- a/staging/src/k8s.io/controller-manager/pkg/leadermigration/config/default.go +++ b/staging/src/k8s.io/controller-manager/pkg/leadermigration/config/default.go @@ -19,8 +19,7 @@ package config import internal "k8s.io/controller-manager/config" // DefaultLeaderMigrationConfiguration returns the default LeaderMigrationConfiguration -// -// that is valid for this release of Kubernetes. +// that is valid for this release of Kubernetes. func DefaultLeaderMigrationConfiguration() *internal.LeaderMigrationConfiguration { return &internal.LeaderMigrationConfiguration{ LeaderName: "cloud-provider-extraction-migration", diff --git a/staging/src/k8s.io/controller-manager/pkg/leadermigration/migrator.go b/staging/src/k8s.io/controller-manager/pkg/leadermigration/migrator.go index fdd74a46ab0..4fa5766a8e2 100644 --- a/staging/src/k8s.io/controller-manager/pkg/leadermigration/migrator.go +++ b/staging/src/k8s.io/controller-manager/pkg/leadermigration/migrator.go @@ -31,9 +31,8 @@ type LeaderMigrator struct { } // NewLeaderMigrator creates a LeaderMigrator with given config for the given component. component -// -// indicates which controller manager is requesting this leader migration, and it should be consistent -// with the component field of ControllerLeaderConfiguration. +// indicates which controller manager is requesting this leader migration, and it should be consistent +// with the component field of ControllerLeaderConfiguration. func NewLeaderMigrator(config *internal.LeaderMigrationConfiguration, component string) *LeaderMigrator { migratedControllers := make(map[string]bool) for _, leader := range config.ControllerLeaders { diff --git a/staging/src/k8s.io/legacy-cloud-providers/aws/aws.go b/staging/src/k8s.io/legacy-cloud-providers/aws/aws.go index 5b9cfeea86d..2c18d56b4ac 100644 --- a/staging/src/k8s.io/legacy-cloud-providers/aws/aws.go +++ b/staging/src/k8s.io/legacy-cloud-providers/aws/aws.go @@ -175,8 +175,7 @@ const ServiceAnnotationLoadBalancerSSLNegotiationPolicy = "service.beta.kubernet // ServiceAnnotationLoadBalancerBEProtocol is the annotation used on the service // to specify the protocol spoken by the backend (pod) behind a listener. // If `http` (default) or `https`, an HTTPS listener that terminates the -// -// connection and parses headers is created. +// connection and parses headers is created. // // If set to `ssl` or `tcp`, a "raw" SSL listener is used. // If set to `http` and `aws-load-balancer-ssl-cert` is not used then diff --git a/staging/src/k8s.io/legacy-cloud-providers/aws/aws_loadbalancer.go b/staging/src/k8s.io/legacy-cloud-providers/aws/aws_loadbalancer.go index 79b9ef1a85d..3f05aed7f40 100644 --- a/staging/src/k8s.io/legacy-cloud-providers/aws/aws_loadbalancer.go +++ b/staging/src/k8s.io/legacy-cloud-providers/aws/aws_loadbalancer.go @@ -1244,8 +1244,7 @@ func (c *Cloud) ensureLoadBalancer(namespacedName types.NamespacedName, loadBala // syncElbListeners computes a plan to reconcile the desired vs actual state of the listeners on an ELB // NOTE: there exists an O(nlgn) implementation for this function. However, as the default limit of -// -// listeners per elb is 100, this implementation is reduced from O(m*n) => O(n). +// listeners per elb is 100, this implementation is reduced from O(m*n) => O(n). func syncElbListeners(loadBalancerName string, listeners []*elb.Listener, listenerDescriptions []*elb.ListenerDescription) ([]*elb.Listener, []*int64) { foundSet := make(map[int]bool) removals := []*int64{}