statefulset.yaml 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. {{- if eq .Values.mode "statefulset" -}}
  2. apiVersion: apps/v1
  3. kind: StatefulSet
  4. metadata:
  5. name: {{ include "opentelemetry-collector.fullname" . }}
  6. namespace: {{ template "opentelemetry-collector.namespace" . }}
  7. labels:
  8. {{- include "opentelemetry-collector.labels" . | nindent 4 }}
  9. {{- if .Values.annotations }}
  10. annotations:
  11. {{- range $key, $value := .Values.annotations }}
  12. {{- printf "%s: %s" $key (tpl $value $ | quote) | nindent 4 }}
  13. {{- end }}
  14. {{- end }}
  15. spec:
  16. serviceName: {{ include "opentelemetry-collector.fullname" . }}
  17. podManagementPolicy: {{ .Values.statefulset.podManagementPolicy }}
  18. {{- if not .Values.autoscaling.enabled }}
  19. replicas: {{ .Values.replicaCount }}
  20. {{- end }}
  21. {{- if .Values.statefulset.persistentVolumeClaimRetentionPolicy.enabled }}
  22. persistentVolumeClaimRetentionPolicy:
  23. whenDeleted: {{ .Values.statefulset.persistentVolumeClaimRetentionPolicy.whenDeleted }}
  24. whenScaled: {{ .Values.statefulset.persistentVolumeClaimRetentionPolicy.whenScaled }}
  25. {{- end }}
  26. selector:
  27. matchLabels:
  28. {{- include "opentelemetry-collector.selectorLabels" . | nindent 6 }}
  29. {{- include "opentelemetry-collector.component" . | nindent 6 }}
  30. updateStrategy:
  31. type: {{ .Values.rollout.strategy }}
  32. template:
  33. metadata:
  34. annotations:
  35. checksum/config: {{ include (print $.Template.BasePath "/configmap-statefulset.yaml") . | sha256sum }}
  36. {{- include "opentelemetry-collector.podAnnotations" . | nindent 8 }}
  37. labels:
  38. {{- include "opentelemetry-collector.selectorLabels" . | nindent 8 }}
  39. {{- include "opentelemetry-collector.component" . | nindent 8 }}
  40. {{- include "opentelemetry-collector.podLabels" . | nindent 8 }}
  41. spec:
  42. {{- with .Values.dnsPolicy }}
  43. dnsPolicy: {{ . }}
  44. {{- end }}
  45. {{- with .Values.dnsConfig }}
  46. dnsConfig:
  47. {{- toYaml . | nindent 8 }}
  48. {{- end }}
  49. {{- $podValues := deepCopy .Values }}
  50. {{- $podData := dict "Values" $podValues "configmapSuffix" "-statefulset" "isAgent" false }}
  51. {{- include "opentelemetry-collector.pod" ($podData | mustMergeOverwrite (deepCopy .)) | nindent 6 }}
  52. hostNetwork: {{ .Values.hostNetwork }}
  53. {{- with .Values.statefulset.volumeClaimTemplates }}
  54. volumeClaimTemplates:
  55. {{- toYaml . | nindent 2 }}
  56. {{- end }}
  57. {{- end }}