app-deployment.yaml 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899
  1. apiVersion: apps/v1
  2. kind: Deployment
  3. metadata:
  4. name: {{ include "deepflow.fullname" . }}-app
  5. labels:
  6. {{- include "deepflow-app.labels" . | nindent 4 }}
  7. spec:
  8. replicas: {{ tpl (toString .Values.app.replicas) . }}
  9. selector:
  10. matchLabels:
  11. {{- include "deepflow-app.selectorLabels" . | nindent 6 }}
  12. template:
  13. metadata:
  14. annotations:
  15. {{- with .Values.podAnnotations }}
  16. {{- toYaml . | nindent 8 }}
  17. {{- end }}
  18. checksum/config: {{ include (print $.Template.BasePath "/configmap.yaml") . | sha256sum }}
  19. checksum/customConfig: {{ sha256sum (print (tpl (toYaml .Values.configmap) $)) }}
  20. labels:
  21. {{- include "deepflow-app.selectorLabels" . | nindent 8 }}
  22. {{- with .Values.app.podLabels }}
  23. {{- toYaml . | nindent 8 }}
  24. {{- end }}
  25. spec:
  26. hostNetwork: {{ tpl .Values.app.hostNetwork . }}
  27. dnsPolicy: {{ tpl .Values.app.dnsPolicy . }}
  28. imagePullSecrets:
  29. {{- with .Values.global.imagePullSecrets }}
  30. {{- toYaml . | nindent 8 }}
  31. {{- end }}
  32. {{- with .Values.imagePullSecrets }}
  33. {{- toYaml . | nindent 8 }}
  34. {{- end }}
  35. securityContext:
  36. {{- toYaml .Values.podSecurityContext | nindent 8 }}
  37. containers:
  38. - name: deepflow-app
  39. securityContext:
  40. {{- toYaml .Values.securityContext | nindent 12 }}
  41. image: "{{ tpl .Values.image.app.repository . }}:{{ tpl .Values.image.app.tag . }}"
  42. imagePullPolicy: "{{ tpl .Values.image.app.pullPolicy . }}"
  43. ports:
  44. - name: app
  45. containerPort: 20418
  46. protocol: TCP
  47. livenessProbe:
  48. {{ toYaml .Values.app.livenessProbe | nindent 12 }}
  49. readinessProbe:
  50. {{ toYaml .Values.app.readinessProbe | nindent 12 }}
  51. resources:
  52. {{- toYaml .Values.app.resources | nindent 12 }}
  53. volumeMounts:
  54. - name: app-config
  55. mountPath: /etc/deepflow/app.yaml
  56. subPath: app.yaml
  57. env:
  58. - name: K8S_NODE_IP_FOR_DEEPFLOW
  59. valueFrom:
  60. fieldRef:
  61. fieldPath: status.hostIP
  62. - name: K8S_NODE_NAME_FOR_DEEPFLOW
  63. valueFrom:
  64. fieldRef:
  65. fieldPath: spec.nodeName
  66. - name: K8S_POD_NAME_FOR_DEEPFLOW
  67. valueFrom:
  68. fieldRef:
  69. fieldPath: metadata.name
  70. - name: K8S_POD_IP_FOR_DEEPFLOW
  71. valueFrom:
  72. fieldRef:
  73. fieldPath: status.podIP
  74. - name: TZ
  75. value: "{{ tpl .Values.timezone . }}"
  76. volumes:
  77. - name: app-config
  78. configMap:
  79. name: {{ include "deepflow.fullname" . }}
  80. items:
  81. - key: app.yaml
  82. path: app.yaml
  83. {{- with .Values.app.nodeSelector }}
  84. nodeSelector:
  85. {{- toYaml . | nindent 8 }}
  86. {{- end }}
  87. affinity:
  88. {{- include "appNodeaffinity" . | indent 6 }}
  89. {{- include "appPodAffinity" . | indent 6 }}
  90. {{- include "appPodAntiAffinity" . | indent 6 }}
  91. {{- if or .Values.global.tolerations .Values.tolerations }}
  92. tolerations:
  93. {{- if .Values.global.tolerations }}
  94. {{- toYaml .Values.global.tolerations | nindent 8 }}
  95. {{- end }}
  96. {{- if .Values.tolerations }}
  97. {{- toYaml .Values.tolerations | nindent 8 }}
  98. {{- end }}
  99. {{- end }}