{{ define "osm.keystone.image" -}}
{{ printf "%s:%s" (.Values.keystone.image.repository | default (printf "%s/keystone" (.Values.global.image.repositoryBase))) (.Values.keystone.image.tag | default .Values.global.image.tag) }}
{{- end }}
+
+{{/*
+Return the MongoDB URI based on whether authentication is enabled.
+*/}}
+{{- define "osm.databaseUri" -}}
+ {{- if .Values.global.db.mongo.auth.enabled }}
+ {{- $secret := (lookup "v1" "Secret" .Release.Namespace .Values.global.db.mongo.auth.secretName ) }}
+ {{- $password := (index $secret.data .Values.global.db.mongo.auth.secretKeyRootPassword ) | b64dec }}
+ {{ printf "mongodb://root:%s@%s:27017/?replicaSet=rs0" $password .Values.global.db.mongo.mongoService | b64enc | quote }}
+ {{- else }}
+ {{ printf "mongodb://%s:27017/?replicaSet=rs0" .Values.global.db.mongo.mongoService | b64enc | quote }}
+ {{- end }}
+{{- end }}
labels:
{{- include "osm.labels" . | nindent 4 }}
data:
- DB_HOST: "mysql"
+ DB_HOST: "{{ .Values.global.db.mysql.mysqlService }}"
{{- end }}
\ No newline at end of file
- name: ROOT_DB_PASSWORD
valueFrom:
secretKeyRef:
- name: mysql
- key: mysql-root-password
+ name: {{ .Values.global.db.mysql.mysqlSecretName }}
+ key: {{ .Values.global.db.mysql.mysqlSecretKey }}
- name: KEYSTONE_DB_PASSWORD
valueFrom:
secretKeyRef:
{{- include "osm.labels" . | nindent 4 }}
data:
OSMLCM_RO_HOST: "ro"
- OSMLCM_DATABASE_URI: "mongodb://mongodb-k8s:27017/?replicaSet=rs0"
OSMLCM_MESSAGE_HOST: "kafka"
OSMLCM_STORAGE_DRIVER: "mongo"
OSMLCM_STORAGE_PATH: "/app/storage"
OSMLCM_STORAGE_COLLECTION: "files"
- OSMLCM_STORAGE_URI: "mongodb://mongodb-k8s:27017/?replicaSet=rs0"
OSMLCM_GLOBAL_LOGLEVEL: {{ .Values.lcm.logLevel | default .Values.global.logLevel | default "INFO" }}
OSMLCM_MAINPOSTRENDERERPATH: "{{ .Values.lcm.mainPostRenderer.path }}{{ .Values.lcm.mainPostRenderer.scriptName }}"
OSMLCM_PODLABELSPOSTRENDERERPATH: "{{ .Values.lcm.podLabelsPostRenderer.path }}{{ .Values.lcm.podLabelsPostRenderer.scriptName }}"
initContainers:
- name: kafka-ro-mongo-test
image: alpine:latest
- command: ["sh", "-c", "until (nc -zvw1 kafka 9092 && nc -zvw1 ro 9090 && nc -zvw1 mongodb-k8s 27017); do sleep 3; done; exit 0"]
+ command: ["sh", "-c", "until (nc -zvw1 kafka 9092 && nc -zvw1 ro 9090 && nc -zvw1 {{ .Values.global.db.mongo.mongoService }} 27017); do sleep 3; done; exit 0"]
containers:
- name: lcm
securityContext:
secretKeyRef:
name: {{ include "osm.fullname" . }}-secret
key: OSM_DATABASE_COMMONKEY
+ - name: OSMLCM_DATABASE_URI
+ valueFrom:
+ secretKeyRef:
+ name: {{ include "osm.fullname" . }}-secret
+ key: OSM_DATABASE_URI
+ - name: OSMLCM_STORAGE_URI
+ valueFrom:
+ secretKeyRef:
+ name: {{ include "osm.fullname" . }}-secret
+ key: OSM_DATABASE_URI
{{- end }}
{{- end }}
volumeMounts:
labels:
{{- include "osm.labels" . | nindent 4 }}
data:
- OSMMON_DATABASE_URI: "mongodb://mongodb-k8s:27017/?replicaSet=rs0"
OSMMON_MESSAGE_HOST: "kafka"
OSMMON_MESSAGE_PORT: "9092"
OSMMON_GLOBAL_LOG_LEVEL: {{ .Values.mon.logLevel | default .Values.global.logLevel | default "INFO" }}
initContainers:
- name: kafka-mongo-test
image: alpine:latest
- command: ["sh", "-c", "until (nc -zvw1 kafka 9092 && nc -zvw1 mongodb-k8s 27017); do sleep 3; done; exit 0"]
+ command: ["sh", "-c", "until (nc -zvw1 kafka 9092 && nc -zvw1 {{ .Values.global.db.mongo.mongoService }} 27017); do sleep 3; done; exit 0"]
containers:
- name: mon
securityContext:
secretKeyRef:
name: {{ include "osm.fullname" . }}-secret
key: OSM_DATABASE_COMMONKEY
+ - name: OSMMON_DATABASE_URI
+ valueFrom:
+ secretKeyRef:
+ name: {{ include "osm.fullname" . }}-secret
+ key: OSM_DATABASE_URI
{{- end }}
{{- end }}
{{- with .Values.global.nodeSelector }}
labels:
{{- include "osm.labels" . | nindent 4 }}
data:
- OSMNBI_DATABASE_URI: "mongodb://mongodb-k8s:27017/?replicaSet=rs0"
OSMNBI_MESSAGE_HOST: "kafka"
OSMNBI_STORAGE_DRIVER: "mongo"
OSMNBI_STORAGE_PATH: "/app/storage"
OSMNBI_STORAGE_COLLECTION: "files"
- OSMNBI_STORAGE_URI: "mongodb://mongodb-k8s:27017/?replicaSet=rs0"
OSMNBI_LOG_LEVEL: {{ .Values.nbi.logLevel | default .Values.global.logLevel | default "INFO" }}
OSMNBI_USER_MANAGEMENT: "True"
{{- end }}
initContainers:
- name: kafka-mongo-test
image: alpine:latest
- command: ["sh", "-c", "until (nc -zvw1 kafka 9092 && nc -zvw1 mongodb-k8s 27017); do sleep 3; done; exit 0"]
+ command: ["sh", "-c", "until (nc -zvw1 kafka 9092 && nc -zvw1 {{ .Values.global.db.mongo.mongoService }} 27017); do sleep 3; done; exit 0"]
containers:
- name: nbi
securityContext:
secretKeyRef:
name: {{ include "osm.fullname" . }}-secret
key: OSM_DATABASE_COMMONKEY
+ - name: OSMNBI_DATABASE_URI
+ valueFrom:
+ secretKeyRef:
+ name: {{ include "osm.fullname" . }}-secret
+ key: OSM_DATABASE_URI
+ - name: OSMNBI_STORAGE_URI
+ valueFrom:
+ secretKeyRef:
+ name: {{ include "osm.fullname" . }}-secret
+ key: OSM_DATABASE_URI
{{- end }}
{{- with .Values.global.nodeSelector }}
nodeSelector:
OSM_MYSQL_ROOT_PASSWORD: {{ randAlphaNum 32 | b64enc | quote }}
OSM_KEYSTONE_DB_PASSWORD: {{ randAlphaNum 32 | b64enc | quote }}
OSM_SERVICE_PASSWORD: {{ randAlphaNum 32 | b64enc | quote }}
+ OSM_DATABASE_URI: {{ include "osm.databaseUri" . }}
\ No newline at end of file
labels:
{{- include "osm.labels" . | nindent 4 }}
data:
- OSMPLA_DATABASE_URI: "mongodb://mongodb-k8s:27017/?replicaSet=rs0"
OSMPLA_DATABASE_HOST: "mongo"
OSMPLA_MESSAGE_HOST: "kafka"
OSMPLA_GLOBAL_LOG_LEVEL: {{ .Values.pla.logLevel | default .Values.global.logLevel | default "INFO" }}
initContainers:
- name: kafka-mongo-test
image: alpine:latest
- command: ["sh", "-c", "until (nc -zvw1 kafka 9092 && nc -zvw1 mongodb-k8s 27017); do sleep 3; done; exit 0"]
+ command: ["sh", "-c", "until (nc -zvw1 kafka 9092 && nc -zvw1 {{ .Values.global.db.mongo.mongoService }} 27017); do sleep 3; done; exit 0"]
containers:
- name: pla
securityContext:
envFrom:
- configMapRef:
name: {{ include "osm.fullname" . }}-pla-configmap
+ env:
+ - name: OSMPLA_DATABASE_URI
+ valueFrom:
+ secretKeyRef:
+ name: {{ include "osm.fullname" . }}-secret
+ key: OSM_DATABASE_URI
{{- with .Values.global.nodeSelector }}
nodeSelector:
{{- toYaml . | nindent 8 }}
labels:
{{- include "osm.labels" . | nindent 4 }}
data:
- OSMPOL_DATABASE_URI: "mongodb://mongodb-k8s:27017/?replicaSet=rs0"
OSMPOL_MESSAGE_HOST: "kafka"
OSMPOL_MESSAGE_PORT: "9092"
OSMPOL_GLOBAL_LOG_LEVEL: {{ .Values.pol.logLevel | default .Values.global.logLevel | default "INFO" }}
initContainers:
- name: kafka-mongo-test
image: alpine:latest
- command: ["sh", "-c", "until (nc -zvw1 kafka 9092 && nc -zvw1 mongodb-k8s 27017); do sleep 3; done; exit 0"]
+ command: ["sh", "-c", "until (nc -zvw1 kafka 9092 && nc -zvw1 {{ .Values.global.db.mongo.mongoService }} 27017); do sleep 3; done; exit 0"]
containers:
- name: pol
securityContext:
secretKeyRef:
name: {{ include "osm.fullname" . }}-secret
key: OSM_DATABASE_COMMONKEY
+ - name: OSMPOL_DATABASE_URI
+ valueFrom:
+ secretKeyRef:
+ name: {{ include "osm.fullname" . }}-secret
+ key: OSM_DATABASE_URI
{{- end }}
{{- with .Values.global.nodeSelector }}
nodeSelector:
labels:
{{- include "osm.labels" . | nindent 4 }}
data:
- OSMRO_DATABASE_URI: "mongodb://mongodb-k8s:27017/?replicaSet=rs0"
OSMRO_MESSAGE_HOST: "kafka"
OSMRO_STORAGE_DRIVER: "mongo"
OSMRO_STORAGE_PATH: "/app/storage"
OSMRO_STORAGE_COLLECTION: "files"
- OSMRO_STORAGE_URI: "mongodb://mongodb-k8s:27017/?replicaSet=rs0"
OSMRO_LOG_LEVEL: {{ .Values.ro.logLevel | default .Values.global.logLevel | default "INFO" }}
OSMRO_PERIOD_REFRESH_ACTIVE: "-1"
{{- end }}
initContainers:
- name: kafka-mongo-test
image: alpine:latest
- command: ["sh", "-c", "until (nc -zvw1 kafka 9092 && nc -zvw1 mongodb-k8s 27017); do sleep 3; done; exit 0"]
+ command: ["sh", "-c", "until (nc -zvw1 kafka 9092 && nc -zvw1 {{ .Values.global.db.mongo.mongoService }} 27017); do sleep 3; done; exit 0"]
containers:
- name: ro
securityContext:
secretKeyRef:
name: {{ include "osm.fullname" . }}-secret
key: OSM_DATABASE_COMMONKEY
+ - name: OSMRO_DATABASE_URI
+ valueFrom:
+ secretKeyRef:
+ name: {{ include "osm.fullname" . }}-secret
+ key: OSM_DATABASE_URI
+ - name: OSMRO_STORAGE_URI
+ valueFrom:
+ secretKeyRef:
+ name: {{ include "osm.fullname" . }}-secret
+ key: OSM_DATABASE_URI
{{- end }}
{{- with .Values.global.nodeSelector }}
nodeSelector:
# If not set and create is true, a name is generated using the fullname template
name: ""
+ db:
+ mysql:
+ mysqlSecretName: mysql
+ mysqlSecretKey: mysql-root-password
+ mysqlService: mysql
+ mongo:
+ mongoService: mongodb-k8s
+ auth:
+ enabled: false
+ # secretName: mongodb-k8s
+ # secretKeyRootPassword: mongodb-root-password
+
podAnnotations: {}
podSecurityContext: