From 0e0069b8770fcfadef8b3c082e5e311d26d5ed31 Mon Sep 17 00:00:00 2001 From: zhujian Date: Mon, 18 Sep 2023 08:15:37 +0000 Subject: [PATCH] set work agent status-sync-interval when the replica is 1 Signed-off-by: zhujian --- .../klusterlet/management/klusterlet-agent-deployment.yaml | 1 + manifests/klusterlet/management/klusterlet-work-deployment.yaml | 1 + .../klusterletcontroller/klusterlet_controller_test.go | 2 +- test/integration/operator/klusterlet_test.go | 2 +- 4 files changed, 4 insertions(+), 2 deletions(-) diff --git a/manifests/klusterlet/management/klusterlet-agent-deployment.yaml b/manifests/klusterlet/management/klusterlet-agent-deployment.yaml index 27ed50ec2..eccdccfc7 100644 --- a/manifests/klusterlet/management/klusterlet-agent-deployment.yaml +++ b/manifests/klusterlet/management/klusterlet-agent-deployment.yaml @@ -71,6 +71,7 @@ spec: - "--terminate-on-files=/spoke/hub-kubeconfig/kubeconfig" {{if eq .Replica 1}} - "--disable-leader-election" + - "--status-sync-interval=60s" {{end}} {{if gt .ClientCertExpirationSeconds 0}} - "--client-cert-expiration-seconds={{ .ClientCertExpirationSeconds }}" diff --git a/manifests/klusterlet/management/klusterlet-work-deployment.yaml b/manifests/klusterlet/management/klusterlet-work-deployment.yaml index c7b7f6970..fb74c465f 100644 --- a/manifests/klusterlet/management/klusterlet-work-deployment.yaml +++ b/manifests/klusterlet/management/klusterlet-work-deployment.yaml @@ -67,6 +67,7 @@ spec: - "--terminate-on-files=/spoke/hub-kubeconfig/kubeconfig" {{if eq .Replica 1}} - "--disable-leader-election" + - "--status-sync-interval=60s" {{end}} env: - name: POD_NAME diff --git a/pkg/operator/operators/klusterlet/controllers/klusterletcontroller/klusterlet_controller_test.go b/pkg/operator/operators/klusterlet/controllers/klusterletcontroller/klusterlet_controller_test.go index 6889d3a1e..5527c694a 100644 --- a/pkg/operator/operators/klusterlet/controllers/klusterletcontroller/klusterlet_controller_test.go +++ b/pkg/operator/operators/klusterlet/controllers/klusterletcontroller/klusterlet_controller_test.go @@ -428,7 +428,7 @@ func assertWorkDeployment(t *testing.T, actions []clienttesting.Action, verb, cl expectArgs = append(expectArgs, "--terminate-on-files=/spoke/hub-kubeconfig/kubeconfig") if *deployment.Spec.Replicas == 1 { - expectArgs = append(expectArgs, "--disable-leader-election") + expectArgs = append(expectArgs, "--disable-leader-election", "--status-sync-interval=60s") } if !equality.Semantic.DeepEqual(args, expectArgs) { diff --git a/test/integration/operator/klusterlet_test.go b/test/integration/operator/klusterlet_test.go index 0eceafa4c..014467e06 100644 --- a/test/integration/operator/klusterlet_test.go +++ b/test/integration/operator/klusterlet_test.go @@ -498,7 +498,7 @@ var _ = ginkgo.Describe("Klusterlet", func() { gomega.Expect(len(actual.Spec.Template.Spec.Containers)).Should(gomega.Equal(1)) // klusterlet has no condition, replica is 0 gomega.Expect(actual.Status.Replicas).Should(gomega.Equal(int32(0))) - gomega.Expect(len(actual.Spec.Template.Spec.Containers[0].Args)).Should(gomega.Equal(7)) + gomega.Expect(len(actual.Spec.Template.Spec.Containers[0].Args)).Should(gomega.Equal(8)) return actual.Spec.Template.Spec.Containers[0].Args[2] != "--spoke-cluster-name=cluster2" }, eventuallyTimeout, eventuallyInterval).Should(gomega.BeTrue())