Skip to content

Commit

Permalink
External Secret使うようにしてみる
Browse files Browse the repository at this point in the history
  • Loading branch information
na2na-p committed Aug 31, 2024
1 parent ca74c77 commit 20b2537
Show file tree
Hide file tree
Showing 6 changed files with 32 additions and 11 deletions.
2 changes: 1 addition & 1 deletion .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,5 @@ charset = utf-8
insert_final_newline = true
end_of_line = lf

[*.yml]
[*.{yml,yaml}]
indent_style = space
1 change: 1 addition & 0 deletions infra/k8s/helm/templates/jetdisc/configMap.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,4 @@ metadata:
data:
BOT_NAME: {{ .Values.configMap.botName | quote }}
STORE_DRIVER: {{ .Values.configMap.storeDriver | quote }}
SET_COMMANDS_TARGET_SERVERS: {{ .Values.configMap.setCommandsTargetServers }}
2 changes: 1 addition & 1 deletion infra/k8s/helm/templates/jetdisc/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ spec:
imagePullPolicy: {{ .Values.image.pullPolicy }}
envFrom:
- secretRef:
name: jetdisc-secret
name: {{ .Values.externalSecrets.targetName }}
- configMapRef:
name: jetdisc-configmap
resources: {{- toYaml .Values.resources | nindent 12 }}
Expand Down
19 changes: 19 additions & 0 deletions infra/k8s/helm/templates/jetdisc/externalsecret.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
{{ if .Values.externalSecrets.enabled }}
apiVersion: external-secrets.io/v1beta1
kind: ExternalSecret
metadata:
name: jetdisc-external-secret
spec:
refreshInterval: {{ .Values.externalSecrets.refreshInterval }}
secretStoreRef:
kind: {{ .Values.externalSecrets.secretStoreRef.kind }}
name: {{ .Values.externalSecrets.secretStoreRef.name }}
namespace: {{ .Values.externalSecrets.secretStoreRef.namespace }}
target:
name: {{ .Values.externalSecrets.targetName }}
creationPolicy: {{ .Values.externalSecrets.creationPolicy }}
data:
- secretKey: DISCORD_APP_TOKEN
remoteRef:
key: jetdisc_discord_app_token
{{ end }}
8 changes: 0 additions & 8 deletions infra/k8s/helm/templates/jetdisc/secret.yaml

This file was deleted.

11 changes: 10 additions & 1 deletion infra/k8s/helm/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,11 @@ image:

secrets:
discordAppToken: ""
setCommandsTargetServers: ""

configMap:
botName: ""
storeDriver: "local"
setCommandsTargetServers: ""

resources:
limits:
Expand All @@ -21,3 +21,12 @@ resources:
requests:
cpu: 250m
memory: 128Mi

externalSecrets:
enabled: true
secretStoreRef:
kind: ClusterSecretStore
name: secretstore
targetName: jetdisc-secret
creationPolicy: Owner
refreshInterval: 1h

0 comments on commit 20b2537

Please sign in to comment.