StatefulSet.yaml 5.0 KB

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