deployment.yaml 2.1 KB

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