Secrets diff

From UVOO Tech Wiki
Revision as of 18:52, 12 February 2025 by Busk (talk | contribs) (Created page with "# Secrets diff and create ``` if ! kubectl get secret netbox-tls -o yaml | grep -q "$(base64 < tls.crt)"; then kubectl delete secret netbox-tls --ignore-not-found kubectl...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

Secrets diff and create

if ! kubectl get secret netbox-tls -o yaml | grep -q "$(base64 < tls.crt)"; then
  kubectl delete secret netbox-tls --ignore-not-found
  kubectl create secret tls netbox-tls --cert=tls.crt --key=tls.key
fi

kubectl get secret netbox-tls -o yaml | diff - <(kubectl create secret tls netbox-tls --cert=tls.crt --key=tls.key --dry-run=client -o yaml) || \
kubectl delete secret netbox-tls --ignore-not-found && \
kubectl create secret tls netbox-tls --cert=tls.crt --key=tls.key