diff --git a/deployment_files/deploy.yaml b/deployment_files/deploy.yaml index 37f02a6..c4ace90 100644 --- a/deployment_files/deploy.yaml +++ b/deployment_files/deploy.yaml @@ -42,4 +42,7 @@ spec: memory: "100Mi" imagePullPolicy: Always image: registry.gitlab.com/unboundsoftware/dancefinder/geo-service:${COMMIT} + envFrom: + - secretRef: + name: google-maps-api restartPolicy: Always diff --git a/deployment_files/secrets.sh b/deployment_files/secrets.sh new file mode 100755 index 0000000..565551e --- /dev/null +++ b/deployment_files/secrets.sh @@ -0,0 +1,17 @@ +#!/usr/bin/env bash +set -euo pipefail + +source ${BUILD_TOOLS_PATH}/scripts/kubernetes.sh + +ENVIRONMENT="${1?usage: secrets.sh }" +LASTPASS_SHARE="envconfig\\${ENVIRONMENT}" + +kube_cmd=$(kubernetes:get_command ${ENVIRONMENT}) + +SECRET_NAME="google-maps-api" +API_KEY=$(lpass show --name "${LASTPASS_SHARE}/${SECRET_NAME}" --notes) + +$kube_cmd delete secret ${SECRET_NAME,,} &> /dev/null || true +$kube_cmd create secret generic \ + ${SECRET_NAME,,} \ + --from-literal=MAPS_API_KEY="${API_KEY}"