Migrate to AWS CCM in k8s 1.24

This commit is contained in:
John Gardiner Myers 2021-11-02 22:38:03 -07:00
parent e43ee0b050
commit 56c054cda7
5 changed files with 34 additions and 2 deletions

View File

@ -650,6 +650,8 @@ type KubeControllerManagerConfig struct {
// EnableProfiling enables profiling via web interface host:port/debug/pprof/
EnableProfiling *bool `json:"enableProfiling,omitempty" flag:"profiling"`
// EnableLeaderMigration enables controller leader migration.
EnableLeaderMigration *bool `json:"enableLeaderMigration,omitempty" flag:"enable-leader-migration"`
}
// CloudControllerManagerConfig is the configuration of the cloud controller
@ -677,6 +679,8 @@ type CloudControllerManagerConfig struct {
LeaderElection *LeaderElectionConfiguration `json:"leaderElection,omitempty"`
// UseServiceAccountCredentials controls whether we use individual service account credentials for each controller.
UseServiceAccountCredentials *bool `json:"useServiceAccountCredentials,omitempty" flag:"use-service-account-credentials"`
// EnableLeaderMigration enables controller leader migration.
EnableLeaderMigration *bool `json:"enableLeaderMigration,omitempty" flag:"enable-leader-migration"`
}
// KubeSchedulerConfig is the configuration for the kube-scheduler

View File

@ -649,6 +649,8 @@ type KubeControllerManagerConfig struct {
// EnableProfiling enables profiling via web interface host:port/debug/pprof/
EnableProfiling *bool `json:"enableProfiling,omitempty" flag:"profiling"`
// EnableLeaderMigration enables controller leader migration.
EnableLeaderMigration *bool `json:"enableLeaderMigration,omitempty" flag:"enable-leader-migration"`
}
// CloudControllerManagerConfig is the configuration of the cloud controller
@ -676,6 +678,8 @@ type CloudControllerManagerConfig struct {
LeaderElection *LeaderElectionConfiguration `json:"leaderElection,omitempty"`
// UseServiceAccountCredentials controls whether we use individual service account credentials for each controller.
UseServiceAccountCredentials *bool `json:"useServiceAccountCredentials,omitempty" flag:"use-service-account-credentials"`
// EnableLeaderMigration enables controller leader migration.
EnableLeaderMigration *bool `json:"enableLeaderMigration,omitempty" flag:"enable-leader-migration"`
}
// KubeSchedulerConfig is the configuration for the kube-scheduler

View File

@ -647,6 +647,8 @@ type KubeControllerManagerConfig struct {
// EnableProfiling enables profiling via web interface host:port/debug/pprof/
EnableProfiling *bool `json:"enableProfiling,omitempty" flag:"profiling"`
// EnableLeaderMigration enables controller leader migration.
EnableLeaderMigration *bool `json:"enableLeaderMigration,omitempty" flag:"enable-leader-migration"`
}
// CloudControllerManagerConfig is the configuration of the cloud controller
@ -674,6 +676,8 @@ type CloudControllerManagerConfig struct {
LeaderElection *LeaderElectionConfiguration `json:"leaderElection,omitempty"`
// UseServiceAccountCredentials controls whether we use individual service account credentials for each controller.
UseServiceAccountCredentials *bool `json:"useServiceAccountCredentials,omitempty" flag:"use-service-account-credentials"`
// EnableLeaderMigration enables controller leader migration.
EnableLeaderMigration *bool `json:"enableLeaderMigration,omitempty" flag:"enable-leader-migration"`
}
// KubeSchedulerConfig is the configuration for the kube-scheduler

View File

@ -38,6 +38,14 @@ func (b *AWSCloudControllerManagerOptionsBuilder) BuildOptions(o interface{}) er
eccm := clusterSpec.ExternalCloudControllerManager
if kops.CloudProviderID(clusterSpec.CloudProvider) != kops.CloudProviderAWS {
return nil
}
if eccm == nil && b.IsKubernetesGTE("1.24") {
eccm = &kops.CloudControllerManagerConfig{}
}
if eccm == nil || kops.CloudProviderID(clusterSpec.CloudProvider) != kops.CloudProviderAWS {
return nil
}
@ -91,5 +99,9 @@ func (b *AWSCloudControllerManagerOptionsBuilder) BuildOptions(o interface{}) er
}
}
if b.IsKubernetesGTE("1.24") && b.IsKubernetesLT("1.25") {
eccm.EnableLeaderMigration = fi.Bool(true)
}
return nil
}

View File

@ -79,7 +79,11 @@ func (b *KubeControllerManagerOptionsBuilder) BuildOptions(o interface{}) error
kcm.ClusterName = b.ClusterName
switch kops.CloudProviderID(clusterSpec.CloudProvider) {
case kops.CloudProviderAWS:
kcm.CloudProvider = "aws"
if b.IsKubernetesGTE("1.24") {
kcm.CloudProvider = "external"
} else {
kcm.CloudProvider = "aws"
}
case kops.CloudProviderGCE:
kcm.CloudProvider = "gce"
@ -101,7 +105,11 @@ func (b *KubeControllerManagerOptionsBuilder) BuildOptions(o interface{}) error
return fmt.Errorf("unknown cloudprovider %q", clusterSpec.CloudProvider)
}
if clusterSpec.ExternalCloudControllerManager != nil {
if clusterSpec.ExternalCloudControllerManager == nil {
if kcm.CloudProvider == "aws" && b.IsKubernetesGTE("1.23") {
kcm.EnableLeaderMigration = fi.Bool(true)
}
} else {
kcm.CloudProvider = "external"
}