From ff57f07a371fba61aac76daf1c457a69be121413 Mon Sep 17 00:00:00 2001 From: Daniel Lundin Date: Fri, 19 Apr 2019 17:18:44 +0200 Subject: [PATCH] add ksecret utility script --- bin/ksecret | 12 ++++++++++++ 1 file changed, 12 insertions(+) create mode 100755 bin/ksecret diff --git a/bin/ksecret b/bin/ksecret new file mode 100755 index 0000000..6b93c24 --- /dev/null +++ b/bin/ksecret @@ -0,0 +1,12 @@ +#!/bin/bash +set -e +if [ "$#" -lt 2 ]; then + echo "Usage: ${0} [kubectl options] secret key" + exit 0 +fi + +secret="${@:$(($#-1)):1}" +key="${@:$(($#)):1}" + +set -- "${@:1:$(($#-2))}" +kubectl get secret "$@" "${secret}" -o "go-template={{index .data \"${key}\"}}" | base64 -d