diff --git a/cmd/cloud-controller-manager/app/options/options.go b/cmd/cloud-controller-manager/app/options/options.go index 129999c16f..6150ff399b 100644 --- a/cmd/cloud-controller-manager/app/options/options.go +++ b/cmd/cloud-controller-manager/app/options/options.go @@ -52,7 +52,6 @@ func NewCloudControllerManagerOptions() *CloudControllerManagerOptions { Generic: cmoptions.NewGenericControllerManagerOptions(componentConfig), NodeStatusUpdateFrequency: metav1.Duration{Duration: 5 * time.Minute}, } - s.Generic.ComponentConfig.LeaderElection.LeaderElect = true s.Generic.SecureServing.ServerCert.CertDirectory = "/var/run/kubernetes" s.Generic.SecureServing.ServerCert.PairName = "cloud-controller-manager" diff --git a/cmd/cloud-controller-manager/app/options/options_test.go b/cmd/cloud-controller-manager/app/options/options_test.go index e876f72503..e065fb1745 100644 --- a/cmd/cloud-controller-manager/app/options/options_test.go +++ b/cmd/cloud-controller-manager/app/options/options_test.go @@ -31,6 +31,106 @@ import ( "k8s.io/kubernetes/pkg/apis/componentconfig" ) +func TestDefaultFlags(t *testing.T) { + s := NewCloudControllerManagerOptions() + + expected := &CloudControllerManagerOptions{ + Generic: cmoptions.GenericControllerManagerOptions{ + ComponentConfig: componentconfig.KubeControllerManagerConfiguration{ + CloudProvider: "", + CloudConfigFile: "", + Port: 10253, // Note: InsecureServingOptions.ApplyTo will write the flag value back into the component config + Address: "0.0.0.0", // Note: InsecureServingOptions.ApplyTo will write the flag value back into the component config + ConcurrentEndpointSyncs: 5, + ConcurrentRSSyncs: 5, + ConcurrentResourceQuotaSyncs: 5, + ConcurrentDeploymentSyncs: 5, + ConcurrentDaemonSetSyncs: 2, + ConcurrentJobSyncs: 5, + ConcurrentNamespaceSyncs: 10, + ConcurrentSATokenSyncs: 5, + ConcurrentServiceSyncs: 1, + ConcurrentGCSyncs: 20, + ConcurrentRCSyncs: 5, + MinResyncPeriod: metav1.Duration{Duration: 12 * time.Hour}, + NodeMonitorPeriod: metav1.Duration{Duration: 5 * time.Second}, + ResourceQuotaSyncPeriod: metav1.Duration{Duration: 5 * time.Minute}, + NamespaceSyncPeriod: metav1.Duration{Duration: 5 * time.Minute}, + PVClaimBinderSyncPeriod: metav1.Duration{Duration: 15 * time.Second}, + HorizontalPodAutoscalerSyncPeriod: metav1.Duration{Duration: 30 * time.Second}, + HorizontalPodAutoscalerUpscaleForbiddenWindow: metav1.Duration{Duration: 3 * time.Minute}, + HorizontalPodAutoscalerDownscaleForbiddenWindow: metav1.Duration{Duration: 5 * time.Minute}, + HorizontalPodAutoscalerTolerance: 0.1, + DeploymentControllerSyncPeriod: metav1.Duration{Duration: 30 * time.Second}, + PodEvictionTimeout: metav1.Duration{Duration: 5 * time.Minute}, + NodeMonitorGracePeriod: metav1.Duration{Duration: 40 * time.Second}, + NodeStartupGracePeriod: metav1.Duration{Duration: 1 * time.Minute}, + ClusterSigningDuration: metav1.Duration{Duration: 8760 * time.Hour}, + ReconcilerSyncLoopPeriod: metav1.Duration{Duration: 1 * time.Minute}, + TerminatedPodGCThreshold: 12500, + RegisterRetryCount: 10, + ClusterName: "kubernetes", + ConfigureCloudRoutes: true, + AllocateNodeCIDRs: false, + EnableGarbageCollector: true, + EnableTaintManager: true, + HorizontalPodAutoscalerUseRESTClients: true, + VolumeConfiguration: componentconfig.VolumeConfiguration{ + EnableDynamicProvisioning: true, + EnableHostPathProvisioning: false, + FlexVolumePluginDir: "/usr/libexec/kubernetes/kubelet-plugins/volume/exec/", + PersistentVolumeRecyclerConfiguration: componentconfig.PersistentVolumeRecyclerConfiguration{ + MaximumRetry: 3, + MinimumTimeoutNFS: 300, + IncrementTimeoutNFS: 30, + MinimumTimeoutHostPath: 60, + IncrementTimeoutHostPath: 30, + }, + }, + ContentType: "application/vnd.kubernetes.protobuf", + ClusterSigningCertFile: "/etc/kubernetes/ca/ca.pem", + ClusterSigningKeyFile: "/etc/kubernetes/ca/ca.key", + EnableContentionProfiling: false, + KubeAPIQPS: 20.0, + KubeAPIBurst: 30, + LeaderElection: componentconfig.LeaderElectionConfiguration{ + ResourceLock: "endpoints", + LeaderElect: true, + LeaseDuration: metav1.Duration{Duration: 15 * time.Second}, + RenewDeadline: metav1.Duration{Duration: 10 * time.Second}, + RetryPeriod: metav1.Duration{Duration: 2 * time.Second}, + }, + ControllerStartInterval: metav1.Duration{Duration: 0}, + RouteReconciliationPeriod: metav1.Duration{Duration: 10 * time.Second}, + ClusterCIDR: "", + NodeCIDRMaskSize: 24, + CIDRAllocatorType: "", + Controllers: []string{"*"}, + }, + SecureServing: &apiserveroptions.SecureServingOptions{ + BindPort: 0, + BindAddress: net.ParseIP("0.0.0.0"), + ServerCert: apiserveroptions.GeneratableKeyCert{ + CertDirectory: "/var/run/kubernetes", + PairName: "cloud-controller-manager", + }, + HTTP2MaxStreamsPerConnection: 0, + }, + InsecureServing: &cmoptions.InsecureServingOptions{ + BindAddress: net.ParseIP("0.0.0.0"), + BindPort: int(10253), + BindNetwork: "tcp", + }, + Kubeconfig: "", + Master: "", + }, + NodeStatusUpdateFrequency: metav1.Duration{Duration: 5 * time.Minute}, + } + if !reflect.DeepEqual(expected, s) { + t.Errorf("Got different run options than expected.\nDifference detected on:\n%s", diff.ObjectReflectDiff(expected, s)) + } +} + func TestAddFlags(t *testing.T) { f := pflag.NewFlagSet("addflagstest", pflag.ContinueOnError) s := NewCloudControllerManagerOptions() diff --git a/cmd/controller-manager/app/options/BUILD b/cmd/controller-manager/app/options/BUILD index b449fb9c29..fa8029464a 100644 --- a/cmd/controller-manager/app/options/BUILD +++ b/cmd/controller-manager/app/options/BUILD @@ -12,12 +12,11 @@ go_library( "//cmd/controller-manager/app:go_default_library", "//pkg/api/legacyscheme:go_default_library", "//pkg/apis/componentconfig:go_default_library", - "//pkg/client/leaderelectionconfig:go_default_library", - "//vendor/github.com/cloudflare/cfssl/helpers:go_default_library", + "//pkg/apis/componentconfig/v1alpha1:go_default_library", "//vendor/github.com/golang/glog:go_default_library", "//vendor/github.com/spf13/pflag:go_default_library", "//vendor/k8s.io/api/core/v1:go_default_library", - "//vendor/k8s.io/apimachinery/pkg/apis/meta/v1:go_default_library", + "//vendor/k8s.io/apimachinery/pkg/runtime:go_default_library", "//vendor/k8s.io/apiserver/pkg/server/options:go_default_library", "//vendor/k8s.io/client-go/kubernetes:go_default_library", "//vendor/k8s.io/client-go/kubernetes/typed/core/v1:go_default_library", diff --git a/cmd/controller-manager/app/options/options.go b/cmd/controller-manager/app/options/options.go index 8f468f4d1c..4c5db236a2 100644 --- a/cmd/controller-manager/app/options/options.go +++ b/cmd/controller-manager/app/options/options.go @@ -18,14 +18,12 @@ package options import ( "net" - "time" - "github.com/cloudflare/cfssl/helpers" "github.com/golang/glog" "github.com/spf13/pflag" "k8s.io/api/core/v1" - metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + "k8s.io/apimachinery/pkg/runtime" apiserveroptions "k8s.io/apiserver/pkg/server/options" "k8s.io/client-go/kubernetes" clientset "k8s.io/client-go/kubernetes" @@ -36,7 +34,7 @@ import ( genericcontrollermanager "k8s.io/kubernetes/cmd/controller-manager/app" "k8s.io/kubernetes/pkg/api/legacyscheme" "k8s.io/kubernetes/pkg/apis/componentconfig" - "k8s.io/kubernetes/pkg/client/leaderelectionconfig" + componentconfigv1alpha1 "k8s.io/kubernetes/pkg/apis/componentconfig/v1alpha1" ) // GenericControllerManagerOptions is the common structure for a controller manager. It works with NewGenericControllerManagerOptions @@ -90,65 +88,14 @@ func NewGenericControllerManagerOptions(componentConfig componentconfig.KubeCont // NewDefaultControllerManagerComponentConfig returns default kube-controller manager configuration object. func NewDefaultControllerManagerComponentConfig(insecurePort int32) componentconfig.KubeControllerManagerConfiguration { - return componentconfig.KubeControllerManagerConfiguration{ - Controllers: []string{"*"}, - Port: insecurePort, - Address: "0.0.0.0", - ConcurrentEndpointSyncs: 5, - ConcurrentServiceSyncs: 1, - ConcurrentRCSyncs: 5, - ConcurrentRSSyncs: 5, - ConcurrentDaemonSetSyncs: 2, - ConcurrentJobSyncs: 5, - ConcurrentResourceQuotaSyncs: 5, - ConcurrentDeploymentSyncs: 5, - ConcurrentNamespaceSyncs: 10, - ConcurrentSATokenSyncs: 5, - RouteReconciliationPeriod: metav1.Duration{Duration: 10 * time.Second}, - ResourceQuotaSyncPeriod: metav1.Duration{Duration: 5 * time.Minute}, - NamespaceSyncPeriod: metav1.Duration{Duration: 5 * time.Minute}, - PVClaimBinderSyncPeriod: metav1.Duration{Duration: 15 * time.Second}, - HorizontalPodAutoscalerSyncPeriod: metav1.Duration{Duration: 30 * time.Second}, - HorizontalPodAutoscalerUpscaleForbiddenWindow: metav1.Duration{Duration: 3 * time.Minute}, - HorizontalPodAutoscalerDownscaleForbiddenWindow: metav1.Duration{Duration: 5 * time.Minute}, - HorizontalPodAutoscalerTolerance: 0.1, - DeploymentControllerSyncPeriod: metav1.Duration{Duration: 30 * time.Second}, - MinResyncPeriod: metav1.Duration{Duration: 12 * time.Hour}, - RegisterRetryCount: 10, - PodEvictionTimeout: metav1.Duration{Duration: 5 * time.Minute}, - NodeMonitorGracePeriod: metav1.Duration{Duration: 40 * time.Second}, - NodeStartupGracePeriod: metav1.Duration{Duration: 60 * time.Second}, - NodeMonitorPeriod: metav1.Duration{Duration: 5 * time.Second}, - ClusterName: "kubernetes", - NodeCIDRMaskSize: 24, - ConfigureCloudRoutes: true, - TerminatedPodGCThreshold: 12500, - VolumeConfiguration: componentconfig.VolumeConfiguration{ - EnableHostPathProvisioning: false, - EnableDynamicProvisioning: true, - PersistentVolumeRecyclerConfiguration: componentconfig.PersistentVolumeRecyclerConfiguration{ - MaximumRetry: 3, - MinimumTimeoutNFS: 300, - IncrementTimeoutNFS: 30, - MinimumTimeoutHostPath: 60, - IncrementTimeoutHostPath: 30, - }, - FlexVolumePluginDir: "/usr/libexec/kubernetes/kubelet-plugins/volume/exec/", - }, - ContentType: "application/vnd.kubernetes.protobuf", - KubeAPIQPS: 20.0, - KubeAPIBurst: 30, - LeaderElection: leaderelectionconfig.DefaultLeaderElectionConfiguration(), - ControllerStartInterval: metav1.Duration{Duration: 0 * time.Second}, - EnableGarbageCollector: true, - ConcurrentGCSyncs: 20, - ClusterSigningCertFile: DefaultClusterSigningCertFile, - ClusterSigningKeyFile: DefaultClusterSigningKeyFile, - ClusterSigningDuration: metav1.Duration{Duration: helpers.OneYear}, - ReconcilerSyncLoopPeriod: metav1.Duration{Duration: 60 * time.Second}, - EnableTaintManager: true, - HorizontalPodAutoscalerUseRESTClients: true, - } + scheme := runtime.NewScheme() + componentconfigv1alpha1.AddToScheme(scheme) + versioned := componentconfigv1alpha1.KubeControllerManagerConfiguration{} + scheme.Default(&versioned) + internal := componentconfig.KubeControllerManagerConfiguration{} + scheme.Convert(&versioned, &internal, nil) + internal.Port = insecurePort + return internal } // AddFlags adds common/default flags for both the kube and cloud Controller Manager Server to the diff --git a/cmd/kube-controller-manager/app/options/options.go b/cmd/kube-controller-manager/app/options/options.go index f9adc670c6..642db51efe 100644 --- a/cmd/kube-controller-manager/app/options/options.go +++ b/cmd/kube-controller-manager/app/options/options.go @@ -60,7 +60,6 @@ func NewKubeControllerManagerOptions() *KubeControllerManagerOptions { gcIgnoredResources = append(gcIgnoredResources, componentconfig.GroupResource{Group: r.Group, Resource: r.Resource}) } s.Generic.ComponentConfig.GCIgnoredResources = gcIgnoredResources - s.Generic.ComponentConfig.LeaderElection.LeaderElect = true return &s } diff --git a/cmd/kube-scheduler/app/server.go b/cmd/kube-scheduler/app/server.go index e60c294a54..618ca9c5e1 100644 --- a/cmd/kube-scheduler/app/server.go +++ b/cmd/kube-scheduler/app/server.go @@ -152,8 +152,14 @@ func NewOptions() (*Options, error) { return nil, err } - // TODO: we should fix this up better (PR 59732) - o.config.LeaderElection.LeaderElect = true + externalConfig := &componentconfigv1alpha1.KubeSchedulerConfiguration{} + // Assume we are starting with an empty external configuration, we apply + // defaults and then convert it into an internal data structure. This helps + // ensure that all the defaults are applied correctly (example LeaderElect) + o.scheme.Default(externalConfig) + if err := o.scheme.Convert(externalConfig, o.config, nil); err != nil { + return nil, err + } return o, nil } diff --git a/pkg/apis/componentconfig/types.go b/pkg/apis/componentconfig/types.go index 89671f046a..8a3c952f0b 100644 --- a/pkg/apis/componentconfig/types.go +++ b/pkg/apis/componentconfig/types.go @@ -117,6 +117,7 @@ type KubeSchedulerConfiguration struct { // to include scheduler specific configuration. type KubeSchedulerLeaderElectionConfiguration struct { LeaderElectionConfiguration + // LockObjectNamespace defines the namespace of the lock object LockObjectNamespace string // LockObjectName defines the lock object name diff --git a/pkg/apis/componentconfig/v1alpha1/BUILD b/pkg/apis/componentconfig/v1alpha1/BUILD index e89709d1ee..e4ba555892 100644 --- a/pkg/apis/componentconfig/v1alpha1/BUILD +++ b/pkg/apis/componentconfig/v1alpha1/BUILD @@ -23,6 +23,7 @@ go_library( "//pkg/apis/core:go_default_library", "//pkg/kubelet/apis:go_default_library", "//pkg/master/ports:go_default_library", + "//pkg/util/pointer:go_default_library", "//vendor/k8s.io/apimachinery/pkg/apis/meta/v1:go_default_library", "//vendor/k8s.io/apimachinery/pkg/conversion:go_default_library", "//vendor/k8s.io/apimachinery/pkg/runtime:go_default_library", diff --git a/pkg/apis/componentconfig/v1alpha1/defaults.go b/pkg/apis/componentconfig/v1alpha1/defaults.go index 0528b6cb6d..b3355bac7b 100644 --- a/pkg/apis/componentconfig/v1alpha1/defaults.go +++ b/pkg/apis/componentconfig/v1alpha1/defaults.go @@ -26,12 +26,177 @@ import ( api "k8s.io/kubernetes/pkg/apis/core" kubeletapis "k8s.io/kubernetes/pkg/kubelet/apis" "k8s.io/kubernetes/pkg/master/ports" + utilpointer "k8s.io/kubernetes/pkg/util/pointer" ) func addDefaultingFuncs(scheme *kruntime.Scheme) error { return RegisterDefaults(scheme) } +func SetDefaults_KubeControllerManagerConfiguration(obj *KubeControllerManagerConfiguration) { + zero := metav1.Duration{} + if len(obj.Controllers) == 0 { + obj.Controllers = []string{"*"} + } + // Port + if obj.Address == "" { + obj.Address = "0.0.0.0" + } + if obj.ConcurrentEndpointSyncs == 0 { + obj.ConcurrentEndpointSyncs = 5 + } + if obj.ConcurrentServiceSyncs == 0 { + obj.ConcurrentServiceSyncs = 1 + } + if obj.ConcurrentRCSyncs == 0 { + obj.ConcurrentRCSyncs = 5 + } + if obj.ConcurrentRSSyncs == 0 { + obj.ConcurrentRSSyncs = 5 + } + if obj.ConcurrentDaemonSetSyncs == 0 { + obj.ConcurrentDaemonSetSyncs = 2 + } + if obj.ConcurrentJobSyncs == 0 { + obj.ConcurrentJobSyncs = 5 + } + if obj.ConcurrentResourceQuotaSyncs == 0 { + obj.ConcurrentResourceQuotaSyncs = 5 + } + if obj.ConcurrentDeploymentSyncs == 0 { + obj.ConcurrentDeploymentSyncs = 5 + } + if obj.ConcurrentNamespaceSyncs == 0 { + obj.ConcurrentNamespaceSyncs = 10 + } + if obj.ConcurrentSATokenSyncs == 0 { + obj.ConcurrentSATokenSyncs = 5 + } + if obj.RouteReconciliationPeriod == zero { + obj.RouteReconciliationPeriod = metav1.Duration{Duration: 10 * time.Second} + } + if obj.ResourceQuotaSyncPeriod == zero { + obj.ResourceQuotaSyncPeriod = metav1.Duration{Duration: 5 * time.Minute} + } + if obj.NamespaceSyncPeriod == zero { + obj.NamespaceSyncPeriod = metav1.Duration{Duration: 5 * time.Minute} + } + if obj.PVClaimBinderSyncPeriod == zero { + obj.PVClaimBinderSyncPeriod = metav1.Duration{Duration: 15 * time.Second} + } + if obj.HorizontalPodAutoscalerSyncPeriod == zero { + obj.HorizontalPodAutoscalerSyncPeriod = metav1.Duration{Duration: 30 * time.Second} + } + if obj.HorizontalPodAutoscalerUpscaleForbiddenWindow == zero { + obj.HorizontalPodAutoscalerUpscaleForbiddenWindow = metav1.Duration{Duration: 3 * time.Minute} + } + if obj.HorizontalPodAutoscalerDownscaleForbiddenWindow == zero { + obj.HorizontalPodAutoscalerDownscaleForbiddenWindow = metav1.Duration{Duration: 5 * time.Minute} + } + if obj.HorizontalPodAutoscalerTolerance == 0 { + obj.HorizontalPodAutoscalerTolerance = 0.1 + } + if obj.DeploymentControllerSyncPeriod == zero { + obj.DeploymentControllerSyncPeriod = metav1.Duration{Duration: 30 * time.Second} + } + if obj.MinResyncPeriod == zero { + obj.MinResyncPeriod = metav1.Duration{Duration: 12 * time.Hour} + } + if obj.RegisterRetryCount == 0 { + obj.RegisterRetryCount = 10 + } + if obj.PodEvictionTimeout == zero { + obj.PodEvictionTimeout = metav1.Duration{Duration: 5 * time.Minute} + } + if obj.NodeMonitorGracePeriod == zero { + obj.NodeMonitorGracePeriod = metav1.Duration{Duration: 40 * time.Second} + } + if obj.NodeStartupGracePeriod == zero { + obj.NodeStartupGracePeriod = metav1.Duration{Duration: 60 * time.Second} + } + if obj.NodeMonitorPeriod == zero { + obj.NodeMonitorPeriod = metav1.Duration{Duration: 5 * time.Second} + } + if obj.ClusterName == "" { + obj.ClusterName = "kubernetes" + } + if obj.NodeCIDRMaskSize == 0 { + obj.NodeCIDRMaskSize = 24 + } + if obj.ConfigureCloudRoutes == nil { + obj.ConfigureCloudRoutes = utilpointer.BoolPtr(true) + } + if obj.TerminatedPodGCThreshold == 0 { + obj.TerminatedPodGCThreshold = 12500 + } + if obj.ContentType == "" { + obj.ContentType = "application/vnd.kubernetes.protobuf" + } + if obj.KubeAPIQPS == 0 { + obj.KubeAPIQPS = 20.0 + } + if obj.KubeAPIBurst == 0 { + obj.KubeAPIBurst = 30 + } + if obj.ControllerStartInterval == zero { + obj.ControllerStartInterval = metav1.Duration{Duration: 0 * time.Second} + } + if obj.EnableGarbageCollector == nil { + obj.EnableGarbageCollector = utilpointer.BoolPtr(true) + } + if obj.ConcurrentGCSyncs == 0 { + obj.ConcurrentGCSyncs = 20 + } + if obj.ClusterSigningCertFile == "" { + obj.ClusterSigningCertFile = "/etc/kubernetes/ca/ca.pem" + } + if obj.ClusterSigningKeyFile == "" { + obj.ClusterSigningKeyFile = "/etc/kubernetes/ca/ca.key" + } + if obj.ClusterSigningDuration == zero { + obj.ClusterSigningDuration = metav1.Duration{Duration: 365 * 24 * time.Hour} + } + if obj.ReconcilerSyncLoopPeriod == zero { + obj.ReconcilerSyncLoopPeriod = metav1.Duration{Duration: 60 * time.Second} + } + if obj.EnableTaintManager == nil { + obj.EnableTaintManager = utilpointer.BoolPtr(true) + } + if obj.HorizontalPodAutoscalerUseRESTClients == nil { + obj.HorizontalPodAutoscalerUseRESTClients = utilpointer.BoolPtr(true) + } +} + +func SetDefaults_PersistentVolumeRecyclerConfiguration(obj *PersistentVolumeRecyclerConfiguration) { + if obj.MaximumRetry == 0 { + obj.MaximumRetry = 3 + } + if obj.MinimumTimeoutNFS == 0 { + obj.MinimumTimeoutNFS = 300 + } + if obj.IncrementTimeoutNFS == 0 { + obj.IncrementTimeoutNFS = 30 + } + if obj.MinimumTimeoutHostPath == 0 { + obj.MinimumTimeoutHostPath = 60 + } + if obj.IncrementTimeoutHostPath == 0 { + obj.IncrementTimeoutHostPath = 30 + } +} + +func SetDefaults_VolumeConfiguration(obj *VolumeConfiguration) { + if obj.EnableHostPathProvisioning == nil { + obj.EnableHostPathProvisioning = utilpointer.BoolPtr(false) + } + if obj.EnableDynamicProvisioning == nil { + obj.EnableDynamicProvisioning = utilpointer.BoolPtr(true) + } + if obj.FlexVolumePluginDir == "" { + obj.FlexVolumePluginDir = "/usr/libexec/kubernetes/kubelet-plugins/volume/exec/" + } +} + func SetDefaults_KubeSchedulerConfiguration(obj *KubeSchedulerConfiguration) { if len(obj.SchedulerName) == 0 { obj.SchedulerName = api.DefaultSchedulerName @@ -108,4 +273,7 @@ func SetDefaults_LeaderElectionConfiguration(obj *LeaderElectionConfiguration) { // obj.ResourceLock = rl.EndpointsResourceLock obj.ResourceLock = "endpoints" } + if obj.LeaderElect == nil { + obj.LeaderElect = utilpointer.BoolPtr(true) + } } diff --git a/pkg/apis/componentconfig/v1alpha1/defaults_test.go b/pkg/apis/componentconfig/v1alpha1/defaults_test.go index 14ae4bc00b..77bd8931ea 100644 --- a/pkg/apis/componentconfig/v1alpha1/defaults_test.go +++ b/pkg/apis/componentconfig/v1alpha1/defaults_test.go @@ -41,3 +41,21 @@ func TestSchedulerDefaults(t *testing.T) { t.Errorf("Expected:\n%#v\n\nGot:\n%#v", ks1, ks2) } } + +func TestControllerDefaultsRoundTrip(t *testing.T) { + ks1 := &KubeControllerManagerConfiguration{} + SetDefaults_KubeControllerManagerConfiguration(ks1) + cm, err := componentconfig.ConvertObjToConfigMap("KubeControllerManagerConfiguration", ks1) + if err != nil { + t.Errorf("unexpected ConvertObjToConfigMap error %v", err) + } + + ks2 := &KubeControllerManagerConfiguration{} + if err = json.Unmarshal([]byte(cm.Data["KubeControllerManagerConfiguration"]), ks2); err != nil { + t.Errorf("unexpected error unserializing controller manager config %v", err) + } + + if !reflect.DeepEqual(ks2, ks1) { + t.Errorf("Expected:\n%#v\n\nGot:\n%#v", ks1, ks2) + } +} diff --git a/pkg/apis/componentconfig/v1alpha1/types.go b/pkg/apis/componentconfig/v1alpha1/types.go index 55e99fb429..e694f193b2 100644 --- a/pkg/apis/componentconfig/v1alpha1/types.go +++ b/pkg/apis/componentconfig/v1alpha1/types.go @@ -146,6 +146,265 @@ type KubeSchedulerLeaderElectionConfiguration struct { LockObjectName string `json:"lockObjectName"` } +type PersistentVolumeRecyclerConfiguration struct { + // maximumRetry is number of retries the PV recycler will execute on failure to recycle + // PV. + MaximumRetry int32 `json:"maximumRetry"` + // minimumTimeoutNFS is the minimum ActiveDeadlineSeconds to use for an NFS Recycler + // pod. + MinimumTimeoutNFS int32 `json:"minimumTimeoutNFS"` + // podTemplateFilePathNFS is the file path to a pod definition used as a template for + // NFS persistent volume recycling + PodTemplateFilePathNFS string `json:"podTemplateFilePathNFS"` + // incrementTimeoutNFS is the increment of time added per Gi to ActiveDeadlineSeconds + // for an NFS scrubber pod. + IncrementTimeoutNFS int32 `json:"incrementTimeoutNFS"` + // podTemplateFilePathHostPath is the file path to a pod definition used as a template for + // HostPath persistent volume recycling. This is for development and testing only and + // will not work in a multi-node cluster. + PodTemplateFilePathHostPath string `json:"podTemplateFilePathHostPath"` + // minimumTimeoutHostPath is the minimum ActiveDeadlineSeconds to use for a HostPath + // Recycler pod. This is for development and testing only and will not work in a multi-node + // cluster. + MinimumTimeoutHostPath int32 `json:"minimumTimeoutHostPath"` + // incrementTimeoutHostPath is the increment of time added per Gi to ActiveDeadlineSeconds + // for a HostPath scrubber pod. This is for development and testing only and will not work + // in a multi-node cluster. + IncrementTimeoutHostPath int32 `json:"incrementTimeoutHostPath"` +} + +// VolumeConfiguration contains *all* enumerated flags meant to configure all volume +// plugins. From this config, the controller-manager binary will create many instances of +// volume.VolumeConfig, each containing only the configuration needed for that plugin which +// are then passed to the appropriate plugin. The ControllerManager binary is the only part +// of the code which knows what plugins are supported and which flags correspond to each plugin. +type VolumeConfiguration struct { + // enableHostPathProvisioning enables HostPath PV provisioning when running without a + // cloud provider. This allows testing and development of provisioning features. HostPath + // provisioning is not supported in any way, won't work in a multi-node cluster, and + // should not be used for anything other than testing or development. + EnableHostPathProvisioning *bool `json:"enableHostPathProvisioning"` + // enableDynamicProvisioning enables the provisioning of volumes when running within an environment + // that supports dynamic provisioning. Defaults to true. + EnableDynamicProvisioning *bool `json:"enableDynamicProvisioning"` + // persistentVolumeRecyclerConfiguration holds configuration for persistent volume plugins. + PersistentVolumeRecyclerConfiguration PersistentVolumeRecyclerConfiguration `json:"persistentVolumeRecyclerConfiguration"` + // volumePluginDir is the full path of the directory in which the flex + // volume plugin should search for additional third party volume plugins + FlexVolumePluginDir string `json:"flexVolumePluginDir"` +} + +type GroupResource struct { + // group is the group portion of the GroupResource. + Group string `json:"group"` + // resource is the resource portion of the GroupResource. + Resource string `json:"resource"` +} + +// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object + +type KubeControllerManagerConfiguration struct { + metav1.TypeMeta `json:",inline"` + + // Controllers is the list of controllers to enable or disable + // '*' means "all enabled by default controllers" + // 'foo' means "enable 'foo'" + // '-foo' means "disable 'foo'" + // first item for a particular name wins + Controllers []string `json:"controllers"` + + // port is the port that the controller-manager's http service runs on. + Port int32 `json:"port"` + // address is the IP address to serve on (set to 0.0.0.0 for all interfaces). + Address string `json:"address"` + // useServiceAccountCredentials indicates whether controllers should be run with + // individual service account credentials. + UseServiceAccountCredentials bool `json:"useServiceAccountCredentials"` + // cloudProvider is the provider for cloud services. + CloudProvider string `json:"cloudProvider"` + // cloudConfigFile is the path to the cloud provider configuration file. + CloudConfigFile string `json:"cloudConfigFile"` + // externalCloudVolumePlugin specifies the plugin to use when cloudProvider is "external". + // It is currently used by the in repo cloud providers to handle node and volume control in the KCM. + ExternalCloudVolumePlugin string `json:"externalCloudVolumePlugin"` + // run with untagged cloud instances + AllowUntaggedCloud bool `json:"allowUntaggedCloud"` + // concurrentEndpointSyncs is the number of endpoint syncing operations + // that will be done concurrently. Larger number = faster endpoint updating, + // but more CPU (and network) load. + ConcurrentEndpointSyncs int32 `json:"concurrentEndpointSyncs"` + // concurrentRSSyncs is the number of replica sets that are allowed to sync + // concurrently. Larger number = more responsive replica management, but more + // CPU (and network) load. + ConcurrentRSSyncs int32 `json:"concurrentRSSyncs"` + // concurrentRCSyncs is the number of replication controllers that are + // allowed to sync concurrently. Larger number = more responsive replica + // management, but more CPU (and network) load. + ConcurrentRCSyncs int32 `json:"concurrentRCSyncs"` + // concurrentServiceSyncs is the number of services that are + // allowed to sync concurrently. Larger number = more responsive service + // management, but more CPU (and network) load. + ConcurrentServiceSyncs int32 `json:"concurrentServiceSyncs"` + // concurrentResourceQuotaSyncs is the number of resource quotas that are + // allowed to sync concurrently. Larger number = more responsive quota + // management, but more CPU (and network) load. + ConcurrentResourceQuotaSyncs int32 `json:"concurrentResourceQuotaSyncs"` + // concurrentDeploymentSyncs is the number of deployment objects that are + // allowed to sync concurrently. Larger number = more responsive deployments, + // but more CPU (and network) load. + ConcurrentDeploymentSyncs int32 `json:"concurrentDeploymentSyncs"` + // concurrentDaemonSetSyncs is the number of daemonset objects that are + // allowed to sync concurrently. Larger number = more responsive daemonset, + // but more CPU (and network) load. + ConcurrentDaemonSetSyncs int32 `json:"concurrentDaemonSetSyncs"` + // concurrentJobSyncs is the number of job objects that are + // allowed to sync concurrently. Larger number = more responsive jobs, + // but more CPU (and network) load. + ConcurrentJobSyncs int32 `json:"concurrentJobSyncs"` + // concurrentNamespaceSyncs is the number of namespace objects that are + // allowed to sync concurrently. + ConcurrentNamespaceSyncs int32 `json:"concurrentNamespaceSyncs"` + // concurrentSATokenSyncs is the number of service account token syncing operations + // that will be done concurrently. + ConcurrentSATokenSyncs int32 `json:"concurrentSATokenSyncs"` + // lookupCacheSizeForRC is the size of lookup cache for replication controllers. + // Larger number = more responsive replica management, but more MEM load. + // nodeSyncPeriod is the period for syncing nodes from cloudprovider. Longer + // periods will result in fewer calls to cloud provider, but may delay addition + // of new nodes to cluster. + NodeSyncPeriod metav1.Duration `json:"nodeSyncPeriod"` + // routeReconciliationPeriod is the period for reconciling routes created for Nodes by cloud provider.. + RouteReconciliationPeriod metav1.Duration `json:"routeReconciliationPeriod"` + // resourceQuotaSyncPeriod is the period for syncing quota usage status + // in the system. + ResourceQuotaSyncPeriod metav1.Duration `json:"resourceQuotaSyncPeriod"` + // namespaceSyncPeriod is the period for syncing namespace life-cycle + // updates. + NamespaceSyncPeriod metav1.Duration `json:"namespaceSyncPeriod"` + // pvClaimBinderSyncPeriod is the period for syncing persistent volumes + // and persistent volume claims. + PVClaimBinderSyncPeriod metav1.Duration `json:"pVClaimBinderSyncPeriod"` + // minResyncPeriod is the resync period in reflectors; will be random between + // minResyncPeriod and 2*minResyncPeriod. + MinResyncPeriod metav1.Duration `json:"minResyncPeriod"` + // terminatedPodGCThreshold is the number of terminated pods that can exist + // before the terminated pod garbage collector starts deleting terminated pods. + // If <= 0, the terminated pod garbage collector is disabled. + TerminatedPodGCThreshold int32 `json:"terminatedPodGCThreshold"` + // horizontalPodAutoscalerSyncPeriod is the period for syncing the number of + // pods in horizontal pod autoscaler. + HorizontalPodAutoscalerSyncPeriod metav1.Duration `json:"horizontalPodAutoscalerSyncPeriod"` + // horizontalPodAutoscalerUpscaleForbiddenWindow is a period after which next upscale allowed. + HorizontalPodAutoscalerUpscaleForbiddenWindow metav1.Duration `json:"horizontalPodAutoscalerUpscaleForbiddenWindow"` + // horizontalPodAutoscalerDownscaleForbiddenWindow is a period after which next downscale allowed. + HorizontalPodAutoscalerDownscaleForbiddenWindow metav1.Duration `json:"horizontalPodAutoscalerDownscaleForbiddenWindow"` + // horizontalPodAutoscalerTolerance is the tolerance for when + // resource usage suggests upscaling/downscaling + HorizontalPodAutoscalerTolerance float64 `json:"horizontalPodAutoscalerTolerance"` + // deploymentControllerSyncPeriod is the period for syncing the deployments. + DeploymentControllerSyncPeriod metav1.Duration `json:"deploymentControllerSyncPeriod"` + // podEvictionTimeout is the grace period for deleting pods on failed nodes. + PodEvictionTimeout metav1.Duration `json:"podEvictionTimeout"` + // DEPRECATED: deletingPodsQps is the number of nodes per second on which pods are deleted in + // case of node failure. + DeletingPodsQps float32 `json:"deletingPodsQps"` + // DEPRECATED: deletingPodsBurst is the number of nodes on which pods are bursty deleted in + // case of node failure. For more details look into RateLimiter. + DeletingPodsBurst int32 `json:"deletingPodsBurst"` + // nodeMontiorGracePeriod is the amount of time which we allow a running node to be + // unresponsive before marking it unhealthy. Must be N times more than kubelet's + // nodeStatusUpdateFrequency, where N means number of retries allowed for kubelet + // to post node status. + NodeMonitorGracePeriod metav1.Duration `json:"nodeMonitorGracePeriod"` + // registerRetryCount is the number of retries for initial node registration. + // Retry interval equals node-sync-period. + RegisterRetryCount int32 `json:"registerRetryCount"` + // nodeStartupGracePeriod is the amount of time which we allow starting a node to + // be unresponsive before marking it unhealthy. + NodeStartupGracePeriod metav1.Duration `json:"nodeStartupGracePeriod"` + // nodeMonitorPeriod is the period for syncing NodeStatus in NodeController. + NodeMonitorPeriod metav1.Duration `json:"nodeMonitorPeriod"` + // serviceAccountKeyFile is the filename containing a PEM-encoded private RSA key + // used to sign service account tokens. + ServiceAccountKeyFile string `json:"serviceAccountKeyFile"` + // clusterSigningCertFile is the filename containing a PEM-encoded + // X509 CA certificate used to issue cluster-scoped certificates + ClusterSigningCertFile string `json:"clusterSigningCertFile"` + // clusterSigningCertFile is the filename containing a PEM-encoded + // RSA or ECDSA private key used to issue cluster-scoped certificates + ClusterSigningKeyFile string `json:"clusterSigningKeyFile"` + // clusterSigningDuration is the length of duration signed certificates + // will be given. + ClusterSigningDuration metav1.Duration `json:"clusterSigningDuration"` + // enableProfiling enables profiling via web interface host:port/debug/pprof/ + EnableProfiling bool `json:"enableProfiling"` + // enableContentionProfiling enables lock contention profiling, if enableProfiling is true. + EnableContentionProfiling bool `json:"enableContentionProfiling"` + // clusterName is the instance prefix for the cluster. + ClusterName string `json:"clusterName"` + // clusterCIDR is CIDR Range for Pods in cluster. + ClusterCIDR string `json:"clusterCIDR"` + // serviceCIDR is CIDR Range for Services in cluster. + ServiceCIDR string `json:"serviceCIDR"` + // NodeCIDRMaskSize is the mask size for node cidr in cluster. + NodeCIDRMaskSize int32 `json:"nodeCIDRMaskSize"` + // AllocateNodeCIDRs enables CIDRs for Pods to be allocated and, if + // ConfigureCloudRoutes is true, to be set on the cloud provider. + AllocateNodeCIDRs bool `json:"allocateNodeCIDRs"` + // CIDRAllocatorType determines what kind of pod CIDR allocator will be used. + CIDRAllocatorType string `json:"cIDRAllocatorType"` + // configureCloudRoutes enables CIDRs allocated with allocateNodeCIDRs + // to be configured on the cloud provider. + ConfigureCloudRoutes *bool `json:"configureCloudRoutes"` + // rootCAFile is the root certificate authority will be included in service + // account's token secret. This must be a valid PEM-encoded CA bundle. + RootCAFile string `json:"rootCAFile"` + // contentType is contentType of requests sent to apiserver. + ContentType string `json:"contentType"` + // kubeAPIQPS is the QPS to use while talking with kubernetes apiserver. + KubeAPIQPS float32 `json:"kubeAPIQPS"` + // kubeAPIBurst is the burst to use while talking with kubernetes apiserver. + KubeAPIBurst int32 `json:"kubeAPIBurst"` + // leaderElection defines the configuration of leader election client. + LeaderElection LeaderElectionConfiguration `json:"leaderElection"` + // volumeConfiguration holds configuration for volume related features. + VolumeConfiguration VolumeConfiguration `json:"volumeConfiguration"` + // How long to wait between starting controller managers + ControllerStartInterval metav1.Duration `json:"controllerStartInterval"` + // enables the generic garbage collector. MUST be synced with the + // corresponding flag of the kube-apiserver. WARNING: the generic garbage + // collector is an alpha feature. + EnableGarbageCollector *bool `json:"enableGarbageCollector"` + // concurrentGCSyncs is the number of garbage collector workers that are + // allowed to sync concurrently. + ConcurrentGCSyncs int32 `json:"concurrentGCSyncs"` + // gcIgnoredResources is the list of GroupResources that garbage collection should ignore. + GCIgnoredResources []GroupResource `json:"gCIgnoredResources"` + // nodeEvictionRate is the number of nodes per second on which pods are deleted in case of node failure when a zone is healthy + NodeEvictionRate float32 `json:"nodeEvictionRate"` + // secondaryNodeEvictionRate is the number of nodes per second on which pods are deleted in case of node failure when a zone is unhealthy + SecondaryNodeEvictionRate float32 `json:"secondaryNodeEvictionRate"` + // secondaryNodeEvictionRate is implicitly overridden to 0 for clusters smaller than or equal to largeClusterSizeThreshold + LargeClusterSizeThreshold int32 `json:"largeClusterSizeThreshold"` + // Zone is treated as unhealthy in nodeEvictionRate and secondaryNodeEvictionRate when at least + // unhealthyZoneThreshold (no less than 3) of Nodes in the zone are NotReady + UnhealthyZoneThreshold float32 `json:"unhealthyZoneThreshold"` + // Reconciler runs a periodic loop to reconcile the desired state of the with + // the actual state of the world by triggering attach detach operations. + // This flag enables or disables reconcile. Is false by default, and thus enabled. + DisableAttachDetachReconcilerSync bool `json:"disableAttachDetachReconcilerSync"` + // ReconcilerSyncLoopPeriod is the amount of time the reconciler sync states loop + // wait between successive executions. Is set to 5 sec by default. + ReconcilerSyncLoopPeriod metav1.Duration `json:"reconcilerSyncLoopPeriod"` + // If set to true enables NoExecute Taints and will evict all not-tolerating + // Pod running on Nodes tainted with this kind of Taints. + EnableTaintManager *bool `json:"enableTaintManager"` + // HorizontalPodAutoscalerUseRESTClients causes the HPA controller to use REST clients + // through the kube-aggregator when enabled, instead of using the legacy metrics client + // through the API server proxy. + HorizontalPodAutoscalerUseRESTClients *bool `json:"horizontalPodAutoscalerUseRESTClients"` +} + const ( // "kube-system" is the default scheduler lock object namespace SchedulerDefaultLockObjectNamespace string = "kube-system" diff --git a/pkg/apis/componentconfig/v1alpha1/zz_generated.conversion.go b/pkg/apis/componentconfig/v1alpha1/zz_generated.conversion.go index 8869aaa81e..741cbaaad7 100644 --- a/pkg/apis/componentconfig/v1alpha1/zz_generated.conversion.go +++ b/pkg/apis/componentconfig/v1alpha1/zz_generated.conversion.go @@ -39,12 +39,18 @@ func RegisterConversions(scheme *runtime.Scheme) error { return scheme.AddGeneratedConversionFuncs( Convert_v1alpha1_ClientConnectionConfiguration_To_componentconfig_ClientConnectionConfiguration, Convert_componentconfig_ClientConnectionConfiguration_To_v1alpha1_ClientConnectionConfiguration, + Convert_v1alpha1_GroupResource_To_componentconfig_GroupResource, + Convert_componentconfig_GroupResource_To_v1alpha1_GroupResource, + Convert_v1alpha1_KubeControllerManagerConfiguration_To_componentconfig_KubeControllerManagerConfiguration, + Convert_componentconfig_KubeControllerManagerConfiguration_To_v1alpha1_KubeControllerManagerConfiguration, Convert_v1alpha1_KubeSchedulerConfiguration_To_componentconfig_KubeSchedulerConfiguration, Convert_componentconfig_KubeSchedulerConfiguration_To_v1alpha1_KubeSchedulerConfiguration, Convert_v1alpha1_KubeSchedulerLeaderElectionConfiguration_To_componentconfig_KubeSchedulerLeaderElectionConfiguration, Convert_componentconfig_KubeSchedulerLeaderElectionConfiguration_To_v1alpha1_KubeSchedulerLeaderElectionConfiguration, Convert_v1alpha1_LeaderElectionConfiguration_To_componentconfig_LeaderElectionConfiguration, Convert_componentconfig_LeaderElectionConfiguration_To_v1alpha1_LeaderElectionConfiguration, + Convert_v1alpha1_PersistentVolumeRecyclerConfiguration_To_componentconfig_PersistentVolumeRecyclerConfiguration, + Convert_componentconfig_PersistentVolumeRecyclerConfiguration_To_v1alpha1_PersistentVolumeRecyclerConfiguration, Convert_v1alpha1_SchedulerAlgorithmSource_To_componentconfig_SchedulerAlgorithmSource, Convert_componentconfig_SchedulerAlgorithmSource_To_v1alpha1_SchedulerAlgorithmSource, Convert_v1alpha1_SchedulerPolicyConfigMapSource_To_componentconfig_SchedulerPolicyConfigMapSource, @@ -53,6 +59,8 @@ func RegisterConversions(scheme *runtime.Scheme) error { Convert_componentconfig_SchedulerPolicyFileSource_To_v1alpha1_SchedulerPolicyFileSource, Convert_v1alpha1_SchedulerPolicySource_To_componentconfig_SchedulerPolicySource, Convert_componentconfig_SchedulerPolicySource_To_v1alpha1_SchedulerPolicySource, + Convert_v1alpha1_VolumeConfiguration_To_componentconfig_VolumeConfiguration, + Convert_componentconfig_VolumeConfiguration_To_v1alpha1_VolumeConfiguration, ) } @@ -84,6 +92,206 @@ func Convert_componentconfig_ClientConnectionConfiguration_To_v1alpha1_ClientCon return autoConvert_componentconfig_ClientConnectionConfiguration_To_v1alpha1_ClientConnectionConfiguration(in, out, s) } +func autoConvert_v1alpha1_GroupResource_To_componentconfig_GroupResource(in *GroupResource, out *componentconfig.GroupResource, s conversion.Scope) error { + out.Group = in.Group + out.Resource = in.Resource + return nil +} + +// Convert_v1alpha1_GroupResource_To_componentconfig_GroupResource is an autogenerated conversion function. +func Convert_v1alpha1_GroupResource_To_componentconfig_GroupResource(in *GroupResource, out *componentconfig.GroupResource, s conversion.Scope) error { + return autoConvert_v1alpha1_GroupResource_To_componentconfig_GroupResource(in, out, s) +} + +func autoConvert_componentconfig_GroupResource_To_v1alpha1_GroupResource(in *componentconfig.GroupResource, out *GroupResource, s conversion.Scope) error { + out.Group = in.Group + out.Resource = in.Resource + return nil +} + +// Convert_componentconfig_GroupResource_To_v1alpha1_GroupResource is an autogenerated conversion function. +func Convert_componentconfig_GroupResource_To_v1alpha1_GroupResource(in *componentconfig.GroupResource, out *GroupResource, s conversion.Scope) error { + return autoConvert_componentconfig_GroupResource_To_v1alpha1_GroupResource(in, out, s) +} + +func autoConvert_v1alpha1_KubeControllerManagerConfiguration_To_componentconfig_KubeControllerManagerConfiguration(in *KubeControllerManagerConfiguration, out *componentconfig.KubeControllerManagerConfiguration, s conversion.Scope) error { + out.Controllers = *(*[]string)(unsafe.Pointer(&in.Controllers)) + out.Port = in.Port + out.Address = in.Address + out.UseServiceAccountCredentials = in.UseServiceAccountCredentials + out.CloudProvider = in.CloudProvider + out.CloudConfigFile = in.CloudConfigFile + out.ExternalCloudVolumePlugin = in.ExternalCloudVolumePlugin + out.AllowUntaggedCloud = in.AllowUntaggedCloud + out.ConcurrentEndpointSyncs = in.ConcurrentEndpointSyncs + out.ConcurrentRSSyncs = in.ConcurrentRSSyncs + out.ConcurrentRCSyncs = in.ConcurrentRCSyncs + out.ConcurrentServiceSyncs = in.ConcurrentServiceSyncs + out.ConcurrentResourceQuotaSyncs = in.ConcurrentResourceQuotaSyncs + out.ConcurrentDeploymentSyncs = in.ConcurrentDeploymentSyncs + out.ConcurrentDaemonSetSyncs = in.ConcurrentDaemonSetSyncs + out.ConcurrentJobSyncs = in.ConcurrentJobSyncs + out.ConcurrentNamespaceSyncs = in.ConcurrentNamespaceSyncs + out.ConcurrentSATokenSyncs = in.ConcurrentSATokenSyncs + out.NodeSyncPeriod = in.NodeSyncPeriod + out.RouteReconciliationPeriod = in.RouteReconciliationPeriod + out.ResourceQuotaSyncPeriod = in.ResourceQuotaSyncPeriod + out.NamespaceSyncPeriod = in.NamespaceSyncPeriod + out.PVClaimBinderSyncPeriod = in.PVClaimBinderSyncPeriod + out.MinResyncPeriod = in.MinResyncPeriod + out.TerminatedPodGCThreshold = in.TerminatedPodGCThreshold + out.HorizontalPodAutoscalerSyncPeriod = in.HorizontalPodAutoscalerSyncPeriod + out.HorizontalPodAutoscalerUpscaleForbiddenWindow = in.HorizontalPodAutoscalerUpscaleForbiddenWindow + out.HorizontalPodAutoscalerDownscaleForbiddenWindow = in.HorizontalPodAutoscalerDownscaleForbiddenWindow + out.HorizontalPodAutoscalerTolerance = in.HorizontalPodAutoscalerTolerance + out.DeploymentControllerSyncPeriod = in.DeploymentControllerSyncPeriod + out.PodEvictionTimeout = in.PodEvictionTimeout + out.DeletingPodsQps = in.DeletingPodsQps + out.DeletingPodsBurst = in.DeletingPodsBurst + out.NodeMonitorGracePeriod = in.NodeMonitorGracePeriod + out.RegisterRetryCount = in.RegisterRetryCount + out.NodeStartupGracePeriod = in.NodeStartupGracePeriod + out.NodeMonitorPeriod = in.NodeMonitorPeriod + out.ServiceAccountKeyFile = in.ServiceAccountKeyFile + out.ClusterSigningCertFile = in.ClusterSigningCertFile + out.ClusterSigningKeyFile = in.ClusterSigningKeyFile + out.ClusterSigningDuration = in.ClusterSigningDuration + out.EnableProfiling = in.EnableProfiling + out.EnableContentionProfiling = in.EnableContentionProfiling + out.ClusterName = in.ClusterName + out.ClusterCIDR = in.ClusterCIDR + out.ServiceCIDR = in.ServiceCIDR + out.NodeCIDRMaskSize = in.NodeCIDRMaskSize + out.AllocateNodeCIDRs = in.AllocateNodeCIDRs + out.CIDRAllocatorType = in.CIDRAllocatorType + if err := v1.Convert_Pointer_bool_To_bool(&in.ConfigureCloudRoutes, &out.ConfigureCloudRoutes, s); err != nil { + return err + } + out.RootCAFile = in.RootCAFile + out.ContentType = in.ContentType + out.KubeAPIQPS = in.KubeAPIQPS + out.KubeAPIBurst = in.KubeAPIBurst + if err := Convert_v1alpha1_LeaderElectionConfiguration_To_componentconfig_LeaderElectionConfiguration(&in.LeaderElection, &out.LeaderElection, s); err != nil { + return err + } + if err := Convert_v1alpha1_VolumeConfiguration_To_componentconfig_VolumeConfiguration(&in.VolumeConfiguration, &out.VolumeConfiguration, s); err != nil { + return err + } + out.ControllerStartInterval = in.ControllerStartInterval + if err := v1.Convert_Pointer_bool_To_bool(&in.EnableGarbageCollector, &out.EnableGarbageCollector, s); err != nil { + return err + } + out.ConcurrentGCSyncs = in.ConcurrentGCSyncs + out.GCIgnoredResources = *(*[]componentconfig.GroupResource)(unsafe.Pointer(&in.GCIgnoredResources)) + out.NodeEvictionRate = in.NodeEvictionRate + out.SecondaryNodeEvictionRate = in.SecondaryNodeEvictionRate + out.LargeClusterSizeThreshold = in.LargeClusterSizeThreshold + out.UnhealthyZoneThreshold = in.UnhealthyZoneThreshold + out.DisableAttachDetachReconcilerSync = in.DisableAttachDetachReconcilerSync + out.ReconcilerSyncLoopPeriod = in.ReconcilerSyncLoopPeriod + if err := v1.Convert_Pointer_bool_To_bool(&in.EnableTaintManager, &out.EnableTaintManager, s); err != nil { + return err + } + if err := v1.Convert_Pointer_bool_To_bool(&in.HorizontalPodAutoscalerUseRESTClients, &out.HorizontalPodAutoscalerUseRESTClients, s); err != nil { + return err + } + return nil +} + +// Convert_v1alpha1_KubeControllerManagerConfiguration_To_componentconfig_KubeControllerManagerConfiguration is an autogenerated conversion function. +func Convert_v1alpha1_KubeControllerManagerConfiguration_To_componentconfig_KubeControllerManagerConfiguration(in *KubeControllerManagerConfiguration, out *componentconfig.KubeControllerManagerConfiguration, s conversion.Scope) error { + return autoConvert_v1alpha1_KubeControllerManagerConfiguration_To_componentconfig_KubeControllerManagerConfiguration(in, out, s) +} + +func autoConvert_componentconfig_KubeControllerManagerConfiguration_To_v1alpha1_KubeControllerManagerConfiguration(in *componentconfig.KubeControllerManagerConfiguration, out *KubeControllerManagerConfiguration, s conversion.Scope) error { + out.Controllers = *(*[]string)(unsafe.Pointer(&in.Controllers)) + out.Port = in.Port + out.Address = in.Address + out.UseServiceAccountCredentials = in.UseServiceAccountCredentials + out.CloudProvider = in.CloudProvider + out.CloudConfigFile = in.CloudConfigFile + out.ExternalCloudVolumePlugin = in.ExternalCloudVolumePlugin + out.AllowUntaggedCloud = in.AllowUntaggedCloud + out.ConcurrentEndpointSyncs = in.ConcurrentEndpointSyncs + out.ConcurrentRSSyncs = in.ConcurrentRSSyncs + out.ConcurrentRCSyncs = in.ConcurrentRCSyncs + out.ConcurrentServiceSyncs = in.ConcurrentServiceSyncs + out.ConcurrentResourceQuotaSyncs = in.ConcurrentResourceQuotaSyncs + out.ConcurrentDeploymentSyncs = in.ConcurrentDeploymentSyncs + out.ConcurrentDaemonSetSyncs = in.ConcurrentDaemonSetSyncs + out.ConcurrentJobSyncs = in.ConcurrentJobSyncs + out.ConcurrentNamespaceSyncs = in.ConcurrentNamespaceSyncs + out.ConcurrentSATokenSyncs = in.ConcurrentSATokenSyncs + out.NodeSyncPeriod = in.NodeSyncPeriod + out.RouteReconciliationPeriod = in.RouteReconciliationPeriod + out.ResourceQuotaSyncPeriod = in.ResourceQuotaSyncPeriod + out.NamespaceSyncPeriod = in.NamespaceSyncPeriod + out.PVClaimBinderSyncPeriod = in.PVClaimBinderSyncPeriod + out.MinResyncPeriod = in.MinResyncPeriod + out.TerminatedPodGCThreshold = in.TerminatedPodGCThreshold + out.HorizontalPodAutoscalerSyncPeriod = in.HorizontalPodAutoscalerSyncPeriod + out.HorizontalPodAutoscalerUpscaleForbiddenWindow = in.HorizontalPodAutoscalerUpscaleForbiddenWindow + out.HorizontalPodAutoscalerDownscaleForbiddenWindow = in.HorizontalPodAutoscalerDownscaleForbiddenWindow + out.HorizontalPodAutoscalerTolerance = in.HorizontalPodAutoscalerTolerance + out.DeploymentControllerSyncPeriod = in.DeploymentControllerSyncPeriod + out.PodEvictionTimeout = in.PodEvictionTimeout + out.DeletingPodsQps = in.DeletingPodsQps + out.DeletingPodsBurst = in.DeletingPodsBurst + out.NodeMonitorGracePeriod = in.NodeMonitorGracePeriod + out.RegisterRetryCount = in.RegisterRetryCount + out.NodeStartupGracePeriod = in.NodeStartupGracePeriod + out.NodeMonitorPeriod = in.NodeMonitorPeriod + out.ServiceAccountKeyFile = in.ServiceAccountKeyFile + out.ClusterSigningCertFile = in.ClusterSigningCertFile + out.ClusterSigningKeyFile = in.ClusterSigningKeyFile + out.ClusterSigningDuration = in.ClusterSigningDuration + out.EnableProfiling = in.EnableProfiling + out.EnableContentionProfiling = in.EnableContentionProfiling + out.ClusterName = in.ClusterName + out.ClusterCIDR = in.ClusterCIDR + out.ServiceCIDR = in.ServiceCIDR + out.NodeCIDRMaskSize = in.NodeCIDRMaskSize + out.AllocateNodeCIDRs = in.AllocateNodeCIDRs + out.CIDRAllocatorType = in.CIDRAllocatorType + if err := v1.Convert_bool_To_Pointer_bool(&in.ConfigureCloudRoutes, &out.ConfigureCloudRoutes, s); err != nil { + return err + } + out.RootCAFile = in.RootCAFile + out.ContentType = in.ContentType + out.KubeAPIQPS = in.KubeAPIQPS + out.KubeAPIBurst = in.KubeAPIBurst + if err := Convert_componentconfig_LeaderElectionConfiguration_To_v1alpha1_LeaderElectionConfiguration(&in.LeaderElection, &out.LeaderElection, s); err != nil { + return err + } + if err := Convert_componentconfig_VolumeConfiguration_To_v1alpha1_VolumeConfiguration(&in.VolumeConfiguration, &out.VolumeConfiguration, s); err != nil { + return err + } + out.ControllerStartInterval = in.ControllerStartInterval + if err := v1.Convert_bool_To_Pointer_bool(&in.EnableGarbageCollector, &out.EnableGarbageCollector, s); err != nil { + return err + } + out.ConcurrentGCSyncs = in.ConcurrentGCSyncs + out.GCIgnoredResources = *(*[]GroupResource)(unsafe.Pointer(&in.GCIgnoredResources)) + out.NodeEvictionRate = in.NodeEvictionRate + out.SecondaryNodeEvictionRate = in.SecondaryNodeEvictionRate + out.LargeClusterSizeThreshold = in.LargeClusterSizeThreshold + out.UnhealthyZoneThreshold = in.UnhealthyZoneThreshold + out.DisableAttachDetachReconcilerSync = in.DisableAttachDetachReconcilerSync + out.ReconcilerSyncLoopPeriod = in.ReconcilerSyncLoopPeriod + if err := v1.Convert_bool_To_Pointer_bool(&in.EnableTaintManager, &out.EnableTaintManager, s); err != nil { + return err + } + if err := v1.Convert_bool_To_Pointer_bool(&in.HorizontalPodAutoscalerUseRESTClients, &out.HorizontalPodAutoscalerUseRESTClients, s); err != nil { + return err + } + return nil +} + +// Convert_componentconfig_KubeControllerManagerConfiguration_To_v1alpha1_KubeControllerManagerConfiguration is an autogenerated conversion function. +func Convert_componentconfig_KubeControllerManagerConfiguration_To_v1alpha1_KubeControllerManagerConfiguration(in *componentconfig.KubeControllerManagerConfiguration, out *KubeControllerManagerConfiguration, s conversion.Scope) error { + return autoConvert_componentconfig_KubeControllerManagerConfiguration_To_v1alpha1_KubeControllerManagerConfiguration(in, out, s) +} + func autoConvert_v1alpha1_KubeSchedulerConfiguration_To_componentconfig_KubeSchedulerConfiguration(in *KubeSchedulerConfiguration, out *componentconfig.KubeSchedulerConfiguration, s conversion.Scope) error { out.SchedulerName = in.SchedulerName if err := Convert_v1alpha1_SchedulerAlgorithmSource_To_componentconfig_SchedulerAlgorithmSource(&in.AlgorithmSource, &out.AlgorithmSource, s); err != nil { @@ -194,6 +402,38 @@ func Convert_componentconfig_LeaderElectionConfiguration_To_v1alpha1_LeaderElect return autoConvert_componentconfig_LeaderElectionConfiguration_To_v1alpha1_LeaderElectionConfiguration(in, out, s) } +func autoConvert_v1alpha1_PersistentVolumeRecyclerConfiguration_To_componentconfig_PersistentVolumeRecyclerConfiguration(in *PersistentVolumeRecyclerConfiguration, out *componentconfig.PersistentVolumeRecyclerConfiguration, s conversion.Scope) error { + out.MaximumRetry = in.MaximumRetry + out.MinimumTimeoutNFS = in.MinimumTimeoutNFS + out.PodTemplateFilePathNFS = in.PodTemplateFilePathNFS + out.IncrementTimeoutNFS = in.IncrementTimeoutNFS + out.PodTemplateFilePathHostPath = in.PodTemplateFilePathHostPath + out.MinimumTimeoutHostPath = in.MinimumTimeoutHostPath + out.IncrementTimeoutHostPath = in.IncrementTimeoutHostPath + return nil +} + +// Convert_v1alpha1_PersistentVolumeRecyclerConfiguration_To_componentconfig_PersistentVolumeRecyclerConfiguration is an autogenerated conversion function. +func Convert_v1alpha1_PersistentVolumeRecyclerConfiguration_To_componentconfig_PersistentVolumeRecyclerConfiguration(in *PersistentVolumeRecyclerConfiguration, out *componentconfig.PersistentVolumeRecyclerConfiguration, s conversion.Scope) error { + return autoConvert_v1alpha1_PersistentVolumeRecyclerConfiguration_To_componentconfig_PersistentVolumeRecyclerConfiguration(in, out, s) +} + +func autoConvert_componentconfig_PersistentVolumeRecyclerConfiguration_To_v1alpha1_PersistentVolumeRecyclerConfiguration(in *componentconfig.PersistentVolumeRecyclerConfiguration, out *PersistentVolumeRecyclerConfiguration, s conversion.Scope) error { + out.MaximumRetry = in.MaximumRetry + out.MinimumTimeoutNFS = in.MinimumTimeoutNFS + out.PodTemplateFilePathNFS = in.PodTemplateFilePathNFS + out.IncrementTimeoutNFS = in.IncrementTimeoutNFS + out.PodTemplateFilePathHostPath = in.PodTemplateFilePathHostPath + out.MinimumTimeoutHostPath = in.MinimumTimeoutHostPath + out.IncrementTimeoutHostPath = in.IncrementTimeoutHostPath + return nil +} + +// Convert_componentconfig_PersistentVolumeRecyclerConfiguration_To_v1alpha1_PersistentVolumeRecyclerConfiguration is an autogenerated conversion function. +func Convert_componentconfig_PersistentVolumeRecyclerConfiguration_To_v1alpha1_PersistentVolumeRecyclerConfiguration(in *componentconfig.PersistentVolumeRecyclerConfiguration, out *PersistentVolumeRecyclerConfiguration, s conversion.Scope) error { + return autoConvert_componentconfig_PersistentVolumeRecyclerConfiguration_To_v1alpha1_PersistentVolumeRecyclerConfiguration(in, out, s) +} + func autoConvert_v1alpha1_SchedulerAlgorithmSource_To_componentconfig_SchedulerAlgorithmSource(in *SchedulerAlgorithmSource, out *componentconfig.SchedulerAlgorithmSource, s conversion.Scope) error { out.Policy = (*componentconfig.SchedulerPolicySource)(unsafe.Pointer(in.Policy)) out.Provider = (*string)(unsafe.Pointer(in.Provider)) @@ -279,3 +519,41 @@ func autoConvert_componentconfig_SchedulerPolicySource_To_v1alpha1_SchedulerPoli func Convert_componentconfig_SchedulerPolicySource_To_v1alpha1_SchedulerPolicySource(in *componentconfig.SchedulerPolicySource, out *SchedulerPolicySource, s conversion.Scope) error { return autoConvert_componentconfig_SchedulerPolicySource_To_v1alpha1_SchedulerPolicySource(in, out, s) } + +func autoConvert_v1alpha1_VolumeConfiguration_To_componentconfig_VolumeConfiguration(in *VolumeConfiguration, out *componentconfig.VolumeConfiguration, s conversion.Scope) error { + if err := v1.Convert_Pointer_bool_To_bool(&in.EnableHostPathProvisioning, &out.EnableHostPathProvisioning, s); err != nil { + return err + } + if err := v1.Convert_Pointer_bool_To_bool(&in.EnableDynamicProvisioning, &out.EnableDynamicProvisioning, s); err != nil { + return err + } + if err := Convert_v1alpha1_PersistentVolumeRecyclerConfiguration_To_componentconfig_PersistentVolumeRecyclerConfiguration(&in.PersistentVolumeRecyclerConfiguration, &out.PersistentVolumeRecyclerConfiguration, s); err != nil { + return err + } + out.FlexVolumePluginDir = in.FlexVolumePluginDir + return nil +} + +// Convert_v1alpha1_VolumeConfiguration_To_componentconfig_VolumeConfiguration is an autogenerated conversion function. +func Convert_v1alpha1_VolumeConfiguration_To_componentconfig_VolumeConfiguration(in *VolumeConfiguration, out *componentconfig.VolumeConfiguration, s conversion.Scope) error { + return autoConvert_v1alpha1_VolumeConfiguration_To_componentconfig_VolumeConfiguration(in, out, s) +} + +func autoConvert_componentconfig_VolumeConfiguration_To_v1alpha1_VolumeConfiguration(in *componentconfig.VolumeConfiguration, out *VolumeConfiguration, s conversion.Scope) error { + if err := v1.Convert_bool_To_Pointer_bool(&in.EnableHostPathProvisioning, &out.EnableHostPathProvisioning, s); err != nil { + return err + } + if err := v1.Convert_bool_To_Pointer_bool(&in.EnableDynamicProvisioning, &out.EnableDynamicProvisioning, s); err != nil { + return err + } + if err := Convert_componentconfig_PersistentVolumeRecyclerConfiguration_To_v1alpha1_PersistentVolumeRecyclerConfiguration(&in.PersistentVolumeRecyclerConfiguration, &out.PersistentVolumeRecyclerConfiguration, s); err != nil { + return err + } + out.FlexVolumePluginDir = in.FlexVolumePluginDir + return nil +} + +// Convert_componentconfig_VolumeConfiguration_To_v1alpha1_VolumeConfiguration is an autogenerated conversion function. +func Convert_componentconfig_VolumeConfiguration_To_v1alpha1_VolumeConfiguration(in *componentconfig.VolumeConfiguration, out *VolumeConfiguration, s conversion.Scope) error { + return autoConvert_componentconfig_VolumeConfiguration_To_v1alpha1_VolumeConfiguration(in, out, s) +} diff --git a/pkg/apis/componentconfig/v1alpha1/zz_generated.deepcopy.go b/pkg/apis/componentconfig/v1alpha1/zz_generated.deepcopy.go index 4852ef5028..e1fea17030 100644 --- a/pkg/apis/componentconfig/v1alpha1/zz_generated.deepcopy.go +++ b/pkg/apis/componentconfig/v1alpha1/zz_generated.deepcopy.go @@ -40,6 +40,112 @@ func (in *ClientConnectionConfiguration) DeepCopy() *ClientConnectionConfigurati return out } +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *GroupResource) DeepCopyInto(out *GroupResource) { + *out = *in + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new GroupResource. +func (in *GroupResource) DeepCopy() *GroupResource { + if in == nil { + return nil + } + out := new(GroupResource) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *KubeControllerManagerConfiguration) DeepCopyInto(out *KubeControllerManagerConfiguration) { + *out = *in + out.TypeMeta = in.TypeMeta + if in.Controllers != nil { + in, out := &in.Controllers, &out.Controllers + *out = make([]string, len(*in)) + copy(*out, *in) + } + out.NodeSyncPeriod = in.NodeSyncPeriod + out.RouteReconciliationPeriod = in.RouteReconciliationPeriod + out.ResourceQuotaSyncPeriod = in.ResourceQuotaSyncPeriod + out.NamespaceSyncPeriod = in.NamespaceSyncPeriod + out.PVClaimBinderSyncPeriod = in.PVClaimBinderSyncPeriod + out.MinResyncPeriod = in.MinResyncPeriod + out.HorizontalPodAutoscalerSyncPeriod = in.HorizontalPodAutoscalerSyncPeriod + out.HorizontalPodAutoscalerUpscaleForbiddenWindow = in.HorizontalPodAutoscalerUpscaleForbiddenWindow + out.HorizontalPodAutoscalerDownscaleForbiddenWindow = in.HorizontalPodAutoscalerDownscaleForbiddenWindow + out.DeploymentControllerSyncPeriod = in.DeploymentControllerSyncPeriod + out.PodEvictionTimeout = in.PodEvictionTimeout + out.NodeMonitorGracePeriod = in.NodeMonitorGracePeriod + out.NodeStartupGracePeriod = in.NodeStartupGracePeriod + out.NodeMonitorPeriod = in.NodeMonitorPeriod + out.ClusterSigningDuration = in.ClusterSigningDuration + if in.ConfigureCloudRoutes != nil { + in, out := &in.ConfigureCloudRoutes, &out.ConfigureCloudRoutes + if *in == nil { + *out = nil + } else { + *out = new(bool) + **out = **in + } + } + in.LeaderElection.DeepCopyInto(&out.LeaderElection) + in.VolumeConfiguration.DeepCopyInto(&out.VolumeConfiguration) + out.ControllerStartInterval = in.ControllerStartInterval + if in.EnableGarbageCollector != nil { + in, out := &in.EnableGarbageCollector, &out.EnableGarbageCollector + if *in == nil { + *out = nil + } else { + *out = new(bool) + **out = **in + } + } + if in.GCIgnoredResources != nil { + in, out := &in.GCIgnoredResources, &out.GCIgnoredResources + *out = make([]GroupResource, len(*in)) + copy(*out, *in) + } + out.ReconcilerSyncLoopPeriod = in.ReconcilerSyncLoopPeriod + if in.EnableTaintManager != nil { + in, out := &in.EnableTaintManager, &out.EnableTaintManager + if *in == nil { + *out = nil + } else { + *out = new(bool) + **out = **in + } + } + if in.HorizontalPodAutoscalerUseRESTClients != nil { + in, out := &in.HorizontalPodAutoscalerUseRESTClients, &out.HorizontalPodAutoscalerUseRESTClients + if *in == nil { + *out = nil + } else { + *out = new(bool) + **out = **in + } + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new KubeControllerManagerConfiguration. +func (in *KubeControllerManagerConfiguration) DeepCopy() *KubeControllerManagerConfiguration { + if in == nil { + return nil + } + out := new(KubeControllerManagerConfiguration) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *KubeControllerManagerConfiguration) DeepCopyObject() runtime.Object { + if c := in.DeepCopy(); c != nil { + return c + } + return nil +} + // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *KubeSchedulerConfiguration) DeepCopyInto(out *KubeSchedulerConfiguration) { *out = *in @@ -113,6 +219,22 @@ func (in *LeaderElectionConfiguration) DeepCopy() *LeaderElectionConfiguration { return out } +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *PersistentVolumeRecyclerConfiguration) DeepCopyInto(out *PersistentVolumeRecyclerConfiguration) { + *out = *in + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new PersistentVolumeRecyclerConfiguration. +func (in *PersistentVolumeRecyclerConfiguration) DeepCopy() *PersistentVolumeRecyclerConfiguration { + if in == nil { + return nil + } + out := new(PersistentVolumeRecyclerConfiguration) + in.DeepCopyInto(out) + return out +} + // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *SchedulerAlgorithmSource) DeepCopyInto(out *SchedulerAlgorithmSource) { *out = *in @@ -212,3 +334,38 @@ func (in *SchedulerPolicySource) DeepCopy() *SchedulerPolicySource { in.DeepCopyInto(out) return out } + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *VolumeConfiguration) DeepCopyInto(out *VolumeConfiguration) { + *out = *in + if in.EnableHostPathProvisioning != nil { + in, out := &in.EnableHostPathProvisioning, &out.EnableHostPathProvisioning + if *in == nil { + *out = nil + } else { + *out = new(bool) + **out = **in + } + } + if in.EnableDynamicProvisioning != nil { + in, out := &in.EnableDynamicProvisioning, &out.EnableDynamicProvisioning + if *in == nil { + *out = nil + } else { + *out = new(bool) + **out = **in + } + } + out.PersistentVolumeRecyclerConfiguration = in.PersistentVolumeRecyclerConfiguration + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new VolumeConfiguration. +func (in *VolumeConfiguration) DeepCopy() *VolumeConfiguration { + if in == nil { + return nil + } + out := new(VolumeConfiguration) + in.DeepCopyInto(out) + return out +} diff --git a/pkg/apis/componentconfig/v1alpha1/zz_generated.defaults.go b/pkg/apis/componentconfig/v1alpha1/zz_generated.defaults.go index 96d754df54..f79d6514d5 100644 --- a/pkg/apis/componentconfig/v1alpha1/zz_generated.defaults.go +++ b/pkg/apis/componentconfig/v1alpha1/zz_generated.defaults.go @@ -28,10 +28,20 @@ import ( // Public to allow building arbitrary schemes. // All generated defaulters are covering - they call all nested defaulters. func RegisterDefaults(scheme *runtime.Scheme) error { + scheme.AddTypeDefaultingFunc(&KubeControllerManagerConfiguration{}, func(obj interface{}) { + SetObjectDefaults_KubeControllerManagerConfiguration(obj.(*KubeControllerManagerConfiguration)) + }) scheme.AddTypeDefaultingFunc(&KubeSchedulerConfiguration{}, func(obj interface{}) { SetObjectDefaults_KubeSchedulerConfiguration(obj.(*KubeSchedulerConfiguration)) }) return nil } +func SetObjectDefaults_KubeControllerManagerConfiguration(in *KubeControllerManagerConfiguration) { + SetDefaults_KubeControllerManagerConfiguration(in) + SetDefaults_LeaderElectionConfiguration(&in.LeaderElection) + SetDefaults_VolumeConfiguration(&in.VolumeConfiguration) + SetDefaults_PersistentVolumeRecyclerConfiguration(&in.VolumeConfiguration.PersistentVolumeRecyclerConfiguration) +} + func SetObjectDefaults_KubeSchedulerConfiguration(in *KubeSchedulerConfiguration) { SetDefaults_KubeSchedulerConfiguration(in) SetDefaults_LeaderElectionConfiguration(&in.LeaderElection.LeaderElectionConfiguration) diff --git a/pkg/client/leaderelectionconfig/BUILD b/pkg/client/leaderelectionconfig/BUILD index 5814cbd6f2..68617620d9 100644 --- a/pkg/client/leaderelectionconfig/BUILD +++ b/pkg/client/leaderelectionconfig/BUILD @@ -12,8 +12,6 @@ go_library( deps = [ "//pkg/apis/componentconfig:go_default_library", "//vendor/github.com/spf13/pflag:go_default_library", - "//vendor/k8s.io/apimachinery/pkg/apis/meta/v1:go_default_library", - "//vendor/k8s.io/client-go/tools/leaderelection/resourcelock:go_default_library", ], ) diff --git a/pkg/client/leaderelectionconfig/config.go b/pkg/client/leaderelectionconfig/config.go index ffa0bfd19a..acbcee8fc5 100644 --- a/pkg/client/leaderelectionconfig/config.go +++ b/pkg/client/leaderelectionconfig/config.go @@ -20,27 +20,13 @@ import ( "time" "github.com/spf13/pflag" - metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" - rl "k8s.io/client-go/tools/leaderelection/resourcelock" "k8s.io/kubernetes/pkg/apis/componentconfig" ) const ( DefaultLeaseDuration = 15 * time.Second - DefaultRenewDeadline = 10 * time.Second - DefaultRetryPeriod = 2 * time.Second ) -func DefaultLeaderElectionConfiguration() componentconfig.LeaderElectionConfiguration { - return componentconfig.LeaderElectionConfiguration{ - LeaderElect: false, - LeaseDuration: metav1.Duration{Duration: DefaultLeaseDuration}, - RenewDeadline: metav1.Duration{Duration: DefaultRenewDeadline}, - RetryPeriod: metav1.Duration{Duration: DefaultRetryPeriod}, - ResourceLock: rl.EndpointsResourceLock, - } -} - // BindFlags binds the common LeaderElectionCLIConfig flags to a flagset func BindFlags(l *componentconfig.LeaderElectionConfiguration, fs *pflag.FlagSet) { fs.BoolVar(&l.LeaderElect, "leader-elect", l.LeaderElect, ""+