# See the License for the specific language governing permissions and #
# limitations under the License. #
################################################################################
-{{- $imagectx := dict "ctx" . "defaultregistry" .Values.e2term.image.registry }}
-{{- $pullpolicyctx := dict "ctx" . "defaultpullpolicy" .Values.e2term.imagePullPolicy }}
+{{- $topCtx := . }}
+{{- $health := .Values.health }}
+{{- $common_env := .Values.common_env_variables }}
+{{- range keys .Values.e2term }}
+{{- $key := . }}
+{{- with index $topCtx.Values.e2term . }}
+
+{{- $imagectx := dict "ctx" $topCtx "defaultregistry" .image.registry }}
+{{- $pullpolicyctx := dict "ctx" $topCtx "defaultpullpolicy" .imagePullPolicy }}
+---
apiVersion: apps/v1
kind: Deployment
metadata:
- name: {{ include "common.deploymentname.e2term" . }}
- namespace: {{ include "common.namespace.platform" . }}
+ name: {{ include "common.deploymentname.e2term" $topCtx }}-{{ $key }}
+ namespace: {{ include "common.namespace.platform" $topCtx }}
labels:
- app: {{ include "common.namespace.platform" . }}-{{ include "common.name.e2term" . }}
- chart: {{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }}
- release: {{ .Release.Name }}
- heritage: {{ .Release.Service }}
+ app: {{ include "common.namespace.platform" $topCtx }}-{{ include "common.name.e2term" $topCtx }}-{{ $key }}
+ chart: {{ $topCtx.Chart.Name }}-{{ $topCtx.Chart.Version | replace "+" "_" }}
+ release: {{ $topCtx.Release.Name }}
+ heritage: {{ $topCtx.Release.Service }}
spec:
- replicas: {{ .Values.e2term.replicaCount }}
+ replicas: {{ .replicaCount }}
selector:
matchLabels:
- app: {{ include "common.namespace.platform" . }}-{{ include "common.name.e2term" . }}
- release: {{ .Release.Name }}
+ app: {{ include "common.namespace.platform" $topCtx }}-{{ include "common.name.e2term" $topCtx }}-{{ $key }}
+ release: {{ $topCtx.Release.Name }}
template:
metadata:
- {{- if .Values.e2term.annotations }}
+ {{- if $.Values.global }}
+ {{- if $.Values.global.danm_networks }}
+ {{- $networklist := list }}
+ {{- range $network := $.Values.global.danm_networks }}
+ {{- if $network.tenants }}
+ {{- if $network.tenants.e2term }}
+ {{- if (hasKey $network.tenants.e2term $key) }}
+ {{- $networklist = append $networklist $network }}
+ {{- end }}
+ {{- end }}
+ {{- end }}
+ {{- end }}
+ {{- if $networklist }}
annotations:
- {{- .Values.e2term.annotations | nindent 8 -}}
- {{ end }}
+ danm.k8s.io/interfaces: |
+ [
+ {{- range $network := $networklist }}
+ {{- printf "\n {\"clusterNetwork\": \"%s\"" $network.name }}
+ {{- with index $network.tenants.e2term $key }}
+ {{- if .ip }}
+ {{- printf ", \"ip\": \"%s\"" .ip }}
+ {{- else }}
+ {{- printf ", \"ip\": \"dynamic\"" }}
+ {{- end }}
+ {{- if .ip6 }}
+ {{- printf ", \"ip6\": \"%s\"" .ip6 }}
+ {{- end }}
+ {{- if .proutes }}
+ {{- printf ", \"proutes\": {" }}
+ {{- range $subnet, $gw := .proutes }}
+ {{- if eq $subnet ( first ( keys .proutes ))}}
+ {{- printf "\"%s\": \"%s\"" $subnet $gw }}
+ {{- else }}
+ {{- printf ", \"%s\": \"%s\"" $subnet $gw }}
+ {{- end }}
+ {{- end }}
+ {{- printf "}" }}
+ {{- end }}
+ {{- end }}
+ {{- if ne $network.name (last $networklist).name }}
+ {{- printf "}," }}
+ {{- else }}
+ {{- printf "}" }}
+ {{- end }}
+ {{- end }}
+ ]
+ {{- end }}
+ {{- end }}
+ {{- end }}
labels:
- app: {{ include "common.namespace.platform" . }}-{{ include "common.name.e2term" . }}
- release: {{ .Release.Name }}
+ app: {{ include "common.namespace.platform" $topCtx }}-{{ include "common.name.e2term" $topCtx }}-{{ $key }}
+ release: {{ $topCtx.Release.Name }}
spec:
- hostname: {{ include "common.name.e2term" . }}
- hostNetwork: {{ .Values.e2term.hostnetworkmode }}
+ hostname: {{ include "common.name.e2term" $topCtx }}-{{ $key }}
+ hostNetwork: {{ .hostnetworkmode }}
dnsPolicy: ClusterFirstWithHostNet
imagePullSecrets:
- name: {{ include "common.dockerregistry.credential" $imagectx }}
- {{- with .Values.e2term.nodeselector }}
+ {{- with .nodeselector }}
nodeSelector: {{ toYaml . | trim | nindent 8 -}}
{{- end }}
containers:
- - name: {{ include "common.containername.e2term" . }}
- image: {{ include "common.dockerregistry.url" $imagectx }}/{{ .Values.e2term.image.name }}:{{ .Values.e2term.image.tag }}
+ - name: {{ include "common.containername.e2term" $topCtx }}
+ image: {{ include "common.dockerregistry.url" $imagectx }}/{{ .image.name }}:{{ .image.tag }}
imagePullPolicy: {{ include "common.dockerregistry.pullpolicy" $pullpolicyctx }}
volumeMounts:
- mountPath: /opt/e2/router.txt
- mountPath: /tmp/rmr_verbose
name: local-router-file
subPath: rmr_verbose
-{{ if .Values.e2term.pizpub.enabled }}
- - mountPath: "{{ .Values.e2term.env.messagecollectorfile }}"
+{{ if .pizpub.enabled }}
+ - mountPath: "{{ .env.messagecollectorfile }}"
name: vol-shared
readOnly: false
- subPath: "{{ .Values.e2term.pizpub.scanDirectory }}"
+ subPath: "{{ .pizpub.scanDirectory }}"
{{ else }}
- - mountPath: "{{ .Values.e2term.env.messagecollectorfile }}"
+ - mountPath: "{{ .env.messagecollectorfile }}"
name: vol-shared
readOnly: false
{{ end }}
envFrom:
- configMapRef:
- name: {{ include "common.configmapname.e2term" . }}-env
+ name: {{ include "common.configmapname.e2term" $topCtx }}-env-{{ $key }}
+ env:
+ - name: SYSTEM_NAME
+ value: "SEP"
+ - name: CONFIG_MAP_NAME
+ value: "{{ $common_env.ConfigMapName }}"
+ - name: HOST_NAME
+ valueFrom:
+ fieldRef:
+ fieldPath: spec.nodeName
+ - name: SERVICE_NAME
+ value: "{{ $common_env.ServiceName }}"
+ - name: CONTAINER_NAME
+ value: "{{ include "common.containername.e2term" $topCtx }}"
+ - name: POD_NAME
+ valueFrom:
+ fieldRef:
+ fieldPath: metadata.name
ports:
- - name: "rmrroute"
- containerPort: {{ include "common.serviceport.e2term.rmr.route" . }}
- - name: "rmrdata"
- containerPort: {{ include "common.serviceport.e2term.rmr.data" . }}
+ - name: "rmrroute-{{ $key }}"
+ containerPort: {{ include "common.serviceport.e2term.rmr.route" $topCtx }}
+ - name: "rmrdata-{{ $key }}"
+ containerPort: {{ include "common.serviceport.e2term.rmr.data" $topCtx }}
+ - name: "sctp-{{ $key }}"
+ containerPort: 36422
+ protocol: SCTP
+ - name: "prmts-{{ $key }}"
+ containerPort: {{ include "common.serviceport.e2term.prometheus" $topCtx }}
stdin: true
tty: true
securityContext:
- privileged: {{ .Values.e2term.privilegedmode }}
-
-{{ if .Values.e2term.pizpub.enabled }}
- - name: {{ include "common.containername.e2term" . }}-pizpub
- image: {{ include "common.repository" . }}/{{ .Values.e2term.pizpub.imageName }}:{{ .Values.e2term.pizpub.imageVersion }}
- imagePullPolicy: {{ include "common.pullPolicy" . }}
+ privileged: {{ .privilegedmode }}
+ {{- if eq $health.liveness.enabled true }}
+ readinessProbe:
+ exec:
+ command: [ "/bin/sh", "-c", "{{ $health.readiness.command }}:{{ include "common.serviceport.e2term.rmr.data" . }}" ]
+ initialDelaySeconds: {{ $health.readiness.initialDelaySeconds }}
+ periodSeconds: {{ $health.readiness.periodSeconds }}
+ {{- end }}
+ {{- if eq $health.liveness.enabled true }}
+ livenessProbe:
+ exec:
+ command: [ "/bin/sh", "-c", "{{ $health.liveness.command }}:{{ include "common.serviceport.e2term.rmr.data" . }}" ]
+ initialDelaySeconds: {{ $health.liveness.initialDelaySeconds }}
+ periodSeconds: {{ $health.liveness.periodSeconds }}
+ {{- end }}
+{{ if .pizpub.enabled }}
+ - name: {{ include "common.containername.e2term" $topCtx }}-pizpub
+ {{- $pizpubimagectx := dict "ctx" $topCtx "defaultregistry" .pizpub.image.registry }}
+ image: {{ include "common.dockerregistry.url" $pizpubimagectx }}/{{ .pizpub.image.name }}:{{ .pizpub.image.tag }}
+ imagePullPolicy: {{ include "common.dockerregistry.pullpolicy" $pullpolicyctx }}
volumeMounts:
- mountPath: /etc/localtime
name: localtime
readOnly: true
- - mountPath: "{{ .Values.e2term.pizpub.dataRootDir }}"
+ - mountPath: "{{ .pizpub.dataRootDir }}"
name: vol-shared
readOnly: false
- name: pizpub-config
lifecycle:
postStart:
exec:
- command: ["/bin/sh", "/opt/app/config/conf/cleaner.sh", "{{ .Values.e2term.pizpub.dataRootDir }}/{{ .Values.e2term.pizpub.processedDirectory }}", "3"]
+ command: ["/bin/sh", "/opt/app/config/conf/cleaner.sh", "{{ .pizpub.dataRootDir }}/{{ .pizpub.processedDirectory }}", "3"]
{{ end }}
volumes:
- name: local-router-file
configMap:
- name: {{ include "common.configmapname.e2term" . }}-router-configmap
-{{ if .Values.e2term.pizpub.enabled }}
+ name: {{ include "common.configmapname.e2term" $topCtx }}-router-configmap
+{{ if .pizpub.enabled }}
- name: localtime
hostPath:
path: /etc/localtime
- name: pizpub-config
configMap:
- name: {{ include "common.configmapname.e2term" . }}-pizpub
+ name: {{ include "common.configmapname.e2term" $topCtx }}-pizpub-{{ $key }}
{{ end }}
- name: vol-shared
persistentVolumeClaim:
- claimName: {{ include "common.pvcname.e2term" . }}
+ claimName: {{ include "common.pvcname.e2term" $topCtx }}-{{ $key }}
+{{- end }}
+{{- end }}