Last active
July 19, 2021 13:30
-
-
Save pancudaniel7/bb2c5818bf277ab1234378805a57733e to your computer and use it in GitHub Desktop.
Script for creating kubeseal sealedSecret from file
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Params | |
# 1 - secret name | |
# 2 - file name | |
# 3 - secret yaml file name | |
# 4 - sealedSecret yaml file name | |
oc delete secret ${1:-ca-crt}; | |
oc create secret generic ${1:-ca-crt} --from-file ${2:-ca.crt} && \ | |
kubeseal --fetch-cert > cert.pem && \ | |
oc get secret ${1:-ca-crt} -o yaml > ${3:-cacert.yaml} && \ | |
kubeseal < ${3:-cacert.yaml} --cert cert.pem -o yaml > ${4:-cacertsealed.yaml} && \ | |
oc delete secret ${1:-ca-crt} && \ | |
rm -rf ${3:-cacert.yaml} | |
cat ${4:-cacertsealed.yaml} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment