Skip to content

Commit

Permalink
chore: support parameters api for mongodb
Browse files Browse the repository at this point in the history
  • Loading branch information
sophon-zt committed Dec 25, 2024
1 parent 68cd6cd commit 3ac83d9
Show file tree
Hide file tree
Showing 5 changed files with 25 additions and 38 deletions.
11 changes: 11 additions & 0 deletions addons/mongodb/templates/_names.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -101,3 +101,14 @@ mongodb-scripts
{{- .Values.resourceNamePrefix -}}-scripts
{{- end -}}
{{- end -}}

{{/*
Define parameter config renderername
*/}}
{{- define "mongodb.pcrName" -}}
{{- if eq (len .Values.resourceNamePrefix) 0 -}}
mongodb-pcr
{{- else -}}
{{- .Values.resourceNamePrefix -}}-pcr
{{- end -}}
{{- end -}}
3 changes: 0 additions & 3 deletions addons/mongodb/templates/componentdefinition.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -37,12 +37,9 @@ spec:
configs:
- name: mongodb-config
templateRef: {{ include "mongodb.configTplName" . }}
constraintRef: {{ include "mongodb.configConstraintName" . }}
volumeName: mongodb-config
namespace: {{ .Release.Namespace }}
defaultMode: 0400 # for only read
keys:
- mongodb.conf
logConfigs:
{{- range $name,$pattern := .Values.logConfigs }}
- name: {{ $name }}
Expand Down
22 changes: 0 additions & 22 deletions addons/mongodb/templates/configconstraint.yaml

This file was deleted.

15 changes: 2 additions & 13 deletions addons/mongodb/templates/configtemplate.yaml
Original file line number Diff line number Diff line change
@@ -1,22 +1,11 @@
apiVersion: v1
kind: ConfigMap
metadata:
name: mongodb5.0-config-template
name: {{ include "mongodb.configTplName" . }}
labels:
{{- include "mongodb.labels" . | nindent 4 }}
data:
mongodb.conf: |-
{{- .Files.Get "config/mongodb5.0-config.tpl" | nindent 4 }}
keyfile: |-
{{- .Files.Get "config/keyfile.tpl" | nindent 4 }}
---

apiVersion: v1
kind: ConfigMap
metadata:
name: {{ include "mongodb.name" . }}-env-tpl
labels:
{{- include "mongodb.labels" . | nindent 4 }}
data:
env: |-
{{- .Files.Get "config/mongodb-env.tpl" | nindent 4 }}
{{- .Files.Get "config/keyfile.tpl" | nindent 4 }}
12 changes: 12 additions & 0 deletions addons/mongodb/templates/pcr.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
apiVersion: parameters.kubeblocks.io/v1alpha1
kind: ParamConfigRenderer
metadata:
name: {{ include "mongodb.pcrName" . }}
labels:
{{- include "mongodb.labels" . | nindent 4 }}
spec:
componentDef: {{ include "mongodb.compDefName" . }}
configs:
- name: mongodb.conf
fileFormatConfig:
format: yaml

0 comments on commit 3ac83d9

Please sign in to comment.