StatefulSet.yaml 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101
  1. apiVersion: apps/v1
  2. kind: StatefulSet
  3. metadata:
  4. name: {{ include "kuiper.fullname" . }}
  5. namespace: {{ .Release.Namespace }}
  6. labels:
  7. {{- include "kuiper.labels" . | nindent 4 }}
  8. spec:
  9. replicas: {{ .Values.replicaCount }}
  10. serviceName: {{ include "kuiper.fullname" . }}-headless
  11. {{- if and .Values.persistence.enabled (not .Values.persistence.existingClaim) }}
  12. volumeClaimTemplates:
  13. - metadata:
  14. name: kuiper-data
  15. namespace: {{ .Release.Namespace }}
  16. labels:
  17. {{- include "kuiper.labels" . | nindent 4 }}
  18. annotations:
  19. {{- if .Values.persistence.storageClass }}
  20. volume.beta.kubernetes.io/storage-class: {{ .Values.persistence.storageClass | quote }}
  21. {{- else }}
  22. volume.alpha.kubernetes.io/storage-class: default
  23. {{- end }}
  24. spec:
  25. accessModes:
  26. - {{ .Values.persistence.accessMode | quote }}
  27. resources:
  28. requests:
  29. storage: {{ .Values.persistence.size | quote }}
  30. {{- end }}
  31. selector:
  32. matchLabels:
  33. {{- include "kuiper.selectorLabels" . | nindent 6 }}
  34. template:
  35. metadata:
  36. labels:
  37. {{- include "kuiper.selectorLabels" . | nindent 8 }}
  38. spec:
  39. # securityContext:
  40. # fsGroup: 1000
  41. volumes:
  42. {{- if not .Values.persistence.enabled }}
  43. - name: kuiper-data
  44. emptyDir: {}
  45. {{- else if .Values.persistence.existingClaim }}
  46. - name: kuiper-data
  47. persistentVolumeClaim:
  48. {{- with .Values.persistence.existingClaim }}
  49. claimName: {{ tpl . $ }}
  50. {{- end }}
  51. {{- end }}
  52. - name: mqtt
  53. configMap:
  54. name: {{ include "kuiper.fullname" . }}
  55. items:
  56. - key: mqtt.yaml
  57. path: mqtt.yaml
  58. {{- if .Values.mqtt.certificationSecretName }}
  59. - name: kuiper-certification
  60. secret:
  61. secretName: {{ .Values.mqtt.certificationSecretName }}
  62. {{- end }}
  63. {{- if .Values.mqtt.privateKeySecretName }}
  64. - name: kuiper-private-key
  65. secret:
  66. secretName: {{ .Values.mqtt.privateKeySecretName }}
  67. {{- end }}
  68. containers:
  69. - name: kuiper
  70. image: "{{ .Values.image.repository }}:{{ .Chart.AppVersion }}"
  71. imagePullPolicy: {{ .Values.image.pullPolicy }}
  72. volumeMounts:
  73. - name: kuiper-data
  74. mountPath: "/kuiper/data"
  75. - name: mqtt
  76. mountPath: "/kuiper/etc/sources/mqtt.yaml"
  77. subPath: "mqtt.yaml"
  78. {{ if .Values.mqtt.certificationSecretName }}
  79. - name: kuiper-certification
  80. mountPath: {{ .Values.mqtt.certificationPath | default "/var/kuiper/certificate.pem" }}
  81. readOnly: true
  82. {{ end }}
  83. {{ if .Values.mqtt.privateKeySecretName }}
  84. - name: kuiper-private-key
  85. mountPath: {{ .Values.mqtt.privateKeyPath | default "/var/kuiper/private.pem.key" }}
  86. readOnly: true
  87. {{ end }}
  88. resources:
  89. {{- toYaml .Values.resources | nindent 12 }}
  90. {{- with .Values.nodeSelector }}
  91. nodeSelector:
  92. {{- toYaml . | nindent 8 }}
  93. {{- end }}
  94. {{- with .Values.affinity }}
  95. affinity:
  96. {{- toYaml . | nindent 8 }}
  97. {{- end }}
  98. {{- with .Values.tolerations }}
  99. tolerations:
  100. {{- toYaml . | nindent 8 }}
  101. {{- end }}