StatefulSet.yaml 4.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130
  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: kuiper-config
  53. configMap:
  54. name: {{ include "kuiper.fullname" . }}
  55. items:
  56. - key: mqtt_source.yaml
  57. path: mqtt_source.yaml
  58. - key: kuiper.yaml
  59. path: kuiper.yaml
  60. - key: client.yaml
  61. path: client.yaml
  62. - key: edgex.yaml
  63. path: edgex.yaml
  64. - key: random.yaml
  65. path: random.yaml
  66. - key: zmq.yaml
  67. path: zmq.yaml
  68. {{ $certificationSecretName := index .Values "kuiperConfig" "mqtt_source.yaml" "default" "certificationSecretName" }}
  69. {{- if $certificationSecretName }}
  70. - name: kuiper-certification
  71. secret:
  72. secretName: {{ $certificationSecretName }}
  73. {{- end }}
  74. {{ $privateKeySecretName := index .Values "kuiperConfig" "mqtt_source.yaml" "default" "privateKeySecretName" }}
  75. {{- if $privateKeySecretName }}
  76. - name: kuiper-private-key
  77. secret:
  78. secretName: {{ $privateKeySecretName }}
  79. {{- end }}
  80. containers:
  81. - name: kuiper
  82. image: "{{ .Values.image.repository }}:{{ .Chart.AppVersion }}"
  83. imagePullPolicy: {{ .Values.image.pullPolicy }}
  84. volumeMounts:
  85. - name: kuiper-data
  86. mountPath: "/kuiper/data"
  87. - name: kuiper-config
  88. mountPath: "/kuiper/etc/mqtt_source.yaml"
  89. subPath: "mqtt_source.yaml"
  90. - name: kuiper-config
  91. mountPath: "/kuiper/etc/kuiper.yaml"
  92. subPath: "kuiper.yaml"
  93. - name: kuiper-config
  94. mountPath: "/kuiper/etc/client.yaml"
  95. subPath: "client.yaml"
  96. - name: kuiper-config
  97. mountPath: "/kuiper/etc/sources/edgex.yaml"
  98. subPath: "edgex.yaml"
  99. - name: kuiper-config
  100. mountPath: "/kuiper/etc/sources/random.yaml"
  101. subPath: "random.yaml"
  102. - name: kuiper-config
  103. mountPath: "/kuiper/etc/sources/zmq.yaml"
  104. subPath: "zmq.yaml"
  105. {{ $certificationSecretName := index .Values "kuiperConfig" "mqtt_source.yaml" "default" "certificationSecretName" }}
  106. {{- if $certificationSecretName }}
  107. - name: kuiper-certification
  108. mountPath: {{ index .Values "kuiperConfig" "mqtt_source.yaml" "default" "certificationPath" | default "/var/kuiper/certificate.pem" }}
  109. readOnly: true
  110. {{ end }}
  111. {{ $privateKeySecretName := index .Values "kuiperConfig" "mqtt_source.yaml" "default" "privateKeySecretName" }}
  112. {{- if $privateKeySecretName }}
  113. - name: kuiper-private-key
  114. mountPath: {{ index .Values "kuiperConfig" "mqtt_source.yaml" "default" "privateKeyPath" | default "/var/kuiper/private.pem.key" }}
  115. readOnly: true
  116. {{ end }}
  117. resources:
  118. {{- toYaml .Values.resources | nindent 12 }}
  119. {{- with .Values.nodeSelector }}
  120. nodeSelector:
  121. {{- toYaml . | nindent 8 }}
  122. {{- end }}
  123. {{- with .Values.affinity }}
  124. affinity:
  125. {{- toYaml . | nindent 8 }}
  126. {{- end }}
  127. {{- with .Values.tolerations }}
  128. tolerations:
  129. {{- toYaml . | nindent 8 }}
  130. {{- end }}