Files
CmiiDeploy/6-厦门移动-4.1.0/2-helm-chart/charts/frontend-app/templates/deployment.yaml
zeaslity 437acbeb63 add
2024-10-30 16:30:51 +08:00

102 lines
3.3 KiB
YAML

{{- if .Values.enabled }}
{{- $namespace := .Release.Namespace -}}
{{- $scope := $ -}}
{{- range .Values.application.manifest }}
{{- if .enabled -}}
{{- $applicationName := .name | trunc 63 }}
{{- $applicationShortName := trimPrefix "cmii-uav-platform" $applicationName }}
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: {{ $applicationName }}
namespace: {{ $namespace }}
labels:
cmii.type: {{ $.Values.application.type }}
cmii.app: {{ $applicationName }}
helm.sh/chart: {{ include "frontend-app.chart" $scope }}
app.kubernetes.io/managed-by: {{ $.Release.Service }}
app.kubernetes.io/chart-version: {{ $.Chart.AppVersion | quote }}
app.kubernetes.io/app-version: {{ $.Values.global.image.tag | quote }}
spec:
replicas: {{ $.Values.replicaCount }}
strategy:
rollingUpdate:
maxUnavailable: 1
selector:
matchLabels:
cmii.type: {{ $.Values.application.type }}
cmii.app: {{ $applicationName }}
template:
metadata:
{{- with $.Values.podAnnotations }}
annotations:
{{- toYaml . | nindent 8 }}
{{- end }}
labels:
cmii.type: {{ $.Values.application.type }}
cmii.app: {{ $applicationName }}
spec:
imagePullSecrets:
- name: harborsecret
securityContext:
{{- toYaml $.Values.podSecurityContext | nindent 8 }}
containers:
- name: {{ $applicationName }}
image: "{{ default $.Values.global.image.repository }}/{{ $applicationName }}:{{ .tag }}"
imagePullPolicy: {{ default $.Values.global.image.pullPolicy }}
env:
- name: K8S_NAMESPACE
value: {{ $namespace }}
- name: APPLICATION_NAME
value: {{ $applicationName }}
ports:
- name: platform-9528
containerPort: 9528
protocol: TCP
resources:
limits:
cpu: "1"
memory: 1Gi
requests:
cpu: 500m
memory: 500Mi
volumeMounts:
- name: nginx-conf
mountPath: /usr/local/nginx/conf/nginx.conf
subPath: nginx.conf
- name: default-nginx-conf
mountPath: /etc/nginx/conf.d/default.conf
subPath: default.conf
- name: tenant-prefix
subPath: ingress-config.js
mountPath: /home/cmii-platform/dist/ingress-config.js
volumes:
- name: nginx-conf
configMap:
name: nginx-cm
items:
- key: nginx.conf
path: nginx.conf
- name: default-nginx-conf
configMap:
name: default-nginx-cm
items:
- key: default.conf
path: default.conf
- name: tenant-prefix
configMap:
{{- if eq $applicationShortName "" }}
name: tenant-prefix-platform
{{- else if eq $applicationShortName "-hyperspectral" }}
name: tenant-prefix-hyper
{{- else }}
name: tenant-prefix{{ $applicationShortName }}
{{- end }}
items:
- key: ingress-config.js
path: ingress-config.js
{{- end }}
{{- end }}
{{- end }}