Skip to content

Commit 50ac633

Browse files
Add logs for secret update.
1 parent 0527703 commit 50ac633

File tree

3 files changed

+5
-3
lines changed

3 files changed

+5
-3
lines changed

controllers/secretproviderclasspodstatus_controller.go

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -418,9 +418,11 @@ func (r *SecretProviderClassPodStatusReconciler) createOrUpdateK8sSecret(ctx con
418418
if apierrors.IsAlreadyExists(err) {
419419
klog.InfoS("Secret is already there", "secret", klog.ObjectRef{Namespace: namespace, Name: name})
420420
err := r.writer.Update(ctx, secret)
421-
if err == nil {
421+
if err != nil {
422422
klog.Errorf("Unable to update secret", "secret", klog.ObjectRef{Namespace: namespace, Name: name})
423423
return err
424+
} else {
425+
klog.InfoS("successfully updated Kubernetes secret", "secret", klog.ObjectRef{Namespace: namespace, Name: name})
424426
}
425427
return nil
426428
}

controllers/secretproviderclasspodstatus_controller_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -173,7 +173,7 @@ func TestCreateOrUpdateK8sSecret(t *testing.T) {
173173
client := fake.NewClientBuilder().WithScheme(scheme).WithObjects(initObjects...).Build()
174174
reconciler := newReconciler(client, scheme, "node1")
175175

176-
// secret already exists
176+
// secret already exists, just update it.
177177
err = reconciler.createOrUpdateK8sSecret(context.TODO(), "my-secret", "default", nil, labels, annotations, corev1.SecretTypeOpaque)
178178
g.Expect(err).NotTo(HaveOccurred())
179179

test/bats/e2e-provider.bats

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -431,7 +431,7 @@ export VALIDATE_TOKENS_AUDIENCE=$(get_token_requests_audience)
431431
kubectl create ns metrics
432432
local curl_pod_name=curl-$(openssl rand -hex 5)
433433
kubectl run ${curl_pod_name} -n metrics --image=curlimages/curl:7.75.0 --labels="test=metrics" -- tail -f /dev/null
434-
kubectl wait -n metrics --for=condition=Ready --timeout=60s pod ${curl_pod_name}
434+
kubectl wait -n metrics --for=condition=Ready --timeout=120s pod ${curl_pod_name}
435435
for pod_ip in $(kubectl get pod -n kube-system -l app=secrets-store-csi-driver -o jsonpath="{.items[0].status.podIP}")
436436
do
437437
run kubectl exec ${curl_pod_name} -n metrics -- curl http://${pod_ip}:8095/metrics

0 commit comments

Comments
 (0)