Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: support parameters api for mongodb #1319

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading