Skip to content

Commit beb5168

Browse files
authored
feat: add static auth configuration (#214)
1 parent 929b54b commit beb5168

File tree

5 files changed

+50
-7
lines changed

5 files changed

+50
-7
lines changed

charts/greptimedb-standalone/Chart.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ apiVersion: v2
22
name: greptimedb-standalone
33
description: A Helm chart for deploying standalone greptimedb
44
type: application
5-
version: 0.1.36
5+
version: 0.1.37
66
appVersion: 0.11.0
77
home: https://github.com/GreptimeTeam/greptimedb
88
sources:

charts/greptimedb-standalone/README.md

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
A Helm chart for deploying standalone greptimedb
44

5-
![Version: 0.1.36](https://img.shields.io/badge/Version-0.1.36-informational?style=flat-square) ![Type: application](https://img.shields.io/badge/Type-application-informational?style=flat-square) ![AppVersion: 0.11.0](https://img.shields.io/badge/AppVersion-0.11.0-informational?style=flat-square)
5+
![Version: 0.1.37](https://img.shields.io/badge/Version-0.1.37-informational?style=flat-square) ![Type: application](https://img.shields.io/badge/Type-application-informational?style=flat-square) ![AppVersion: 0.11.0](https://img.shields.io/badge/AppVersion-0.11.0-informational?style=flat-square)
66

77
## Source Code
88
- https://github.com/GreptimeTeam/greptimedb
@@ -53,6 +53,11 @@ helm uninstall greptimedb-standalone -n default
5353
| affinity | object | `{}` | Affinity configuration for pod |
5454
| annotations | object | `{}` | The annotations |
5555
| args | list | `[]` | The container args |
56+
| auth | object | `{"enabled":false,"fileName":"passwd","mountPath":"/etc/greptimedb/auth","users":[{"password":"admin","username":"admin"}]}` | The static auth for greptimedb, only support one user now(https://docs.greptime.com/user-guide/deployments/authentication/static). |
57+
| auth.enabled | bool | `false` | Enable static auth |
58+
| auth.fileName | string | `"passwd"` | The auth file name, the full path is `${mountPath}/${fileName}` |
59+
| auth.mountPath | string | `"/etc/greptimedb/auth"` | The auth file path to store the auth info |
60+
| auth.users | list | `[{"password":"admin","username":"admin"}]` | The users to be created in the auth file |
5661
| command | list | `[]` | The container command |
5762
| configToml | string | `"mode = 'standalone'\n"` | The extra configuration for greptimedb |
5863
| dataHome | string | `"/data/greptimedb/"` | Storage root directory |

charts/greptimedb-standalone/templates/statefulset.yaml

Lines changed: 17 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ spec:
6464
args:
6565
{{- if .Values.configToml }}
6666
- "--config-file"
67-
- "/etc/greptimedb/config.toml"
67+
- "/etc/greptimedb/config/config.toml"
6868
{{- end }}
6969
{{- if .Values.dataHome }}
7070
- "--data-home"
@@ -86,12 +86,16 @@ spec:
8686
- containerPort: {{ .Values.postgresServicePort }}
8787
name: postgres
8888
protocol: TCP
89-
{{- if .Values.env }}
89+
{{- if or .Values.env .Values.auth.enabled }}
9090
env:
9191
{{- range $key, $val := .Values.env }}
9292
- name: {{ $key }}
9393
value: {{ $val | quote }}
9494
{{- end }}
95+
{{- if .Values.auth.enabled }}
96+
- name: GREPTIMEDB_STANDALONE__USER_PROVIDER
97+
value: "static_user_provider:file:{{ .Values.auth.mountPath }}/{{ .Values.auth.fileName }}"
98+
{{- end }}
9599
{{- end }}
96100
{{- if .Values.objectStorage }}
97101
{{- if .Values.objectStorage.credentials }}
@@ -113,7 +117,12 @@ spec:
113117
mountPath: {{ .Values.persistence.mountPath }}
114118
{{- if .Values.configToml }}
115119
- name: config
116-
mountPath: /etc/greptimedb
120+
mountPath: /etc/greptimedb/config
121+
readOnly: true
122+
{{- end }}
123+
{{- if .Values.auth.enabled }}
124+
- name: auth
125+
mountPath: {{ .Values.auth.mountPath }}
117126
readOnly: true
118127
{{- end }}
119128
{{- with .Values.extraVolumeMounts }}
@@ -123,17 +132,20 @@ spec:
123132
resources:
124133
{{- toYaml . | nindent 12 }}
125134
{{- end }}
126-
{{- if or .Values.configToml .Values.extraVolumes }}
127135
volumes:
128136
{{- if .Values.configToml }}
129137
- name: config
130138
configMap:
131139
name: {{ include "greptimedb-standalone.fullname" . }}-config
132140
{{- end }}
141+
{{- if .Values.auth.enabled }}
142+
- name: auth
143+
secret:
144+
secretName: {{ include "greptimedb-standalone.fullname" . }}-users-auth
145+
{{- end }}
133146
{{- with .Values.extraVolumes }}
134147
{{- toYaml . | nindent 8 }}
135148
{{- end }}
136-
{{- end }}
137149
{{- with .Values.affinity }}
138150
affinity:
139151
{{- toYaml . | nindent 8 }}
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
{{- if .Values.auth.enabled -}}
2+
apiVersion: v1
3+
kind: Secret
4+
metadata:
5+
name: {{ include "greptimedb-standalone.fullname" . }}-users-auth
6+
namespace: {{ .Release.Namespace }}
7+
type: Opaque
8+
stringData:
9+
{{ .Values.auth.fileName }}: |
10+
{{- range .Values.auth.users }}
11+
{{ printf "%s=%s" .username .password }}
12+
{{- end }}
13+
{{- end }}

charts/greptimedb-standalone/values.yaml

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -239,3 +239,16 @@ service:
239239
type: ClusterIP
240240
# -- Annotations for service
241241
annotations: {}
242+
243+
# -- The static auth for greptimedb, only support one user now(https://docs.greptime.com/user-guide/deployments/authentication/static).
244+
auth:
245+
# -- Enable static auth
246+
enabled: false
247+
# -- The auth file path to store the auth info
248+
mountPath: "/etc/greptimedb/auth"
249+
# -- The auth file name, the full path is `${mountPath}/${fileName}`
250+
fileName: "passwd"
251+
# -- The users to be created in the auth file
252+
users:
253+
- username: "admin"
254+
password: "admin"

0 commit comments

Comments
 (0)