From c33c5b182efdca7b2a816dc5927542ef0f924d12 Mon Sep 17 00:00:00 2001 From: jiangpengcheng Date: Mon, 6 May 2024 16:57:47 +0800 Subject: [PATCH] Fix ci --- .ci/tests/integration/cases/mongodb-source/manifests.yaml | 2 +- .ci/tests/integration/cases/mongodb-source/mongodb-dbz.yaml | 4 ++-- controllers/common.go | 3 +++ controllers/spec/vpa.go | 3 +++ 4 files changed, 9 insertions(+), 3 deletions(-) diff --git a/.ci/tests/integration/cases/mongodb-source/manifests.yaml b/.ci/tests/integration/cases/mongodb-source/manifests.yaml index 954b936c..188a1d1f 100644 --- a/.ci/tests/integration/cases/mongodb-source/manifests.yaml +++ b/.ci/tests/integration/cases/mongodb-source/manifests.yaml @@ -23,7 +23,7 @@ spec: cpu: "0.1" memory: 1G sourceConfig: - mongodb.hosts: rs0/mongo-dbz-0.mongo.default.svc.cluster.local:27017,rs0/mongo-dbz-1.mongo.default.svc.cluster.local:27017,rs0/mongo-dbz-2.mongo.default.svc.cluster.local:27017 + mongodb.hosts: rs0/mongo-dbz-0.mongo.default.svc.cluster.local:27017 mongodb.name: dbserver1 mongodb.user: debezium mongodb.password: dbz diff --git a/.ci/tests/integration/cases/mongodb-source/mongodb-dbz.yaml b/.ci/tests/integration/cases/mongodb-source/mongodb-dbz.yaml index d869a572..7c1f3238 100644 --- a/.ci/tests/integration/cases/mongodb-source/mongodb-dbz.yaml +++ b/.ci/tests/integration/cases/mongodb-source/mongodb-dbz.yaml @@ -35,7 +35,7 @@ spec: matchLabels: role: mongo serviceName: "mongo" - replicas: 3 + replicas: 1 template: metadata: labels: @@ -44,7 +44,7 @@ spec: terminationGracePeriodSeconds: 10 containers: - name: mongo - image: debezium/example-mongodb:2.7 + image: debezium/example-mongodb:2.6 env: - name: MONGODB_USER value: "debezium" diff --git a/controllers/common.go b/controllers/common.go index 6ff1d167..636848b5 100644 --- a/controllers/common.go +++ b/controllers/common.go @@ -121,6 +121,9 @@ func observeVPA(ctx context.Context, r client.Reader, name types.NamespacedName, spec.UpdateVPAUpdatePolicy(updatePolicy, vpaSpec.ResourceUnit) resourcePolicy := vpaSpec.ResourcePolicy containerName := spec.GetVPAContainerName(&vpa.ObjectMeta) + if resourcePolicy == nil { + resourcePolicy = &vpav1.PodResourcePolicy{} + } spec.UpdateResourcePolicy(resourcePolicy, containerName) if !reflect.DeepEqual(updatePolicy, vpa.Spec.UpdatePolicy) || !reflect.DeepEqual(resourcePolicy, vpa.Spec.ResourcePolicy) { diff --git a/controllers/spec/vpa.go b/controllers/spec/vpa.go index 51c79e5b..c516e8ed 100644 --- a/controllers/spec/vpa.go +++ b/controllers/spec/vpa.go @@ -34,6 +34,9 @@ func MakeVPA(objectMeta *metav1.ObjectMeta, targetRef *autov2.CrossVersionObject objectMeta.Labels[LabelCustomResourceUnit] = "true" } resourcePolicy := vpa.ResourcePolicy + if resourcePolicy == nil { + resourcePolicy = &vpav1.PodResourcePolicy{} + } UpdateResourcePolicy(resourcePolicy, containerName) return &vpav1.VerticalPodAutoscaler{