diff --git a/tools/kubernetes/cells/templates/configmap.yaml b/tools/kubernetes/cells/templates/configmap.yaml index f4485714ea..52adc46d2a 100644 --- a/tools/kubernetes/cells/templates/configmap.yaml +++ b/tools/kubernetes/cells/templates/configmap.yaml @@ -85,11 +85,17 @@ data: EXIT_STATUS=$? if echo \"$VAULT_STATUS\" | grep '"initialized": false'; then - vault operator init -n 1 -t 1 >> ${OUTPUT?} + if echo \"$VAULT_STATUS\" | grep '"type": "shamir"'; then + vault operator init -n 1 -t 1 >> ${OUTPUT?} + + unseal=$(cat ${OUTPUT?} | grep "Unseal Key 1:" | sed -e "s/Unseal Key 1: //g") + vault operator unseal ${unseal?} + else + vault operator init >> ${OUTPUT?} + fi + root=$(cat ${OUTPUT?} | grep "Initial Root Token:" | sed -e "s/Initial Root Token: //g") - unseal=$(cat ${OUTPUT?} | grep "Unseal Key 1:" | sed -e "s/Unseal Key 1: //g") - vault operator unseal ${unseal?} vault login -no-print ${root?} vault secrets enable -version=2 -path=secret kv