From d4b5742b5d872ee92ffabe00c039607e584ffe9c Mon Sep 17 00:00:00 2001 From: Jiahui Feng Date: Wed, 26 Jan 2022 11:00:00 -0800 Subject: [PATCH 1/3] always enable Leader Election for AWS cloud-controller-manager --- pkg/model/components/awscloudcontrollermanager.go | 4 ++++ 1 file changed, 4 insertions(+) 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 From 0dfa8614b123435c0d6b4805e06dd7b594144b13 Mon Sep 17 00:00:00 2001 From: Jiahui Feng Date: Fri, 28 Jan 2022 11:00:00 -0800 Subject: [PATCH 2/3] always enable Leader Election for GCP cloud-controller-manager --- pkg/model/components/gcpcloudcontrollermanager.go | 5 +++++ 1 file changed, 5 insertions(+) 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) From a0fe9ee638a9c94ff5bda93d213b0cf9c92b76ca Mon Sep 17 00:00:00 2001 From: Jiahui Feng Date: Mon, 31 Jan 2022 11:00:00 -0800 Subject: [PATCH 3/3] generated: ./hack/update-expected.sh --- .../data/aws_s3_bucket_object_cluster-completed.spec_content | 2 ++ .../data/aws_s3_bucket_object_cluster-completed.spec_content | 2 ++ .../data/aws_s3_bucket_object_cluster-completed.spec_content | 2 ++ .../data/aws_s3_bucket_object_cluster-completed.spec_content | 2 ++ .../data/aws_s3_bucket_object_cluster-completed.spec_content | 2 ++ .../data/aws_s3_bucket_object_cluster-completed.spec_content | 2 ++ .../data/aws_s3_bucket_object_cluster-completed.spec_content | 2 ++ .../data/aws_s3_bucket_object_cluster-completed.spec_content | 2 ++ 8 files changed, 16 insertions(+) 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 c487cff70b..69a0164459 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 a789b6687d..5cd29a9775 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 e4f7ab49af..e4d059ba8c 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