Skip to content

Instantly share code, notes, and snippets.

@dschaaff
Last active October 30, 2022 18:30
Show Gist options
  • Save dschaaff/95bb21604139b8b3da27912050cc2347 to your computer and use it in GitHub Desktop.
Save dschaaff/95bb21604139b8b3da27912050cc2347 to your computer and use it in GitHub Desktop.
Force a renewal cert-manager issued certificates in kubernetes.
#!/bin/bash
set -euo pipefail
namespaces="$(kubectl get namespaces -o json | jq -r '.items[] | .metadata.name')"
for name in $namespaces
do
certificates="$(kubectl get certificates -n $name -o json | jq -r '.items[] | .metadata.name')"
for cert in $certificates
do
kubectl patch certificate "$cert" -n "$name" -p '[{"op": "add", "path": "/spec/renewBefore", "value":"2159h59m30s"}]' --type='json'
#kubectl patch certificate "$cert" -n "$name" -p '[{"op": "remove", "path": "/spec/renewBefore"}]' --type='json'
done
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment