Skip to content

Commit

Permalink
[helm-chart] Add support for garnet.conf file via a secret object (#863)
Browse files Browse the repository at this point in the history
* Add support for garnet.conf file via a secret object

Signed-off-by: babykart <[email protected]>

* Update config.existingSecret comment

Signed-off-by: babykart <[email protected]>

* Fix config.garnetConf comment

Signed-off-by: babykart <[email protected]>

* Add readOnly to the secret volume

Signed-off-by: babykart <[email protected]>

* Increase chart version

Signed-off-by: babykart <[email protected]>

---------

Signed-off-by: babykart <[email protected]>
  • Loading branch information
babykart authored Dec 9, 2024
1 parent b882e14 commit 4ebe239
Show file tree
Hide file tree
Showing 5 changed files with 54 additions and 8 deletions.
2 changes: 1 addition & 1 deletion charts/garnet/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ apiVersion: v2
name: garnet
description: A Helm chart for Microsoft Garnet
type: application
version: 0.1.3
version: 0.2.0
appVersion: Version.props
home: https://github.com/microsoft/garnet
icon: https://avatars.githubusercontent.com/u/6154722?s=200&v=4
Expand Down
5 changes: 4 additions & 1 deletion charts/garnet/README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# garnet

![Version: 0.1.3](https://img.shields.io/badge/Version-0.1.3-informational?style=flat-square) ![Type: application](https://img.shields.io/badge/Type-application-informational?style=flat-square) ![AppVersion: 1.0.46](https://img.shields.io/badge/AppVersion-1.0.46-informational?style=flat-square)
![Version: 0.2.0](https://img.shields.io/badge/Version-0.2.0-informational?style=flat-square) ![Type: application](https://img.shields.io/badge/Type-application-informational?style=flat-square) ![AppVersion: 1.0.46](https://img.shields.io/badge/AppVersion-1.0.46-informational?style=flat-square)

A Helm chart for Microsoft Garnet

Expand Down Expand Up @@ -32,6 +32,8 @@ helm delete garnet
| Key | Type | Default | Description |
|-----|------|---------|-------------|
| affinity | object | `{}` | Affinity |
| config.existingSecret | string | `""` | Garnet secret (if you want to use an existing secret). This secret must contains a key called 'garnet.conf'. |
| config.garnetConf | string | `""` | The garnet.conf data content. |
| containers.args | list | `[]` | Containers args |
| containers.livenessProbe | object | `{}` | Containers livenessProbe |
| containers.port | int | `6379` | Containers port |
Expand All @@ -50,6 +52,7 @@ helm delete garnet
| nameOverride | string | `""` | Chart name override |
| nodeSelector | object | `{}` | Node Selector labels |
| persistence.enabled | bool | `false` | persistence enabled |
| persistence.storageDir | string | `""` | The Storage directory for tiered records (hybrid log), if storage tiering (--storage-tier) is enabled. Default: "/data" |
| podAnnotations | object | `{}` | Pod annotations |
| podSecurityContext | object | `{}` | Pod Security Context |
| resources | object | `{}` | Resources |
Expand Down
11 changes: 11 additions & 0 deletions charts/garnet/templates/secret.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{{- if and (eq .Values.config.existingSecret "") .Values.config.garnetConf }}
apiVersion: v1
kind: Secret
metadata:
name: {{ include "garnet.fullname" . }}-config
labels:
{{- include "garnet.labels" . | nindent 4 }}
type: Opaque
data:
garnet.conf: {{ .Values.config.garnetConf | b64enc | quote }}
{{- end }}
27 changes: 21 additions & 6 deletions charts/garnet/templates/statefulset.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -42,11 +42,15 @@ spec:
image: "{{ .Values.image.registry }}/{{ .Values.image.repository }}:{{ .Values.image.tag | default .Chart.AppVersion }}"
imagePullPolicy: {{ .Values.image.pullPolicy }}
command: ["./GarnetServer"]
{{- if .Values.containers.args }}
{{- if or .Values.containers.args .Values.config.garnetConf .Values.config.existingSecret }}
args:
{{- range .Values.containers.args }}
- {{ . | quote }}
{{- end }}
{{- if or .Values.config.garnetConf .Values.config.existingSecret }}
- "--config-import-path"
- "/config"
{{- end }}
{{- end }}
ports:
- name: garnet
Expand All @@ -62,9 +66,19 @@ spec:
{{- end }}
resources:
{{- toYaml .Values.resources | nindent 12 }}
{{- if or .Values.persistence.enabled .Values.config.garnetConf .Values.config.existingSecret .Values.extraVolumeMounts }}
volumeMounts:
{{- if .Values.persistence.enabled }}
- name: data
mountPath: /data
mountPath: {{ .Values.persistence.storageDir | default "/data" }}
{{- end }}
{{- if or .Values.config.garnetConf .Values.config.existingSecret }}
- name: config-volume
mountPath: /config
subPath: garnet.conf
readOnly: true
{{- end }}
{{- end }}
{{- with .Values.extraVolumeMounts }}
{{- toYaml . | nindent 10}}
{{- end }}
Expand All @@ -89,11 +103,12 @@ spec:
tolerations:
{{- toYaml . | nindent 8 }}
{{- end }}
{{- if or (eq .Values.persistence.enabled false) .Values.extraVolumes }}
{{- if or .Values.config.garnetConf .Values.config.existingSecret .Values.extraVolumes }}
volumes:
{{- if (eq .Values.persistence.enabled false) }}
- emptyDir: {}
name: data
{{- if or .Values.config.garnetConf .Values.config.existingSecret }}
- name: config-volume
secret:
secretName: {{ if .Values.config.existingSecret }}{{ .Values.config.existingSecret }}{{ else }}{{ include "garnet.fullname" . }}-config{{ end }}
{{- end }}
{{- with .Values.extraVolumes }}
{{- toYaml . | nindent 6}}
Expand Down
17 changes: 17 additions & 0 deletions charts/garnet/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,20 @@ serviceAccount:
# -- Creates the token object
token: false

config:
# -- Garnet secret (if you want to use an existing secret).
# This secret must contains a key called 'garnet.conf'.
existingSecret: ""
# -- The garnet.conf data content.
garnetConf: ""
#garnetConf: |
# {
# "AuthenticationMode": "Password",
# "Password": "aStrongPassword",
# "EnableStorageTier": true,
# "LogDir": "/data"
# }

containers:
# -- Containers args
args: []
Expand Down Expand Up @@ -66,6 +80,9 @@ dnsPolicy: ClusterFirst
persistence:
# -- persistence enabled
enabled: false
# -- The Storage directory for tiered records (hybrid log), if storage tiering (--storage-tier) is enabled.
# Default: "/data"
storageDir: ""

volumeClaimTemplates:
# -- Volume Claim Templates Storage Class Name
Expand Down

0 comments on commit 4ebe239

Please sign in to comment.