| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114 |
- {{/*
- Base library chart helpers for reusable resources.
- These templates are included by service subcharts.
- */}}
- {{- define "base.configmap" -}}
- {{- if .Values.config.enabled }}
- apiVersion: v1
- kind: ConfigMap
- metadata:
- name: {{ .Values.app.name }}-config
- labels:
- app: {{ .Values.app.name }}
- data:
- application.properties: |
- spring.application.name={{ .Values.app.name }}
- spring.protocol.name=spring
- server.port={{ .Values.service.targetPort }}
- application.yml: |
- {{- .Values.config.yml | toYaml | nindent 4 }}
- {{- end }}
- {{- end }}
- {{- define "base.deployment" -}}
- apiVersion: apps/v1
- kind: Deployment
- metadata:
- name: {{ .Values.app.name }}
- labels:
- app: {{ .Values.app.name }}
- spec:
- replicas: {{ .Values.app.replicaCount }}
- selector:
- matchLabels:
- app: {{ .Values.app.name }}
- template:
- metadata:
- labels:
- app: {{ .Values.app.name }}
- {{- with .Values.podAnnotations }}
- annotations:
- {{- toYaml . | nindent 8 }}
- {{- end }}
- spec:
- {{- with .Values.securityContext }}
- securityContext:
- {{- toYaml . | nindent 8 }}
- {{- end }}
- containers:
- - name: {{ .Values.app.name }}
- image: "{{ .Values.image.repository }}:{{ .Values.image.tag }}"
- imagePullPolicy: {{ .Values.image.pullPolicy }}
- ports:
- - name: http
- containerPort: {{ .Values.service.targetPort }}
- protocol: TCP
- volumeMounts:
- - name: config-volume
- mountPath: /etc/config
- readOnly: true
- env:
- - name: JAVA_OPTS
- value: "-Xmx512m -Xms256m"
- {{- with .Values.resources }}
- resources:
- {{- toYaml . | nindent 12 }}
- {{- end }}
- livenessProbe:
- httpGet:
- path: /actuator/health
- port: http
- initialDelaySeconds: 30
- periodSeconds: 10
- readinessProbe:
- httpGet:
- path: /actuator/health
- port: http
- initialDelaySeconds: 5
- periodSeconds: 5
- volumes:
- - name: config-volume
- configMap:
- name: {{ .Values.app.name }}-config
- {{- with .Values.nodeSelector }}
- nodeSelector:
- {{- toYaml . | nindent 8 }}
- {{- end }}
- {{- with .Values.affinity }}
- affinity:
- {{- toYaml . | nindent 8 }}
- {{- end }}
- {{- with .Values.tolerations }}
- tolerations:
- {{- toYaml . | nindent 8 }}
- {{- end }}
- {{- end }}
- {{- define "base.service" -}}
- apiVersion: v1
- kind: Service
- metadata:
- name: {{ .Values.app.name }}
- labels:
- app: {{ .Values.app.name }}
- spec:
- type: {{ .Values.service.type }}
- ports:
- - port: {{ .Values.service.port }}
- targetPort: http
- protocol: TCP
- name: http
- selector:
- app: {{ .Values.app.name }}
- {{- end }}
|