deployment.yaml 3.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889
  1. {{- range $name, $component := .Values.components }}
  2. ---
  3. apiVersion: apps/v1
  4. kind: Deployment
  5. metadata:
  6. name: {{ include "chart.componentFullname" (dict "root" $ "name" $name) }}
  7. labels:
  8. {{- include "chart.componentLabels" (dict "root" $ "name" $name) | nindent 4 }}
  9. spec:
  10. {{- if not $component.autoscaling.enabled }}
  11. replicas: {{ $component.replicaCount }}
  12. {{- end }}
  13. selector:
  14. matchLabels:
  15. {{- include "chart.componentSelectorLabels" (dict "root" $ "name" $name) | nindent 6 }}
  16. template:
  17. metadata:
  18. {{- with $component.podAnnotations }}
  19. annotations:
  20. {{- toYaml . | nindent 8 }}
  21. {{- end }}
  22. labels:
  23. {{- include "chart.componentLabels" (dict "root" $ "name" $name) | nindent 8 }}
  24. {{- with $component.podLabels }}
  25. {{- toYaml . | nindent 8 }}
  26. {{- end }}
  27. spec:
  28. {{- with $.Values.imagePullSecrets }}
  29. imagePullSecrets:
  30. {{- toYaml . | nindent 8 }}
  31. {{- end }}
  32. serviceAccountName: {{ include "chart.serviceAccountName" $ }}
  33. {{- with (default $.Values.podSecurityContext $component.podSecurityContext) }}
  34. securityContext:
  35. {{- toYaml . | nindent 8 }}
  36. {{- end }}
  37. containers:
  38. - name: {{ $name }}
  39. {{- with (default $.Values.securityContext $component.securityContext) }}
  40. securityContext:
  41. {{- toYaml . | nindent 12 }}
  42. {{- end }}
  43. image: "{{ $component.image.repository }}:{{ $component.image.tag | default $.Chart.AppVersion }}"
  44. imagePullPolicy: {{ $component.image.pullPolicy }}
  45. ports:
  46. - name: {{ $component.service.portName | default "http" }}
  47. containerPort: {{ $component.containerPort | default $component.service.port }}
  48. protocol: TCP
  49. {{- with $component.env }}
  50. env:
  51. {{- tpl (toYaml .) $ | nindent 12 }}
  52. {{- end }}
  53. {{- with $component.envFrom }}
  54. envFrom:
  55. {{- tpl (toYaml .) $ | nindent 12 }}
  56. {{- end }}
  57. {{- with $component.livenessProbe }}
  58. livenessProbe:
  59. {{- toYaml . | nindent 12 }}
  60. {{- end }}
  61. {{- with $component.readinessProbe }}
  62. readinessProbe:
  63. {{- toYaml . | nindent 12 }}
  64. {{- end }}
  65. {{- with $component.resources }}
  66. resources:
  67. {{- toYaml . | nindent 12 }}
  68. {{- end }}
  69. {{- with $component.volumeMounts }}
  70. volumeMounts:
  71. {{- tpl (toYaml .) $ | nindent 12 }}
  72. {{- end }}
  73. {{- with $component.volumes }}
  74. volumes:
  75. {{- tpl (toYaml .) $ | nindent 8 }}
  76. {{- end }}
  77. {{- with $.Values.nodeSelector }}
  78. nodeSelector:
  79. {{- toYaml . | nindent 8 }}
  80. {{- end }}
  81. {{- with $.Values.affinity }}
  82. affinity:
  83. {{- toYaml . | nindent 8 }}
  84. {{- end }}
  85. {{- with $.Values.tolerations }}
  86. tolerations:
  87. {{- toYaml . | nindent 8 }}
  88. {{- end }}
  89. {{- end }}