deployment.yaml 2.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879
  1. {{- define "base.deployment" -}}
  2. apiVersion: apps/v1
  3. kind: Deployment
  4. metadata:
  5. name: {{ .Values.app.name }}
  6. labels:
  7. app: {{ .Values.app.name }}
  8. spec:
  9. replicas: {{ .Values.app.replicaCount }}
  10. revisionHistoryLimit: 3
  11. selector:
  12. matchLabels:
  13. app: {{ .Values.app.name }}
  14. template:
  15. metadata:
  16. labels:
  17. app: {{ .Values.app.name }}
  18. {{- with .Values.podAnnotations }}
  19. annotations:
  20. {{- toYaml . | nindent 8 }}
  21. {{- end }}
  22. spec:
  23. {{- with .Values.securityContext }}
  24. securityContext:
  25. {{- toYaml . | nindent 8 }}
  26. {{- end }}
  27. containers:
  28. - name: {{ .Values.app.name }}
  29. image: "{{ .Values.image.repository }}:{{ .Values.image.tag }}"
  30. imagePullPolicy: {{ .Values.image.pullPolicy }}
  31. ports:
  32. - name: http
  33. containerPort: {{ .Values.service.targetPort }}
  34. protocol: TCP
  35. {{- if .Values.service.dubbo_port }}
  36. - name: dubbo
  37. containerPort: {{ .Values.service.dubbo_port }}
  38. protocol: TCP
  39. {{- end }}
  40. volumeMounts:
  41. - name: config-volume
  42. mountPath: /etc/config
  43. readOnly: true
  44. env:
  45. - name: JAVA_OPTS
  46. value: "-Xmx512m -Xms256m"
  47. {{- with .Values.resources }}
  48. resources:
  49. {{- toYaml . | nindent 12 }}
  50. {{- end }}
  51. livenessProbe:
  52. httpGet:
  53. path: /actuator/health
  54. port: http
  55. initialDelaySeconds: 30
  56. periodSeconds: 10
  57. readinessProbe:
  58. httpGet:
  59. path: /actuator/health
  60. port: http
  61. initialDelaySeconds: 5
  62. periodSeconds: 5
  63. volumes:
  64. - name: config-volume
  65. configMap:
  66. name: {{ .Values.app.name }}-config
  67. {{- with .Values.nodeSelector }}
  68. nodeSelector:
  69. {{- toYaml . | nindent 8 }}
  70. {{- end }}
  71. {{- with .Values.affinity }}
  72. affinity:
  73. {{- toYaml . | nindent 8 }}
  74. {{- end }}
  75. {{- with .Values.tolerations }}
  76. tolerations:
  77. {{- toYaml . | nindent 8 }}
  78. {{- end }}
  79. {{- end }}