diff --git a/pkg/model/components/awscloudcontrollermanager.go b/pkg/model/components/awscloudcontrollermanager.go index 3c8f17e3c7..d1e1788845 100644 --- a/pkg/model/components/awscloudcontrollermanager.go +++ b/pkg/model/components/awscloudcontrollermanager.go @@ -49,6 +49,10 @@ func (b *AWSCloudControllerManagerOptionsBuilder) BuildOptions(o interface{}) er return nil } + // No significant downside to always doing a leader election. + // Also, having multiple control plane nodes requires leader election. + eccm.LeaderElection = &kops.LeaderElectionConfiguration{LeaderElect: fi.Bool(true)} + eccm.ClusterName = b.ClusterName eccm.ClusterCIDR = clusterSpec.NonMasqueradeCIDR diff --git a/pkg/model/components/gcpcloudcontrollermanager.go b/pkg/model/components/gcpcloudcontrollermanager.go index 418d9811bf..47e7ef4d1c 100644 --- a/pkg/model/components/gcpcloudcontrollermanager.go +++ b/pkg/model/components/gcpcloudcontrollermanager.go @@ -45,6 +45,11 @@ func (b *GCPCloudControllerManagerOptionsBuilder) BuildOptions(options interface if ccmConfig == nil { return nil } + + // No significant downside to always doing a leader election. + // Also, having multiple control plane nodes requires leader election. + ccmConfig.LeaderElection = &kops.LeaderElectionConfiguration{LeaderElect: fi.Bool(true)} + // CCM interacts directly with the GCP API, use the name safe for GCP ccmConfig.ClusterName = gce.SafeClusterName(b.ClusterName) ccmConfig.AllocateNodeCIDRs = fi.Bool(true) diff --git a/tests/integration/update_cluster/many-addons-ccm-irsa/data/aws_s3_bucket_object_cluster-completed.spec_content b/tests/integration/update_cluster/many-addons-ccm-irsa/data/aws_s3_bucket_object_cluster-completed.spec_content index 36a0c14c54..c68c656da3 100644 --- a/tests/integration/update_cluster/many-addons-ccm-irsa/data/aws_s3_bucket_object_cluster-completed.spec_content +++ b/tests/integration/update_cluster/many-addons-ccm-irsa/data/aws_s3_bucket_object_cluster-completed.spec_content @@ -25,6 +25,8 @@ spec: clusterName: minimal.example.com configureCloudRoutes: false image: k8s.gcr.io/provider-aws/cloud-controller-manager:v1.21.0-alpha.0 + leaderElection: + leaderElect: true cloudProvider: aws clusterAutoscaler: awsUseStaticInstanceList: false diff --git a/tests/integration/update_cluster/many-addons-ccm-irsa23/data/aws_s3_bucket_object_cluster-completed.spec_content b/tests/integration/update_cluster/many-addons-ccm-irsa23/data/aws_s3_bucket_object_cluster-completed.spec_content index 946140a1ce..5027b2384f 100644 --- a/tests/integration/update_cluster/many-addons-ccm-irsa23/data/aws_s3_bucket_object_cluster-completed.spec_content +++ b/tests/integration/update_cluster/many-addons-ccm-irsa23/data/aws_s3_bucket_object_cluster-completed.spec_content @@ -23,6 +23,8 @@ spec: clusterName: minimal.example.com configureCloudRoutes: false image: k8s.gcr.io/provider-aws/cloud-controller-manager:v1.23.0-alpha.0 + leaderElection: + leaderElect: true cloudProvider: aws clusterAutoscaler: awsUseStaticInstanceList: false diff --git a/tests/integration/update_cluster/many-addons-ccm/data/aws_s3_bucket_object_cluster-completed.spec_content b/tests/integration/update_cluster/many-addons-ccm/data/aws_s3_bucket_object_cluster-completed.spec_content index 4dbbd09984..3843781cb7 100644 --- a/tests/integration/update_cluster/many-addons-ccm/data/aws_s3_bucket_object_cluster-completed.spec_content +++ b/tests/integration/update_cluster/many-addons-ccm/data/aws_s3_bucket_object_cluster-completed.spec_content @@ -25,6 +25,8 @@ spec: clusterName: minimal.example.com configureCloudRoutes: false image: k8s.gcr.io/provider-aws/cloud-controller-manager:v1.21.0-alpha.0 + leaderElection: + leaderElect: true cloudProvider: aws clusterAutoscaler: awsUseStaticInstanceList: false diff --git a/tests/integration/update_cluster/minimal-1.24/data/aws_s3_bucket_object_cluster-completed.spec_content b/tests/integration/update_cluster/minimal-1.24/data/aws_s3_bucket_object_cluster-completed.spec_content index 1f7a2cfcf5..372618e0f9 100644 --- a/tests/integration/update_cluster/minimal-1.24/data/aws_s3_bucket_object_cluster-completed.spec_content +++ b/tests/integration/update_cluster/minimal-1.24/data/aws_s3_bucket_object_cluster-completed.spec_content @@ -21,6 +21,8 @@ spec: configureCloudRoutes: false enableLeaderMigration: true image: gcr.io/k8s-staging-provider-aws/cloud-controller-manager:latest + leaderElection: + leaderElect: true cloudProvider: aws clusterDNSDomain: cluster.local configBase: memfs://tests/minimal.example.com diff --git a/tests/integration/update_cluster/minimal-ipv6-calico/data/aws_s3_bucket_object_cluster-completed.spec_content b/tests/integration/update_cluster/minimal-ipv6-calico/data/aws_s3_bucket_object_cluster-completed.spec_content index 381837b4c5..6e22d59dea 100644 --- a/tests/integration/update_cluster/minimal-ipv6-calico/data/aws_s3_bucket_object_cluster-completed.spec_content +++ b/tests/integration/update_cluster/minimal-ipv6-calico/data/aws_s3_bucket_object_cluster-completed.spec_content @@ -25,6 +25,8 @@ spec: clusterName: minimal-ipv6.example.com configureCloudRoutes: false image: k8s.gcr.io/provider-aws/cloud-controller-manager:v1.21.0-alpha.0 + leaderElection: + leaderElect: true cloudProvider: aws clusterDNSDomain: cluster.local configBase: memfs://clusters.example.com/minimal-ipv6.example.com diff --git a/tests/integration/update_cluster/minimal-ipv6-cilium/data/aws_s3_bucket_object_cluster-completed.spec_content b/tests/integration/update_cluster/minimal-ipv6-cilium/data/aws_s3_bucket_object_cluster-completed.spec_content index 34edf63875..6c716e1825 100644 --- a/tests/integration/update_cluster/minimal-ipv6-cilium/data/aws_s3_bucket_object_cluster-completed.spec_content +++ b/tests/integration/update_cluster/minimal-ipv6-cilium/data/aws_s3_bucket_object_cluster-completed.spec_content @@ -25,6 +25,8 @@ spec: clusterName: minimal-ipv6.example.com configureCloudRoutes: false image: k8s.gcr.io/provider-aws/cloud-controller-manager:v1.21.0-alpha.0 + leaderElection: + leaderElect: true cloudProvider: aws clusterDNSDomain: cluster.local configBase: memfs://clusters.example.com/minimal-ipv6.example.com diff --git a/tests/integration/update_cluster/minimal-ipv6-private/data/aws_s3_bucket_object_cluster-completed.spec_content b/tests/integration/update_cluster/minimal-ipv6-private/data/aws_s3_bucket_object_cluster-completed.spec_content index 0b7f9dc4a3..b2dc388688 100644 --- a/tests/integration/update_cluster/minimal-ipv6-private/data/aws_s3_bucket_object_cluster-completed.spec_content +++ b/tests/integration/update_cluster/minimal-ipv6-private/data/aws_s3_bucket_object_cluster-completed.spec_content @@ -25,6 +25,8 @@ spec: clusterName: minimal-ipv6.example.com configureCloudRoutes: false image: k8s.gcr.io/provider-aws/cloud-controller-manager:v1.23.0-alpha.0 + leaderElection: + leaderElect: true cloudProvider: aws clusterDNSDomain: cluster.local configBase: memfs://clusters.example.com/minimal-ipv6.example.com diff --git a/tests/integration/update_cluster/minimal-ipv6/data/aws_s3_bucket_object_cluster-completed.spec_content b/tests/integration/update_cluster/minimal-ipv6/data/aws_s3_bucket_object_cluster-completed.spec_content index 27af2f5242..f082da25bd 100644 --- a/tests/integration/update_cluster/minimal-ipv6/data/aws_s3_bucket_object_cluster-completed.spec_content +++ b/tests/integration/update_cluster/minimal-ipv6/data/aws_s3_bucket_object_cluster-completed.spec_content @@ -25,6 +25,8 @@ spec: clusterName: minimal-ipv6.example.com configureCloudRoutes: false image: k8s.gcr.io/provider-aws/cloud-controller-manager:v1.21.0-alpha.0 + leaderElection: + leaderElect: true cloudProvider: aws clusterDNSDomain: cluster.local configBase: memfs://clusters.example.com/minimal-ipv6.example.com