Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use secrets from 1Password in Kubernetes #289

Merged
merged 1 commit into from
Dec 9, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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