k8s-scripts icon indicating copy to clipboard operation
k8s-scripts copied to clipboard

whitelist certs that should never be removed

Open diegodurante opened this issue 4 years ago • 1 comments

I am opening this as a "issue" but in reality is a little suggestion that maybe can be helpful.

Regarding this TO-DO: https://github.com/richstokes/k8s-scripts/blob/d294cf9feeb08d6cb91687fab9f8be88a4c5b6b2/clean-orphaned-secrets-cert-manager/clean-orphans.sh#L12

Here is how I am managing it adding some code from line 32:

...

# Remove from array special secrets
SPECIALS=(one-special-tls other-special-tls)
for special in "${SPECIALS[@]}"; do
  for i in "${!ORPHANS[@]}"; do
    if [[ ${ORPHANS[i]} = $special ]]; then
      unset 'ORPHANS[i]'
    fi
  done
done

...

😉

diegodurante avatar May 27 '21 13:05 diegodurante

Appreciate the info! If you like, feel free to open a PR and include those. I don't do much with K8s currently so this has gone a bit stale :-)

richstokes avatar May 27 '21 16:05 richstokes