--- # configmap for apollo-portal kind: ConfigMap apiVersion: v1 metadata: {{- $portalFullName := include "apollo.portal.fullName" . }} name: {{ $portalFullName }} data: application-github.properties: | spring.datasource.url = jdbc:mysql://{{include "apollo.portaldb.serviceName" .}}:{{ .Values.portaldb.service.port }}/{{ .Values.portaldb.dbName }}{{ if .Values.portaldb.connectionStringProperties }}?{{ .Values.portaldb.connectionStringProperties }}{{ end }} spring.datasource.username = {{ required "portaldb.userName is required!" .Values.portaldb.userName }} spring.datasource.password = {{ required "portaldb.password is required!" .Values.portaldb.password }} {{- if .Values.config.envs }} apollo.portal.envs = {{ .Values.config.envs }} {{- end }} {{- if .Values.config.contextPath }} server.servlet.context-path = {{ .Values.config.contextPath }} {{- end }} apollo-env.properties: | {{- range $env, $address := .Values.config.metaServers }} {{ $env }}.meta = {{ $address }} {{- end }} {{- range $fileName, $content := .Values.config.files }} {{ $fileName | indent 2 }}: | {{ $content | indent 4 }} {{- end }} --- kind: Deployment apiVersion: apps/v1 metadata: name: {{ $portalFullName }} labels: {{- include "apollo.portal.labels" . | nindent 4 }} spec: replicas: {{ .Values.replicaCount }} selector: matchLabels: app: {{ $portalFullName }} {{- with .Values.strategy }} strategy: {{- toYaml . | nindent 4 }} {{- end }} template: metadata: labels: app: {{ $portalFullName }} spec: {{- with .Values.imagePullSecrets }} imagePullSecrets: {{- toYaml . | nindent 8 }} {{- end }} volumes: - name: configmap-{{ $portalFullName }} configMap: name: {{ $portalFullName }} items: - key: application-github.properties path: application-github.properties - key: apollo-env.properties path: apollo-env.properties {{- range $fileName, $content := .Values.config.files }} - key: {{ $fileName }} path: {{ $fileName }} {{- end }} defaultMode: 420 containers: - name: {{ .Values.name }} image: "{{ .Values.image.repository }}:{{ .Chart.AppVersion }}" imagePullPolicy: {{ .Values.image.pullPolicy }} ports: - name: http containerPort: {{ .Values.containerPort }} protocol: TCP env: - name: SPRING_PROFILES_ACTIVE value: {{ .Values.config.profiles | quote }} {{- range $key, $value := .Values.env }} - name: {{ $key }} value: {{ $value }} {{- end }} volumeMounts: - name: configmap-{{ $portalFullName }} mountPath: /apollo-portal/config/application-github.properties subPath: application-github.properties - name: configmap-{{ $portalFullName }} mountPath: /apollo-portal/config/apollo-env.properties subPath: apollo-env.properties {{- range $fileName, $content := .Values.config.files }} - name: configmap-{{ $portalFullName }} mountPath: /apollo-portal/config/{{ $fileName }} subPath: {{ $fileName }} {{- end }} livenessProbe: tcpSocket: port: {{ .Values.containerPort }} initialDelaySeconds: {{ .Values.liveness.initialDelaySeconds }} periodSeconds: {{ .Values.liveness.periodSeconds }} readinessProbe: httpGet: path: {{ .Values.config.contextPath }}/health port: {{ .Values.containerPort }} initialDelaySeconds: {{ .Values.readiness.initialDelaySeconds }} periodSeconds: {{ .Values.readiness.periodSeconds }} resources: {{- toYaml .Values.resources | nindent 12 }} {{- with .Values.nodeSelector }} nodeSelector: {{- toYaml . | nindent 8 }} {{- end }} {{- with .Values.affinity }} affinity: {{- toYaml . | nindent 8 }} {{- end }} {{- with .Values.tolerations }} tolerations: {{- toYaml . | nindent 8 }} {{- end }}