Skip to content

Commit

Permalink
[SAPBTPCFS-15469] Update Service Instance on change of 'parametersFro…
Browse files Browse the repository at this point in the history
…m' secret
  • Loading branch information
I065450 committed Dec 5, 2024
1 parent 7953510 commit ef63f3e
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 11 deletions.
7 changes: 2 additions & 5 deletions config/samples/services_v1_serviceinstance.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,14 @@ apiVersion: services.cloud.sap.com/v1
kind: ServiceInstance
metadata:
name: sample-instance-1
labels:
"services.cloud.sap.com/secretKeyRef-my-secret": "true"
"services.cloud.sap.com/secretKeyRef-my-secret1": "true"
spec:
serviceOfferingName: service-manager
servicePlanName: subaccount-audit
parametersFrom:
- secretKeyRef:
name: my-secret
key: secret-paramete
key: secret-parameter
- secretKeyRef:
name: my-secret1
key: secret-paramete
key: secret-parameter

8 changes: 2 additions & 6 deletions controllers/serviceinstance_controller_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1291,9 +1291,7 @@ var _ = Describe("ServiceInstance controller", func() {
instanceSpec.SubscribeToSecretChanges = pointer.Bool(true)
serviceInstance = createInstance(ctx, fakeInstanceName, instanceSpec, nil, true)
smInstance, _, _, _, _, _ := fakeClient.ProvisionArgsForCall(0)
params := smInstance.Parameters
Expect(params).To(ContainSubstring("\"key\":\"value\""))
Expect(params).To(ContainSubstring("\"secret-key\":\"secret-value\""))
checkParams(string(smInstance.Parameters), []string{"\"key\":\"value\"", "\"secret-key\":\"secret-value\""})

checkSecretAnnotationsAndLabels(ctx, k8sClient, paramsSecret, []*v1.ServiceInstance{serviceInstance})

Expand All @@ -1306,9 +1304,7 @@ var _ = Describe("ServiceInstance controller", func() {
}, timeout*3, interval).Should(BeTrue(), "expected condition was not met")

_, smInstance, _, _, _, _, _ = fakeClient.UpdateInstanceArgsForCall(0)
params = smInstance.Parameters
Expect(params).To(ContainSubstring("\"key\":\"value\""))
Expect(params).To(ContainSubstring("\"secret-key\":\"new-secret-value\""))
checkParams(string(smInstance.Parameters), []string{"\"key\":\"value\"", "\"secret-key\":\"new-secret-value\""})
deleteAndWait(ctx, serviceInstance)
checkSecretAnnotationsAndLabels(ctx, k8sClient, paramsSecret, []*v1.ServiceInstance{})
})
Expand Down

0 comments on commit ef63f3e

Please sign in to comment.