mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-09-26 04:36:00 +00:00
fix all reference for wrap componentconfig type
This commit is contained in:
@@ -82,10 +82,10 @@ func NewCloudControllerManagerOptions() (*CloudControllerManagerOptions, error)
|
||||
}
|
||||
|
||||
s := CloudControllerManagerOptions{
|
||||
Generic: cmoptions.NewGenericControllerManagerConfigurationOptions(componentConfig.Generic),
|
||||
KubeCloudShared: cmoptions.NewKubeCloudSharedOptions(componentConfig.KubeCloudShared),
|
||||
Generic: cmoptions.NewGenericControllerManagerConfigurationOptions(&componentConfig.Generic),
|
||||
KubeCloudShared: cmoptions.NewKubeCloudSharedOptions(&componentConfig.KubeCloudShared),
|
||||
ServiceController: &cmoptions.ServiceControllerOptions{
|
||||
ConcurrentServiceSyncs: componentConfig.ServiceController.ConcurrentServiceSyncs,
|
||||
ServiceControllerConfiguration: &componentConfig.ServiceController,
|
||||
},
|
||||
SecureServing: apiserveroptions.NewSecureServingOptions().WithLoopback(),
|
||||
InsecureServing: (&apiserveroptions.DeprecatedInsecureServingOptions{
|
||||
|
@@ -29,6 +29,7 @@ import (
|
||||
apiserveroptions "k8s.io/apiserver/pkg/server/options"
|
||||
componentbaseconfig "k8s.io/component-base/config"
|
||||
cmoptions "k8s.io/kubernetes/cmd/controller-manager/app/options"
|
||||
kubectrlmgrconfig "k8s.io/kubernetes/pkg/controller/apis/config"
|
||||
)
|
||||
|
||||
func TestDefaultFlags(t *testing.T) {
|
||||
@@ -36,42 +37,52 @@ func TestDefaultFlags(t *testing.T) {
|
||||
|
||||
expected := &CloudControllerManagerOptions{
|
||||
Generic: &cmoptions.GenericControllerManagerConfigurationOptions{
|
||||
Port: DefaultInsecureCloudControllerManagerPort, // 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
|
||||
MinResyncPeriod: metav1.Duration{Duration: 12 * time.Hour},
|
||||
ClientConnection: componentbaseconfig.ClientConnectionConfiguration{
|
||||
ContentType: "application/vnd.kubernetes.protobuf",
|
||||
QPS: 20.0,
|
||||
Burst: 30,
|
||||
},
|
||||
ControllerStartInterval: metav1.Duration{Duration: 0},
|
||||
LeaderElection: componentbaseconfig.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},
|
||||
GenericControllerManagerConfiguration: &kubectrlmgrconfig.GenericControllerManagerConfiguration{
|
||||
Port: DefaultInsecureCloudControllerManagerPort, // 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
|
||||
MinResyncPeriod: metav1.Duration{Duration: 12 * time.Hour},
|
||||
ClientConnection: componentbaseconfig.ClientConnectionConfiguration{
|
||||
ContentType: "application/vnd.kubernetes.protobuf",
|
||||
QPS: 20.0,
|
||||
Burst: 30,
|
||||
},
|
||||
ControllerStartInterval: metav1.Duration{Duration: 0},
|
||||
LeaderElection: componentbaseconfig.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},
|
||||
},
|
||||
Controllers: []string{"*"},
|
||||
},
|
||||
Debugging: &cmoptions.DebuggingOptions{
|
||||
EnableContentionProfiling: false,
|
||||
DebuggingConfiguration: &componentbaseconfig.DebuggingConfiguration{
|
||||
EnableContentionProfiling: false,
|
||||
},
|
||||
},
|
||||
Controllers: []string{"*"},
|
||||
},
|
||||
KubeCloudShared: &cmoptions.KubeCloudSharedOptions{
|
||||
RouteReconciliationPeriod: metav1.Duration{Duration: 10 * time.Second},
|
||||
NodeMonitorPeriod: metav1.Duration{Duration: 5 * time.Second},
|
||||
ClusterName: "kubernetes",
|
||||
ClusterCIDR: "",
|
||||
AllocateNodeCIDRs: false,
|
||||
CIDRAllocatorType: "",
|
||||
ConfigureCloudRoutes: true,
|
||||
KubeCloudSharedConfiguration: &kubectrlmgrconfig.KubeCloudSharedConfiguration{
|
||||
RouteReconciliationPeriod: metav1.Duration{Duration: 10 * time.Second},
|
||||
NodeMonitorPeriod: metav1.Duration{Duration: 5 * time.Second},
|
||||
ClusterName: "kubernetes",
|
||||
ClusterCIDR: "",
|
||||
AllocateNodeCIDRs: false,
|
||||
CIDRAllocatorType: "",
|
||||
ConfigureCloudRoutes: true,
|
||||
},
|
||||
CloudProvider: &cmoptions.CloudProviderOptions{
|
||||
Name: "",
|
||||
CloudConfigFile: "",
|
||||
CloudProviderConfiguration: &kubectrlmgrconfig.CloudProviderConfiguration{
|
||||
Name: "",
|
||||
CloudConfigFile: "",
|
||||
},
|
||||
},
|
||||
},
|
||||
ServiceController: &cmoptions.ServiceControllerOptions{
|
||||
ConcurrentServiceSyncs: 1,
|
||||
ServiceControllerConfiguration: &kubectrlmgrconfig.ServiceControllerConfiguration{
|
||||
ConcurrentServiceSyncs: 1,
|
||||
},
|
||||
},
|
||||
SecureServing: (&apiserveroptions.SecureServingOptions{
|
||||
BindPort: 10258,
|
||||
@@ -155,42 +166,52 @@ func TestAddFlags(t *testing.T) {
|
||||
|
||||
expected := &CloudControllerManagerOptions{
|
||||
Generic: &cmoptions.GenericControllerManagerConfigurationOptions{
|
||||
Port: DefaultInsecureCloudControllerManagerPort, // 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
|
||||
MinResyncPeriod: metav1.Duration{Duration: 100 * time.Minute},
|
||||
ClientConnection: componentbaseconfig.ClientConnectionConfiguration{
|
||||
ContentType: "application/vnd.kubernetes.protobuf",
|
||||
QPS: 50.0,
|
||||
Burst: 100,
|
||||
},
|
||||
ControllerStartInterval: metav1.Duration{Duration: 2 * time.Minute},
|
||||
LeaderElection: componentbaseconfig.LeaderElectionConfiguration{
|
||||
ResourceLock: "configmap",
|
||||
LeaderElect: false,
|
||||
LeaseDuration: metav1.Duration{Duration: 30 * time.Second},
|
||||
RenewDeadline: metav1.Duration{Duration: 15 * time.Second},
|
||||
RetryPeriod: metav1.Duration{Duration: 5 * time.Second},
|
||||
GenericControllerManagerConfiguration: &kubectrlmgrconfig.GenericControllerManagerConfiguration{
|
||||
Port: DefaultInsecureCloudControllerManagerPort, // 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
|
||||
MinResyncPeriod: metav1.Duration{Duration: 100 * time.Minute},
|
||||
ClientConnection: componentbaseconfig.ClientConnectionConfiguration{
|
||||
ContentType: "application/vnd.kubernetes.protobuf",
|
||||
QPS: 50.0,
|
||||
Burst: 100,
|
||||
},
|
||||
ControllerStartInterval: metav1.Duration{Duration: 2 * time.Minute},
|
||||
LeaderElection: componentbaseconfig.LeaderElectionConfiguration{
|
||||
ResourceLock: "configmap",
|
||||
LeaderElect: false,
|
||||
LeaseDuration: metav1.Duration{Duration: 30 * time.Second},
|
||||
RenewDeadline: metav1.Duration{Duration: 15 * time.Second},
|
||||
RetryPeriod: metav1.Duration{Duration: 5 * time.Second},
|
||||
},
|
||||
Controllers: []string{"foo", "bar"},
|
||||
},
|
||||
Debugging: &cmoptions.DebuggingOptions{
|
||||
EnableContentionProfiling: true,
|
||||
DebuggingConfiguration: &componentbaseconfig.DebuggingConfiguration{
|
||||
EnableContentionProfiling: true,
|
||||
},
|
||||
},
|
||||
Controllers: []string{"foo", "bar"},
|
||||
},
|
||||
KubeCloudShared: &cmoptions.KubeCloudSharedOptions{
|
||||
CloudProvider: &cmoptions.CloudProviderOptions{
|
||||
Name: "gce",
|
||||
CloudConfigFile: "/cloud-config",
|
||||
KubeCloudSharedConfiguration: &kubectrlmgrconfig.KubeCloudSharedConfiguration{
|
||||
RouteReconciliationPeriod: metav1.Duration{Duration: 30 * time.Second},
|
||||
NodeMonitorPeriod: metav1.Duration{Duration: 5 * time.Second},
|
||||
ClusterName: "k8s",
|
||||
ClusterCIDR: "1.2.3.4/24",
|
||||
AllocateNodeCIDRs: true,
|
||||
CIDRAllocatorType: "RangeAllocator",
|
||||
ConfigureCloudRoutes: false,
|
||||
},
|
||||
CloudProvider: &cmoptions.CloudProviderOptions{
|
||||
CloudProviderConfiguration: &kubectrlmgrconfig.CloudProviderConfiguration{
|
||||
Name: "gce",
|
||||
CloudConfigFile: "/cloud-config",
|
||||
},
|
||||
},
|
||||
RouteReconciliationPeriod: metav1.Duration{Duration: 30 * time.Second},
|
||||
NodeMonitorPeriod: metav1.Duration{Duration: 5 * time.Second},
|
||||
ClusterName: "k8s",
|
||||
ClusterCIDR: "1.2.3.4/24",
|
||||
AllocateNodeCIDRs: true,
|
||||
CIDRAllocatorType: "RangeAllocator",
|
||||
ConfigureCloudRoutes: false,
|
||||
},
|
||||
ServiceController: &cmoptions.ServiceControllerOptions{
|
||||
ConcurrentServiceSyncs: 1,
|
||||
ServiceControllerConfiguration: &kubectrlmgrconfig.ServiceControllerConfiguration{
|
||||
ConcurrentServiceSyncs: 1,
|
||||
},
|
||||
},
|
||||
SecureServing: (&apiserveroptions.SecureServingOptions{
|
||||
BindPort: 10001,
|
||||
|
Reference in New Issue
Block a user