Refactor the kube-controller-manager ComponentConfig structs to they can be moved out

This commit is contained in:
Lucas Käldström 2018-09-02 14:10:21 +03:00
parent b38a816457
commit 3187f2221a
No known key found for this signature in database
GPG Key ID: 3FA3783D77751514
4 changed files with 156 additions and 168 deletions

View File

@ -62,9 +62,7 @@ API rule violation: names_match,k8s.io/kubernetes/pkg/apis/componentconfig/v1alp
API rule violation: names_match,k8s.io/kubernetes/pkg/apis/componentconfig/v1alpha1,CSRSigningControllerConfiguration,ClusterSigningCertFile
API rule violation: names_match,k8s.io/kubernetes/pkg/apis/componentconfig/v1alpha1,CSRSigningControllerConfiguration,ClusterSigningKeyFile
API rule violation: names_match,k8s.io/kubernetes/pkg/apis/componentconfig/v1alpha1,CSRSigningControllerConfiguration,ClusterSigningDuration
API rule violation: names_match,k8s.io/kubernetes/pkg/apis/componentconfig/v1alpha1,CloudControllerManagerConfiguration,CloudProvider
API rule violation: names_match,k8s.io/kubernetes/pkg/apis/componentconfig/v1alpha1,CloudControllerManagerConfiguration,Debugging
API rule violation: names_match,k8s.io/kubernetes/pkg/apis/componentconfig/v1alpha1,CloudControllerManagerConfiguration,GenericComponent
API rule violation: names_match,k8s.io/kubernetes/pkg/apis/componentconfig/v1alpha1,CloudControllerManagerConfiguration,Generic
API rule violation: names_match,k8s.io/kubernetes/pkg/apis/componentconfig/v1alpha1,CloudControllerManagerConfiguration,KubeCloudShared
API rule violation: names_match,k8s.io/kubernetes/pkg/apis/componentconfig/v1alpha1,CloudControllerManagerConfiguration,ServiceController
API rule violation: names_match,k8s.io/kubernetes/pkg/apis/componentconfig/v1alpha1,CloudControllerManagerConfiguration,NodeStatusUpdateFrequency
@ -76,16 +74,18 @@ API rule violation: names_match,k8s.io/kubernetes/pkg/apis/componentconfig/v1alp
API rule violation: names_match,k8s.io/kubernetes/pkg/apis/componentconfig/v1alpha1,DeprecatedControllerConfiguration,DeletingPodsQps
API rule violation: names_match,k8s.io/kubernetes/pkg/apis/componentconfig/v1alpha1,DeprecatedControllerConfiguration,DeletingPodsBurst
API rule violation: names_match,k8s.io/kubernetes/pkg/apis/componentconfig/v1alpha1,DeprecatedControllerConfiguration,RegisterRetryCount
API rule violation: names_match,k8s.io/kubernetes/pkg/apis/componentconfig/v1alpha1,EndPointControllerConfiguration,ConcurrentEndpointSyncs
API rule violation: names_match,k8s.io/kubernetes/pkg/apis/componentconfig/v1alpha1,EndpointControllerConfiguration,ConcurrentEndpointSyncs
API rule violation: names_match,k8s.io/kubernetes/pkg/apis/componentconfig/v1alpha1,GarbageCollectorControllerConfiguration,EnableGarbageCollector
API rule violation: names_match,k8s.io/kubernetes/pkg/apis/componentconfig/v1alpha1,GarbageCollectorControllerConfiguration,ConcurrentGCSyncs
API rule violation: names_match,k8s.io/kubernetes/pkg/apis/componentconfig/v1alpha1,GarbageCollectorControllerConfiguration,GCIgnoredResources
API rule violation: names_match,k8s.io/kubernetes/pkg/apis/componentconfig/v1alpha1,GenericComponentConfiguration,MinResyncPeriod
API rule violation: names_match,k8s.io/kubernetes/pkg/apis/componentconfig/v1alpha1,GenericComponentConfiguration,ContentType
API rule violation: names_match,k8s.io/kubernetes/pkg/apis/componentconfig/v1alpha1,GenericComponentConfiguration,KubeAPIQPS
API rule violation: names_match,k8s.io/kubernetes/pkg/apis/componentconfig/v1alpha1,GenericComponentConfiguration,KubeAPIBurst
API rule violation: names_match,k8s.io/kubernetes/pkg/apis/componentconfig/v1alpha1,GenericComponentConfiguration,ControllerStartInterval
API rule violation: names_match,k8s.io/kubernetes/pkg/apis/componentconfig/v1alpha1,GenericComponentConfiguration,LeaderElection
API rule violation: names_match,k8s.io/kubernetes/pkg/apis/componentconfig/v1alpha1,GenericControllerManagerConfiguration,Port
API rule violation: names_match,k8s.io/kubernetes/pkg/apis/componentconfig/v1alpha1,GenericControllerManagerConfiguration,Address
API rule violation: names_match,k8s.io/kubernetes/pkg/apis/componentconfig/v1alpha1,GenericControllerManagerConfiguration,MinResyncPeriod
API rule violation: names_match,k8s.io/kubernetes/pkg/apis/componentconfig/v1alpha1,GenericControllerManagerConfiguration,ClientConnection
API rule violation: names_match,k8s.io/kubernetes/pkg/apis/componentconfig/v1alpha1,GenericControllerManagerConfiguration,ControllerStartInterval
API rule violation: names_match,k8s.io/kubernetes/pkg/apis/componentconfig/v1alpha1,GenericControllerManagerConfiguration,LeaderElection
API rule violation: names_match,k8s.io/kubernetes/pkg/apis/componentconfig/v1alpha1,GenericControllerManagerConfiguration,Controllers
API rule violation: names_match,k8s.io/kubernetes/pkg/apis/componentconfig/v1alpha1,GenericControllerManagerConfiguration,Debugging
API rule violation: names_match,k8s.io/kubernetes/pkg/apis/componentconfig/v1alpha1,GroupResource,Group
API rule violation: names_match,k8s.io/kubernetes/pkg/apis/componentconfig/v1alpha1,GroupResource,Resource
API rule violation: names_match,k8s.io/kubernetes/pkg/apis/componentconfig/v1alpha1,HPAControllerConfiguration,HorizontalPodAutoscalerSyncPeriod
@ -96,8 +96,8 @@ API rule violation: names_match,k8s.io/kubernetes/pkg/apis/componentconfig/v1alp
API rule violation: names_match,k8s.io/kubernetes/pkg/apis/componentconfig/v1alpha1,HPAControllerConfiguration,HorizontalPodAutoscalerCPUInitializationPeriod
API rule violation: names_match,k8s.io/kubernetes/pkg/apis/componentconfig/v1alpha1,HPAControllerConfiguration,HorizontalPodAutoscalerInitialReadinessDelay
API rule violation: names_match,k8s.io/kubernetes/pkg/apis/componentconfig/v1alpha1,JobControllerConfiguration,ConcurrentJobSyncs
API rule violation: names_match,k8s.io/kubernetes/pkg/apis/componentconfig/v1alpha1,KubeCloudSharedConfiguration,Port
API rule violation: names_match,k8s.io/kubernetes/pkg/apis/componentconfig/v1alpha1,KubeCloudSharedConfiguration,Address
API rule violation: names_match,k8s.io/kubernetes/pkg/apis/componentconfig/v1alpha1,KubeCloudSharedConfiguration,CloudProvider
API rule violation: names_match,k8s.io/kubernetes/pkg/apis/componentconfig/v1alpha1,KubeCloudSharedConfiguration,ExternalCloudVolumePlugin
API rule violation: names_match,k8s.io/kubernetes/pkg/apis/componentconfig/v1alpha1,KubeCloudSharedConfiguration,UseServiceAccountCredentials
API rule violation: names_match,k8s.io/kubernetes/pkg/apis/componentconfig/v1alpha1,KubeCloudSharedConfiguration,AllowUntaggedCloud
API rule violation: names_match,k8s.io/kubernetes/pkg/apis/componentconfig/v1alpha1,KubeCloudSharedConfiguration,RouteReconciliationPeriod
@ -108,21 +108,19 @@ API rule violation: names_match,k8s.io/kubernetes/pkg/apis/componentconfig/v1alp
API rule violation: names_match,k8s.io/kubernetes/pkg/apis/componentconfig/v1alpha1,KubeCloudSharedConfiguration,CIDRAllocatorType
API rule violation: names_match,k8s.io/kubernetes/pkg/apis/componentconfig/v1alpha1,KubeCloudSharedConfiguration,ConfigureCloudRoutes
API rule violation: names_match,k8s.io/kubernetes/pkg/apis/componentconfig/v1alpha1,KubeCloudSharedConfiguration,NodeSyncPeriod
API rule violation: names_match,k8s.io/kubernetes/pkg/apis/componentconfig/v1alpha1,KubeControllerManagerConfiguration,CloudProvider
API rule violation: names_match,k8s.io/kubernetes/pkg/apis/componentconfig/v1alpha1,KubeControllerManagerConfiguration,Debugging
API rule violation: names_match,k8s.io/kubernetes/pkg/apis/componentconfig/v1alpha1,KubeControllerManagerConfiguration,GenericComponent
API rule violation: names_match,k8s.io/kubernetes/pkg/apis/componentconfig/v1alpha1,KubeControllerManagerConfiguration,Generic
API rule violation: names_match,k8s.io/kubernetes/pkg/apis/componentconfig/v1alpha1,KubeControllerManagerConfiguration,KubeCloudShared
API rule violation: names_match,k8s.io/kubernetes/pkg/apis/componentconfig/v1alpha1,KubeControllerManagerConfiguration,AttachDetachController
API rule violation: names_match,k8s.io/kubernetes/pkg/apis/componentconfig/v1alpha1,KubeControllerManagerConfiguration,CSRSigningController
API rule violation: names_match,k8s.io/kubernetes/pkg/apis/componentconfig/v1alpha1,KubeControllerManagerConfiguration,DaemonSetController
API rule violation: names_match,k8s.io/kubernetes/pkg/apis/componentconfig/v1alpha1,KubeControllerManagerConfiguration,DeploymentController
API rule violation: names_match,k8s.io/kubernetes/pkg/apis/componentconfig/v1alpha1,KubeControllerManagerConfiguration,DeprecatedController
API rule violation: names_match,k8s.io/kubernetes/pkg/apis/componentconfig/v1alpha1,KubeControllerManagerConfiguration,EndPointController
API rule violation: names_match,k8s.io/kubernetes/pkg/apis/componentconfig/v1alpha1,KubeControllerManagerConfiguration,EndpointController
API rule violation: names_match,k8s.io/kubernetes/pkg/apis/componentconfig/v1alpha1,KubeControllerManagerConfiguration,GarbageCollectorController
API rule violation: names_match,k8s.io/kubernetes/pkg/apis/componentconfig/v1alpha1,KubeControllerManagerConfiguration,HPAController
API rule violation: names_match,k8s.io/kubernetes/pkg/apis/componentconfig/v1alpha1,KubeControllerManagerConfiguration,JobController
API rule violation: names_match,k8s.io/kubernetes/pkg/apis/componentconfig/v1alpha1,KubeControllerManagerConfiguration,NamespaceController
API rule violation: names_match,k8s.io/kubernetes/pkg/apis/componentconfig/v1alpha1,KubeControllerManagerConfiguration,NodeIpamController
API rule violation: names_match,k8s.io/kubernetes/pkg/apis/componentconfig/v1alpha1,KubeControllerManagerConfiguration,NodeIPAMController
API rule violation: names_match,k8s.io/kubernetes/pkg/apis/componentconfig/v1alpha1,KubeControllerManagerConfiguration,NodeLifecycleController
API rule violation: names_match,k8s.io/kubernetes/pkg/apis/componentconfig/v1alpha1,KubeControllerManagerConfiguration,PersistentVolumeBinderController
API rule violation: names_match,k8s.io/kubernetes/pkg/apis/componentconfig/v1alpha1,KubeControllerManagerConfiguration,PodGCController
@ -131,12 +129,10 @@ API rule violation: names_match,k8s.io/kubernetes/pkg/apis/componentconfig/v1alp
API rule violation: names_match,k8s.io/kubernetes/pkg/apis/componentconfig/v1alpha1,KubeControllerManagerConfiguration,ResourceQuotaController
API rule violation: names_match,k8s.io/kubernetes/pkg/apis/componentconfig/v1alpha1,KubeControllerManagerConfiguration,SAController
API rule violation: names_match,k8s.io/kubernetes/pkg/apis/componentconfig/v1alpha1,KubeControllerManagerConfiguration,ServiceController
API rule violation: names_match,k8s.io/kubernetes/pkg/apis/componentconfig/v1alpha1,KubeControllerManagerConfiguration,Controllers
API rule violation: names_match,k8s.io/kubernetes/pkg/apis/componentconfig/v1alpha1,KubeControllerManagerConfiguration,ExternalCloudVolumePlugin
API rule violation: names_match,k8s.io/kubernetes/pkg/apis/componentconfig/v1alpha1,NamespaceControllerConfiguration,NamespaceSyncPeriod
API rule violation: names_match,k8s.io/kubernetes/pkg/apis/componentconfig/v1alpha1,NamespaceControllerConfiguration,ConcurrentNamespaceSyncs
API rule violation: names_match,k8s.io/kubernetes/pkg/apis/componentconfig/v1alpha1,NodeIpamControllerConfiguration,ServiceCIDR
API rule violation: names_match,k8s.io/kubernetes/pkg/apis/componentconfig/v1alpha1,NodeIpamControllerConfiguration,NodeCIDRMaskSize
API rule violation: names_match,k8s.io/kubernetes/pkg/apis/componentconfig/v1alpha1,NodeIPAMControllerConfiguration,ServiceCIDR
API rule violation: names_match,k8s.io/kubernetes/pkg/apis/componentconfig/v1alpha1,NodeIPAMControllerConfiguration,NodeCIDRMaskSize
API rule violation: names_match,k8s.io/kubernetes/pkg/apis/componentconfig/v1alpha1,NodeLifecycleControllerConfiguration,EnableTaintManager
API rule violation: names_match,k8s.io/kubernetes/pkg/apis/componentconfig/v1alpha1,NodeLifecycleControllerConfiguration,NodeEvictionRate
API rule violation: names_match,k8s.io/kubernetes/pkg/apis/componentconfig/v1alpha1,NodeLifecycleControllerConfiguration,SecondaryNodeEvictionRate

