Skip to content

Instantly share code, notes, and snippets.

@welshstew
Last active July 7, 2024 08:40
Show Gist options
  • Save welshstew/ed30310a96103aa5c665768fda680c64 to your computer and use it in GitHub Desktop.
Save welshstew/ed30310a96103aa5c665768fda680c64 to your computer and use it in GitHub Desktop.
use jq to pull base 64 things out of a secret and construct them to file
#pull a base64 encoded files out of a kubernetes json secret
oc get secrets/broker-client-secret -o json | jq -r '.data."client.ts"' | base64 -d > client.ts
oc get secrets/broker-server-secret -o json | jq -r '.data."broker.ks"' | base64 -d > broker.ks
oc get secrets/broker-server-secret -o json | jq -r '.data."broker.ts"' | base64 -d > broker.ts
#replace base64 content in a secret - and save to file
THINGY=$(base64 newbroker.ks)
oc get secrets/il3-broker-server-secret -o json | jq -r --arg THINGY $THINGY '.data."broker.ks" = $THINGY' > my-new-secret.json
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment