Skip to content

Commit

Permalink
Use secrets from 1Password in Kubernetes
Browse files Browse the repository at this point in the history
  • Loading branch information
dwrss committed Dec 9, 2023
1 parent 3227261 commit 32ce84a
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 10 deletions.
9 changes: 1 addition & 8 deletions .github/workflows/docker-publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -144,14 +144,6 @@ jobs:
run: echo "RELEASE_VERSION=`git describe --tags`" >> $GITHUB_ENV
continue-on-error: true

- name: Set secrets
uses: azure/k8s-create-secret@v4
with:
namespace: 'discord-bots'
secret-name: 'baby-botto'
secret-type: 'Opaque'
string-data: '{"MOTTOBOTTO_DISCORD_TOKEN":"${{ secrets.DISCORD_TOKEN }}", "MOTTOBOTTO_AIRTABLE_BASE": "${{ secrets.AIRTABLE_BASE }}", "MOTTOBOTTO_AIRTABLE_KEY": "${{ secrets.AIRTABLE_KEY }}"}'

- name: Substitute env into templates
run: |
cat kubernetes/babybotto-config.tpl.yaml | envsubst > kubernetes/babybotto-config.yaml &&
Expand All @@ -165,6 +157,7 @@ jobs:
MOTTOBOTTO_WAVE_ON_TAG: ${{ vars.WAVE_ON_TAG }}
MOTTOBOTTO_RANDOM_MOTTO_SOURCE_VIEW: ${{ vars.RANDOM_MOTTO_SOURCE_VIEW }}
MOTTOBOTTO_MAINTAINER_IDS: ${{ vars.MAINTAINER_IDS }}
AIRTABLE_BASE: ${{ vars.AIRTABLE_BASE }}
MOTTOBOTTO_VERSION: ${{ env.RELEASE_VERSION }}
IMAGE_NAME: ${{ env.IMAGE_NAME }}

Expand Down
3 changes: 2 additions & 1 deletion kubernetes/babybotto-config.tpl.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,5 @@ data:
MOTTOBOTTO_MINIMUM_RANDOM_INTERVAL_MINUTES_PER_USER: "${MOTTOBOTTO_MINIMUM_RANDOM_INTERVAL_MINUTES_PER_USER}"
MOTTOBOTTO_WAVE_ON_TAG: "${MOTTOBOTTO_WAVE_ON_TAG}"
MOTTOBOTTO_RANDOM_MOTTO_SOURCE_VIEW: "${MOTTOBOTTO_RANDOM_MOTTO_SOURCE_VIEW}"
MOTTOBOTTO_MAINTAINER_IDS: "${MOTTOBOTTO_MAINTAINER_IDS}"
MOTTOBOTTO_MAINTAINER_IDS: "${MOTTOBOTTO_MAINTAINER_IDS}"
MOTTOBOTTO_AIRTABLE_BASE: "${AIRTABLE_BASE}"
6 changes: 5 additions & 1 deletion kubernetes/deployment.tpl.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,10 @@ metadata:
app.kubernetes.io/name: MottoBotto
app.kubernetes.io/instance: BabyBotto
app.kubernetes.io/version: ${MOTTOBOTTO_VERSION}
annotations:
operator.1password.io/item-path: "vaults/du4s3tc4ab7wnrijmb5fxjpbse/items/BabyBotto Credentials"
operator.1password.io/item-name: "babybotto-credentials"
operator.1password.io/auto-restart: "true"
spec:
replicas: 1
selector:
Expand All @@ -27,7 +31,7 @@ spec:
- configMapRef:
name: baby-botto
- secretRef:
name: baby-botto
name: babybotto-credentials
env:
- name: MOTTOBOTTO_VERSION
value: ${MOTTOBOTTO_VERSION}
Expand Down

0 comments on commit 32ce84a

Please sign in to comment.