Skip to content

Commit

Permalink
add dotenv2setenv hack
Browse files Browse the repository at this point in the history
Former-commit-id: 718b9dc6dd73f3f7f1b0d14706776099eb09dbce [formerly a84a40c9ec9bfdd17391fc043a8b7b3a6c18ac38] [formerly cb792c058c293ad3b9545f73d9afa39d202836c8 [formerly 4dbd269]]
Former-commit-id: 7a64d0d05b844c6da003d63decd9a0ef442383f5 [formerly 08ebd8f3e70890c8c22165348570a33d6394faaa]
Former-commit-id: be93dc43b76e24cc853ca10a66991a6134f7404a
  • Loading branch information
onedr0p committed Aug 15, 2020
1 parent 9922f1c commit d64f1cf
Show file tree
Hide file tree
Showing 6 changed files with 20 additions and 28 deletions.
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: apply-templates
name: manifest-templates
on:
push:
branches:
Expand All @@ -14,7 +14,7 @@ env:
KUBECONFIG: "./kubeconfig"
KUBECTL_VERSION: "1.18.8"
ENVSUBST_VERSION: "1.2.0"

TASK_VERSION: "2.8.1"

jobs:
main:
Expand All @@ -28,7 +28,9 @@ jobs:
sudo curl -sL -o /usr/local/bin/kubectl https://storage.googleapis.com/kubernetes-release/release/v${KUBECTL_VERSION}/bin/linux/amd64/kubectl
sudo chmod +x /usr/local/bin/kubectl
sudo curl -sL -o /usr/local/bin/envsubst https://github.com/a8m/envsubst/releases/download/v${ENVSUBST_VERSION}/envsubst-Linux-x86_64
sudo chmod +x /usr/local/bin/envsubst
sudo chmod +x /usr/local/bin/envsubst
sudo curl -sL https://github.com/go-task/task/releases/download/v${TASK_VERSION}/task_linux_amd64.tar.gz | tar xz
sudo mv task /usr/local/bin/task && rm task_linux_amd64.tar.gz
- name: Unlock secrets
env:
GIT_CRYPT_KEY: ${{ secrets.GIT_CRYPT_KEY }}
Expand All @@ -38,13 +40,7 @@ jobs:
rm ./git-crypt-key
- name: Fake environment variables
run: |
./hack/dotenv2setenv.sh .cluster-secrets.sample.env
./hack/dotenv2setenv.sh ./.cluster-secrets.sample.env
- name: Apply manifests
run: |
source .cluster-secrets.env
for file in ./deployments/_templates/*.tpl
do
if output=$(envsubst -no-unset -no-empty < "$file"); then
printf '%s' "$output" | kubectl apply -f -
fi
done
task apply-manifest-templates
8 changes: 4 additions & 4 deletions .github/workflows/sealed-secrets.yml
Original file line number Diff line number Diff line change
Expand Up @@ -49,15 +49,15 @@ jobs:
echo "$GIT_CRYPT_KEY" | base64 -d > ./git-crypt-key
git-crypt unlock ./git-crypt-key
rm ./git-crypt-key
- name: Fake environment variables
run: |
./hack/dotenv2setenv.sh .cluster-secrets.sample.env
- name: Generate Secrets
run: |
./hack/secrets.sh
- name: Git status
run: |
git status
- name: Validate secrets
run: |
kubeseal --validate < ./deployments/zz_generated_secrets.yaml --controller-name=sealed-secrets
Expand Down
22 changes: 9 additions & 13 deletions Taskfile.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,36 +4,32 @@ tasks:
generate:
desc: Generate secrets and sample env
cmds:
- task: generate-secrets
- task: generate-sealed-secrets
- task: generate-sample-env
apply:
desc: Apply manifests and secrets to the Kubernetes cluster
cmds:
- task: apply-templates
- task: apply-secrets
- task: apply-manifest-templates
- task: apply-sealed-secrets
flux-sync:
desc: Force cluster to run flux
cmds:
- fluxctl --k8s-fwd-ns=flux sync
generate-secrets:
generate-sealed-secrets:
desc: Generate secrets
cmds:
- ./hack/secrets.sh
- ./hack/generate-sealed-secrets.sh
preconditions:
- test -f .cluster-secrets.env
# status:
# - test -f ./deployments/zz_generated_secrets.yaml
generate-sample-env:
desc: Generate sample env
cmds:
- ./hack/sample-env.sh
# status:
# - test -f .cluster-secrets.sample.env
apply-templates:
- ./hack/generate-sample-env.sh
apply-manifest-templates:
desc: Apply manifests to the Kubernetes cluster
cmds:
- ./hack/templates.sh
apply-secrets:
- ./hack/apply-manifest-templates.sh
apply-sealed-secrets:
desc: Apply secrets to the Kubernetes cluster
cmds:
- kubectl apply -f ./deployments/zz_generated_secrets.yaml
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.

0 comments on commit d64f1cf

Please sign in to comment.