Skip to content

Commit

Permalink
Optionally pass cortex config as configmap.
Browse files Browse the repository at this point in the history
Fixes cortexproject#235.

Signed-off-by: Josh Carp <[email protected]>
  • Loading branch information
jmcarp committed Dec 2, 2021
1 parent 69f8dfb commit c3027cc
Show file tree
Hide file tree
Showing 5 changed files with 26 additions and 5 deletions.
12 changes: 12 additions & 0 deletions templates/configmap.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{{- if (and (not .Values.useExternalConfig) (.Values.useConfigMap)) }}
apiVersion: v1
kind: ConfigMap
metadata:
name: {{ template "cortex.fullname" . }}
namespace: {{ .Release.Namespace }}
labels:
{{- include "cortex.labels" . | nindent 4 }}
data:
cortex.yaml: |
{{- tpl (toYaml .Values.config) . | nindent 4 }}
{{- end }}
6 changes: 5 additions & 1 deletion templates/ingester/ingester-dep.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -118,10 +118,14 @@ spec:
terminationGracePeriodSeconds: {{ .Values.ingester.terminationGracePeriodSeconds }}
volumes:
- name: config
secret:
{{- if .Values.useExternalConfig }}
secret:
secretName: {{ .Values.externalConfigSecretName }}
{{- else if .Values.useConfigMap }}
configMap:
name: {{ template "cortex.fullname" . }}
{{- else }}
secret:
secretName: {{ template "cortex.fullname" . }}
{{- end }}
- name: runtime-config
Expand Down
10 changes: 7 additions & 3 deletions templates/ingester/ingester-statefulset.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -84,12 +84,16 @@ spec:
terminationGracePeriodSeconds: {{ .Values.ingester.terminationGracePeriodSeconds }}
volumes:
- name: config
{{- if .Values.useExternalConfig }}
secret:
{{- if .Values.useExternalConfig }}
secretName: {{ .Values.externalConfigSecretName }}
{{- else }}
{{- else if .Values.useConfigMap }}
configMap:
name: {{ template "cortex.fullname" . }}
{{- else }}
secret:
secretName: {{ template "cortex.fullname" . }}
{{- end }}
{{- end }}
- name: runtime-config
configMap:
name: {{ template "cortex.fullname" . }}-runtime-config
Expand Down
2 changes: 1 addition & 1 deletion templates/secret.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{{- if not .Values.useExternalConfig }}
{{- if (and (not .Values.useExternalConfig) (not .Values.useConfigMap)) }}
apiVersion: v1
kind: Secret
metadata:
Expand Down
1 change: 1 addition & 0 deletions values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ serviceAccount:
annotations: {}
automountServiceAccountToken: true

useConfigMap: true
useExternalConfig: false
externalConfigSecretName: 'secret-with-config.yaml'
externalConfigVersion: '0'
Expand Down

0 comments on commit c3027cc

Please sign in to comment.