Skip to content

Commit c4d8c0a

Browse files
authored
feat(dbcp): add tokens as secrets or existing (#4)
* feat(dbcp): add tokens as secrets or existing * remove comment * bump chart
1 parent 4eb05d8 commit c4d8c0a

File tree

5 files changed

+33
-5
lines changed

5 files changed

+33
-5
lines changed

charts/discord-bot-cryptoprices/Chart.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,6 @@ description: A Helm chart for Kubernetes
44

55
type: application
66

7-
version: 0.0.3
7+
version: 0.0.4
88

9-
appVersion: "0.0.3"
9+
appVersion: "0.0.5"

charts/discord-bot-cryptoprices/templates/_helpers.tpl

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,3 +49,14 @@ Selector labels
4949
app.kubernetes.io/name: {{ include "discord-bot-cryptoprices.name" . }}
5050
app.kubernetes.io/instance: {{ .Release.Name }}
5151
{{- end }}
52+
53+
{{/*
54+
Define the token name
55+
*/}}
56+
{{- define "discord-bot-cryptoprices.token" -}}
57+
{{- if not .Values.existingToken }}
58+
{{- include "discord-bot-cryptoprices.fullname" . }}
59+
{{- else }}
60+
{{- .Values.existingToken | trunc 63 | toString }}
61+
{{- end }}
62+
{{- end }}

charts/discord-bot-cryptoprices/templates/deployment.yaml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,9 +37,10 @@ spec:
3737
- name: prom
3838
containerPort: 8080
3939
protocol: TCP
40+
envFrom:
41+
- secretRef:
42+
name: {{ include "discord-bot-cryptoprices.token" . }}
4043
env:
41-
- name: TOKEN
42-
value: {{ .Values.token }}
4344
- name: SYMBOL
4445
value: {{ .Values.symbol }}
4546
{{- if .Values.setNickname }}
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
{{- if not .Values.existingToken }}
2+
apiVersion: v1
3+
kind: Secret
4+
metadata:
5+
name: {{ template "discord-bot-cryptoprices.fullname" . }}
6+
namespace: {{ .Release.Namespace }}
7+
labels:
8+
{{- include "discord-bot-cryptoprices.labels" . | nindent 4 }}
9+
type: Opaque
10+
data:
11+
TOKEN: {{ .Values.token | b64enc | quote }}
12+
{{- end }}

charts/discord-bot-cryptoprices/values.yaml

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,15 @@
1-
token:
21
symbol:
32
setNickname: "true"
43
nicknameHeader: ""
54
activityMsg: ""
65
status: 2
76
refresh: 120
87

8+
# specify a discord bot token
9+
token:
10+
# use an existing secret with TOKEN set
11+
existingToken:
12+
913
image:
1014
repository: ghcr.io/rssnyder/discord-bot-cryptoprices
1115
pullPolicy: IfNotPresent

0 commit comments

Comments
 (0)