View File

@ -17,6 +17,7 @@ limitations under the License.
package componentconfig
import (
apimachineryconfig "k8s.io/apimachinery/pkg/apis/config"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
apiserverconfig "k8s.io/apiserver/pkg/apis/config"
)
@ -33,13 +34,8 @@ type GroupResource struct {
type KubeControllerManagerConfiguration struct {
metav1.TypeMeta
// CloudProviderConfiguration holds configuration for CloudProvider related features.
CloudProvider CloudProviderConfiguration
// DebuggingConfiguration holds configuration for Debugging related features.
Debugging apiserverconfig.DebuggingConfiguration
// GenericComponentConfiguration holds configuration for GenericComponent
// related features both in cloud controller manager and kube-controller manager.
GenericComponent GenericComponentConfiguration
// Generic holds configuration for a generic controller-manager
Generic GenericControllerManagerConfiguration
// KubeCloudSharedConfiguration holds configuration for shared related features
// both in cloud controller manager and kube-controller manager.
KubeCloudShared KubeCloudSharedConfiguration
@ -59,9 +55,9 @@ type KubeControllerManagerConfiguration struct {
// DeprecatedControllerConfiguration holds configuration for some deprecated
// features.
DeprecatedController DeprecatedControllerConfiguration
// EndPointControllerConfiguration holds configuration for EndPointController
// EndpointControllerConfiguration holds configuration for EndpointController
// related features.
EndPointController EndPointControllerConfiguration
EndpointController EndpointControllerConfiguration
// GarbageCollectorControllerConfiguration holds configuration for
// GarbageCollectorController related features.
GarbageCollectorController GarbageCollectorControllerConfiguration
@ -69,12 +65,12 @@ type KubeControllerManagerConfiguration struct {
HPAController HPAControllerConfiguration
// JobControllerConfiguration holds configuration for JobController related features.
JobController JobControllerConfiguration
// NamespaceControllerConfiguration holds configuration for
// NamespaceController related features.
NamespaceController NamespaceControllerConfiguration
// NodeIpamControllerConfiguration holds configuration for NodeIpamController
// NamespaceControllerConfiguration holds configuration for NamespaceController
// related features.
NodeIpamController NodeIpamControllerConfiguration
NamespaceController NamespaceControllerConfiguration
// NodeIPAMControllerConfiguration holds configuration for NodeIPAMController
// related features.
NodeIPAMController NodeIPAMControllerConfiguration
// NodeLifecycleControllerConfiguration holds configuration for
// NodeLifecycleController related features.
NodeLifecycleController NodeLifecycleControllerConfiguration
@ -98,16 +94,6 @@ type KubeControllerManagerConfiguration struct {
// ServiceControllerConfiguration holds configuration for ServiceController
// related features.
ServiceController ServiceControllerConfiguration
// 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
// 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
}
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
@ -115,16 +101,12 @@ type KubeControllerManagerConfiguration struct {
type CloudControllerManagerConfiguration struct {
metav1.TypeMeta
// CloudProviderConfiguration holds configuration for CloudProvider related features.
CloudProvider CloudProviderConfiguration
// DebuggingConfiguration holds configuration for Debugging related features.
Debugging apiserverconfig.DebuggingConfiguration
// GenericComponentConfiguration holds configuration for GenericComponent
// related features both in cloud controller manager and kube-controller manager.
GenericComponent GenericComponentConfiguration
// Generic holds configuration for a generic controller-manager
Generic GenericControllerManagerConfiguration
// KubeCloudSharedConfiguration holds configuration for shared related features
// both in cloud controller manager and kube-controller manager.
KubeCloudShared KubeCloudSharedConfiguration
// ServiceControllerConfiguration holds configuration for ServiceController
// related features.
ServiceController ServiceControllerConfiguration
@ -132,34 +114,37 @@ type CloudControllerManagerConfiguration struct {
NodeStatusUpdateFrequency metav1.Duration
}
type CloudProviderConfiguration struct {
// Name is the provider for cloud services.
Name string
// cloudConfigFile is the path to the cloud provider configuration file.
CloudConfigFile string
}
type GenericComponentConfiguration struct {
// minResyncPeriod is the resync period in reflectors; will be random between
// minResyncPeriod and 2*minResyncPeriod.
MinResyncPeriod metav1.Duration
// contentType is contentType of requests sent to apiserver.
ContentType string
// kubeAPIQPS is the QPS to use while talking with kubernetes apiserver.
KubeAPIQPS float32
// kubeAPIBurst is the burst to use while talking with kubernetes apiserver.
KubeAPIBurst int32
// How long to wait between starting controller managers
ControllerStartInterval metav1.Duration
// leaderElection defines the configuration of leader election client.
LeaderElection apiserverconfig.LeaderElectionConfiguration
}
type KubeCloudSharedConfiguration struct {
type GenericControllerManagerConfiguration struct {
// port is the port that the controller-manager's http service runs on.
Port int32
// address is the IP address to serve on (set to 0.0.0.0 for all interfaces).
Address string
// minResyncPeriod is the resync period in reflectors; will be random between
// minResyncPeriod and 2*minResyncPeriod.
MinResyncPeriod metav1.Duration
// ClientConnection specifies the kubeconfig file and client connection
// settings for the proxy server to use when communicating with the apiserver.
ClientConnection apimachineryconfig.ClientConnectionConfiguration
// How long to wait between starting controller managers
ControllerStartInterval metav1.Duration
// leaderElection defines the configuration of leader election client.
LeaderElection apiserverconfig.LeaderElectionConfiguration
// 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
// DebuggingConfiguration holds configuration for Debugging related features.
Debugging apiserverconfig.DebuggingConfiguration
}
type KubeCloudSharedConfiguration struct {
// CloudProviderConfiguration holds configuration for CloudProvider related features.
CloudProvider CloudProviderConfiguration
// 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
// useServiceAccountCredentials indicates whether controllers should be run with
// individual service account credentials.
UseServiceAccountCredentials bool
@ -197,6 +182,13 @@ type AttachDetachControllerConfiguration struct {
ReconcilerSyncLoopPeriod metav1.Duration
}
type CloudProviderConfiguration struct {
// Name is the provider for cloud services.
Name string
// cloudConfigFile is the path to the cloud provider configuration file.
CloudConfigFile string
}
type CSRSigningControllerConfiguration struct {
// clusterSigningCertFile is the filename containing a PEM-encoded
// X509 CA certificate used to issue cluster-scoped certificates
@ -237,7 +229,7 @@ type DeprecatedControllerConfiguration struct {
RegisterRetryCount int32
}
type EndPointControllerConfiguration struct {
type EndpointControllerConfiguration struct {
// concurrentEndpointSyncs is the number of endpoint syncing operations
// that will be done concurrently. Larger number = faster endpoint updating,
// but more CPU (and network) load.
@ -297,7 +289,7 @@ type NamespaceControllerConfiguration struct {
ConcurrentNamespaceSyncs int32
}
type NodeIpamControllerConfiguration struct {
type NodeIPAMControllerConfiguration struct {
// serviceCIDR is CIDR Range for Services in cluster.
ServiceCIDR string
// NodeCIDRMaskSize is the mask size for node cidr in cluster.

View File

@ -19,6 +19,7 @@ package v1alpha1
import (
"time"
apimachineryconfigv1alpha1 "k8s.io/apimachinery/pkg/apis/config/v1alpha1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
kruntime "k8s.io/apimachinery/pkg/runtime"
apiserverconfigv1alpha1 "k8s.io/apiserver/pkg/apis/config/v1alpha1"
@ -29,23 +30,10 @@ func addDefaultingFuncs(scheme *kruntime.Scheme) error {
return RegisterDefaults(scheme)
}
func SetDefaults_CloudControllerManagerConfiguration(obj *CloudControllerManagerConfiguration) {
zero := metav1.Duration{}
if obj.ServiceController.ConcurrentServiceSyncs == 0 {
obj.ServiceController.ConcurrentServiceSyncs = 1
}
if obj.NodeStatusUpdateFrequency == zero {
obj.NodeStatusUpdateFrequency = metav1.Duration{Duration: 5 * time.Minute}
}
}
func SetDefaults_KubeControllerManagerConfiguration(obj *KubeControllerManagerConfiguration) {
zero := metav1.Duration{}
if len(obj.Controllers) == 0 {
obj.Controllers = []string{"*"}
}
if obj.EndPointController.ConcurrentEndpointSyncs == 0 {
obj.EndPointController.ConcurrentEndpointSyncs = 5
if obj.EndpointController.ConcurrentEndpointSyncs == 0 {
obj.EndpointController.ConcurrentEndpointSyncs = 5
}
if obj.ServiceController.ConcurrentServiceSyncs == 0 {
obj.ServiceController.ConcurrentServiceSyncs = 1
@ -116,8 +104,8 @@ func SetDefaults_KubeControllerManagerConfiguration(obj *KubeControllerManagerCo
if obj.NodeLifecycleController.NodeStartupGracePeriod == zero {
obj.NodeLifecycleController.NodeStartupGracePeriod = metav1.Duration{Duration: 60 * time.Second}
}
if obj.NodeIpamController.NodeCIDRMaskSize == 0 {
obj.NodeIpamController.NodeCIDRMaskSize = 24
if obj.NodeIPAMController.NodeCIDRMaskSize == 0 {
obj.NodeIPAMController.NodeCIDRMaskSize = 24
}
if obj.PodGCController.TerminatedPodGCThreshold == 0 {
obj.PodGCController.TerminatedPodGCThreshold = 12500
@ -146,39 +134,58 @@ func SetDefaults_KubeControllerManagerConfiguration(obj *KubeControllerManagerCo
if obj.HPAController.HorizontalPodAutoscalerUseRESTClients == nil {
obj.HPAController.HorizontalPodAutoscalerUseRESTClients = utilpointer.BoolPtr(true)
}
// These defaults override the recommended defaults from the apimachineryconfigv1alpha1 package that are applied automatically
// These client-connection defaults are specific to the kube-controller-manager
if obj.Generic.ClientConnection.QPS == 0.0 {
obj.Generic.ClientConnection.QPS = 50.0
}
if obj.Generic.ClientConnection.Burst == 0 {
obj.Generic.ClientConnection.Burst = 100
}
}
func SetDefaults_GenericComponentConfiguration(obj *GenericComponentConfiguration) {
func SetDefaults_CloudControllerManagerConfiguration(obj *CloudControllerManagerConfiguration) {
zero := metav1.Duration{}
if obj.ServiceController.ConcurrentServiceSyncs == 0 {
obj.ServiceController.ConcurrentServiceSyncs = 1
}
if obj.NodeStatusUpdateFrequency == zero {
obj.NodeStatusUpdateFrequency = metav1.Duration{Duration: 5 * time.Minute}
}
// These defaults override the recommended defaults from the apimachineryconfigv1alpha1 package that are applied automatically
// These client-connection defaults are specific to the cloud-controller-manager
if obj.Generic.ClientConnection.QPS == 0 {
obj.Generic.ClientConnection.QPS = 20
}
if obj.Generic.ClientConnection.Burst == 0 {
obj.Generic.ClientConnection.Burst = 30
}
}
func SetDefaults_GenericControllerManagerConfiguration(obj *GenericControllerManagerConfiguration) {
zero := metav1.Duration{}
if obj.Address == "" {
obj.Address = "0.0.0.0"
}
if obj.MinResyncPeriod == zero {
obj.MinResyncPeriod = metav1.Duration{Duration: 12 * time.Hour}
}
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 len(obj.Controllers) == 0 {
obj.Controllers = []string{"*"}
}
// Use the default LeaderElectionConfiguration options
// Use the default ClientConnectionConfiguration and LeaderElectionConfiguration options
apimachineryconfigv1alpha1.RecommendedDefaultClientConnectionConfiguration(&obj.ClientConnection)
apiserverconfigv1alpha1.RecommendedDefaultLeaderElectionConfiguration(&obj.LeaderElection)
}
func SetDefaults_KubeCloudSharedConfiguration(obj *KubeCloudSharedConfiguration) {
zero := metav1.Duration{}
// Port
if obj.Address == "" {
obj.Address = "0.0.0.0"
}
if obj.RouteReconciliationPeriod == zero {
obj.RouteReconciliationPeriod = metav1.Duration{Duration: 10 * time.Second}
}
if obj.NodeMonitorPeriod == zero {
obj.NodeMonitorPeriod = metav1.Duration{Duration: 5 * time.Second}
}
@ -188,6 +195,9 @@ func SetDefaults_KubeCloudSharedConfiguration(obj *KubeCloudSharedConfiguration)
if obj.ConfigureCloudRoutes == nil {
obj.ConfigureCloudRoutes = utilpointer.BoolPtr(true)
}
if obj.RouteReconciliationPeriod == zero {
obj.RouteReconciliationPeriod = metav1.Duration{Duration: 10 * time.Second}
}
}
func SetDefaults_PersistentVolumeRecyclerConfiguration(obj *PersistentVolumeRecyclerConfiguration) {

View File

@ -17,6 +17,7 @@ limitations under the License.
package v1alpha1
import (
apimachineryconfigv1alpha1 "k8s.io/apimachinery/pkg/apis/config/v1alpha1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
apiserverconfigv1alpha1 "k8s.io/apiserver/pkg/apis/config/v1alpha1"
)
@ -81,13 +82,8 @@ type GroupResource struct {
type KubeControllerManagerConfiguration struct {
metav1.TypeMeta `json:",inline"`
// CloudProviderConfiguration holds configuration for CloudProvider related features.
CloudProvider CloudProviderConfiguration
// DebuggingConfiguration holds configuration for Debugging related features.
Debugging apiserverconfigv1alpha1.DebuggingConfiguration
// GenericComponentConfiguration holds configuration for GenericComponent
// related features both in cloud controller manager and kube-controller manager.
GenericComponent GenericComponentConfiguration
// Generic holds configuration for a generic controller-manager
Generic GenericControllerManagerConfiguration
// KubeCloudSharedConfiguration holds configuration for shared related features
// both in cloud controller manager and kube-controller manager.
KubeCloudShared KubeCloudSharedConfiguration
@ -107,9 +103,9 @@ type KubeControllerManagerConfiguration struct {
// DeprecatedControllerConfiguration holds configuration for some deprecated
// features.
DeprecatedController DeprecatedControllerConfiguration
// EndPointControllerConfiguration holds configuration for EndPointController
// EndpointControllerConfiguration holds configuration for EndpointController
// related features.
EndPointController EndPointControllerConfiguration
EndpointController EndpointControllerConfiguration
// GarbageCollectorControllerConfiguration holds configuration for
// GarbageCollectorController related features.
GarbageCollectorController GarbageCollectorControllerConfiguration
@ -120,9 +116,9 @@ type KubeControllerManagerConfiguration struct {
// NamespaceControllerConfiguration holds configuration for NamespaceController
// related features.
NamespaceController NamespaceControllerConfiguration
// NodeIpamControllerConfiguration holds configuration for NodeIpamController
// NodeIPAMControllerConfiguration holds configuration for NodeIPAMController
// related features.
NodeIpamController NodeIpamControllerConfiguration
NodeIPAMController NodeIPAMControllerConfiguration
// NodeLifecycleControllerConfiguration holds configuration for
// NodeLifecycleController related features.
NodeLifecycleController NodeLifecycleControllerConfiguration
@ -146,16 +142,6 @@ type KubeControllerManagerConfiguration struct {
// ServiceControllerConfiguration holds configuration for ServiceController
// related features.
ServiceController ServiceControllerConfiguration
// 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
// 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
}
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
@ -163,13 +149,8 @@ type KubeControllerManagerConfiguration struct {
type CloudControllerManagerConfiguration struct {
metav1.TypeMeta `json:",inline"`
// CloudProviderConfiguration holds configuration for CloudProvider related features.
CloudProvider CloudProviderConfiguration
// DebuggingConfiguration holds configuration for Debugging related features.
Debugging apiserverconfigv1alpha1.DebuggingConfiguration
// GenericComponentConfiguration holds configuration for GenericComponent
// related features both in cloud controller manager and kube-controller manager.
GenericComponent GenericComponentConfiguration
// Generic holds configuration for a generic controller-manager
Generic GenericControllerManagerConfiguration
// KubeCloudSharedConfiguration holds configuration for shared related features
// both in cloud controller manager and kube-controller manager.
KubeCloudShared KubeCloudSharedConfiguration
@ -180,35 +161,37 @@ type CloudControllerManagerConfiguration struct {
NodeStatusUpdateFrequency metav1.Duration
}
type CloudProviderConfiguration struct {
// Name is the provider for cloud services.
Name string
// cloudConfigFile is the path to the cloud provider configuration file.
CloudConfigFile string
}
type GenericComponentConfiguration struct {
// minResyncPeriod is the resync period in reflectors; will be random between
// minResyncPeriod and 2*minResyncPeriod.
MinResyncPeriod metav1.Duration
// contentType is contentType of requests sent to apiserver.
ContentType string
// kubeAPIQPS is the QPS to use while talking with kubernetes apiserver.
KubeAPIQPS float32
// kubeAPIBurst is the burst to use while talking with kubernetes apiserver.
KubeAPIBurst int32
// How long to wait between starting controller managers
ControllerStartInterval metav1.Duration
// leaderElection defines the configuration of leader election client.
LeaderElection apiserverconfigv1alpha1.LeaderElectionConfiguration
}
type KubeCloudSharedConfiguration struct {
type GenericControllerManagerConfiguration struct {
// port is the port that the controller-manager's http service runs on.
Port int32
// address is the IP address to serve on (set to 0.0.0.0 for all interfaces).
Address string
// minResyncPeriod is the resync period in reflectors; will be random between
// minResyncPeriod and 2*minResyncPeriod.
MinResyncPeriod metav1.Duration
// ClientConnection specifies the kubeconfig file and client connection
// settings for the proxy server to use when communicating with the apiserver.
ClientConnection apimachineryconfigv1alpha1.ClientConnectionConfiguration
// How long to wait between starting controller managers
ControllerStartInterval metav1.Duration
// leaderElection defines the configuration of leader election client.
LeaderElection apiserverconfigv1alpha1.LeaderElectionConfiguration
// 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
// DebuggingConfiguration holds configuration for Debugging related features.
Debugging apiserverconfigv1alpha1.DebuggingConfiguration
}
type KubeCloudSharedConfiguration struct {
// CloudProviderConfiguration holds configuration for CloudProvider related features.
CloudProvider CloudProviderConfiguration
// 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
// useServiceAccountCredentials indicates whether controllers should be run with
// individual service account credentials.
UseServiceAccountCredentials bool
@ -246,6 +229,13 @@ type AttachDetachControllerConfiguration struct {
ReconcilerSyncLoopPeriod metav1.Duration
}
type CloudProviderConfiguration struct {
// Name is the provider for cloud services.
Name string
// cloudConfigFile is the path to the cloud provider configuration file.
CloudConfigFile string
}
type CSRSigningControllerConfiguration struct {
// clusterSigningCertFile is the filename containing a PEM-encoded
// X509 CA certificate used to issue cluster-scoped certificates
@ -286,7 +276,7 @@ type DeprecatedControllerConfiguration struct {
RegisterRetryCount int32
}
type EndPointControllerConfiguration struct {
type EndpointControllerConfiguration struct {
// concurrentEndpointSyncs is the number of endpoint syncing operations
// that will be done concurrently. Larger number = faster endpoint updating,
// but more CPU (and network) load.
@ -346,7 +336,7 @@ type NamespaceControllerConfiguration struct {
ConcurrentNamespaceSyncs int32
}
type NodeIpamControllerConfiguration struct {
type NodeIPAMControllerConfiguration struct {
// serviceCIDR is CIDR Range for Services in cluster.
ServiceCIDR string
// NodeCIDRMaskSize is the mask size for node cidr in cluster.