Rolling Back the Certificate Change
If rotation fails, you must restore the previous configuration. The old secret remains available because the procedure does not modify it.
To roll back the certificate change:
-
Revert the rotation commit. From a clean working copy on the same branch, run:
cd "$ROTATE_REPO" git status --short git revert --no-edit "$ROTATE_COMMIT" git push origin "HEAD:$ROTATE_BRANCH" -
Reconcile the previous configuration:
flux reconcile kustomization infrastructure -n "$ROTATE_NS" \ --with-source --timeout=30m flux reconcile helmrelease nginx -n "$ROTATE_NS" --timeout=30m kubectl -n "$ROTATE_NS" wait \ helmrelease.helm.toolkit.fluxcd.io/nginx \ --for=condition=Ready --timeout=30m -
Verify that the endpoint uses the previous certificate:
kubectl -n "$ROTATE_NS" get service "$ROTATE_SVC" \ -o go-template='{{index .metadata.annotations "service.beta.kubernetes.io/oci-load-balancer-tls-secret"}}{{"\n"}}' openssl s_client -connect "${ROTATE_HOST}:443" \ -servername "$ROTATE_HOST" </dev/null 2>/dev/null | openssl x509 -noout -fingerprint -sha256 -subject -issuer -serial -datesVerify that the annotation names the old secret and the served fingerprint matches the previous certificate.
-
Verify the environment after rollback.
Confirm that the Service UID, ClusterIP, external address, and OCI Load Balancer OCID match the values recorded before rotation. If you also updated protected SCM environment metadata, restore its previous values.
Record the operation as rolled back. Retain the new secret for investigation until cleanup is approved and a reference check confirms that no resource uses it.
Note: Remove protected temporary files and any decrypted private-key copy after verification and rollback retention requirements are satisfied.