You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

191 lines
6.8 KiB

  1. # This YAML file contains CSI Controller Plugin Sidecars
  2. # external-attacher, external-provisioner, external-snapshotter
  3. # external-resize, liveness-probe
  4. ---
  5. kind: Deployment
  6. apiVersion: apps/v1
  7. metadata:
  8. name: csi-cinder-controllerplugin
  9. namespace: kube-system
  10. spec:
  11. replicas: {{ cinder_csi_controller_replicas }}
  12. selector:
  13. matchLabels:
  14. app: csi-cinder-controllerplugin
  15. template:
  16. metadata:
  17. labels:
  18. app: csi-cinder-controllerplugin
  19. spec:
  20. serviceAccount: csi-cinder-controller-sa
  21. containers:
  22. - name: csi-attacher
  23. image: {{ csi_attacher_image_repo }}:{{ cinder_csi_attacher_image_tag }}
  24. imagePullPolicy: {{ k8s_image_pull_policy }}
  25. args:
  26. - "--csi-address=$(ADDRESS)"
  27. - "--timeout=3m"
  28. {% if cinder_csi_controller_replicas is defined and cinder_csi_controller_replicas > 1 %}
  29. - --leader-election=true
  30. {% endif %}
  31. - "--default-fstype=ext4"
  32. {% for key, value in cinder_csi_attacher_extra_args.items() %}
  33. - "{{ '--' + key + '=' + value }}"
  34. {% endfor %}
  35. env:
  36. - name: ADDRESS
  37. value: /var/lib/csi/sockets/pluginproxy/csi.sock
  38. volumeMounts:
  39. - name: socket-dir
  40. mountPath: /var/lib/csi/sockets/pluginproxy/
  41. - name: csi-provisioner
  42. image: {{ csi_provisioner_image_repo }}:{{ cinder_csi_provisioner_image_tag }}
  43. imagePullPolicy: {{ k8s_image_pull_policy }}
  44. args:
  45. - "--csi-address=$(ADDRESS)"
  46. - "--timeout=3m"
  47. - "--default-fstype=ext4"
  48. - "--extra-create-metadata"
  49. {% if cinder_topology is defined and cinder_topology %}
  50. - --feature-gates=Topology=true
  51. {% endif %}
  52. {% if cinder_csi_controller_replicas is defined and cinder_csi_controller_replicas > 1 %}
  53. - "--leader-election=true"
  54. {% endif %}
  55. {% for key, value in cinder_csi_provisioner_extra_args.items() %}
  56. - "{{ '--' + key + '=' + value }}"
  57. {% endfor %}
  58. env:
  59. - name: ADDRESS
  60. value: /var/lib/csi/sockets/pluginproxy/csi.sock
  61. volumeMounts:
  62. - name: socket-dir
  63. mountPath: /var/lib/csi/sockets/pluginproxy/
  64. - name: csi-snapshotter
  65. image: {{ csi_snapshotter_image_repo }}:{{ cinder_csi_snapshotter_image_tag }}
  66. imagePullPolicy: {{ k8s_image_pull_policy }}
  67. args:
  68. - "--csi-address=$(ADDRESS)"
  69. - "--timeout=3m"
  70. - "--extra-create-metadata"
  71. {% if cinder_csi_controller_replicas is defined and cinder_csi_controller_replicas > 1 %}
  72. - --leader-election=true
  73. {% endif %}
  74. {% for key, value in cinder_csi_snapshotter_extra_args.items() %}
  75. - "{{ '--' + key + '=' + value }}"
  76. {% endfor %}
  77. env:
  78. - name: ADDRESS
  79. value: /var/lib/csi/sockets/pluginproxy/csi.sock
  80. volumeMounts:
  81. - mountPath: /var/lib/csi/sockets/pluginproxy/
  82. name: socket-dir
  83. - name: csi-resizer
  84. image: {{ csi_resizer_image_repo }}:{{ cinder_csi_resizer_image_tag }}
  85. imagePullPolicy: {{ k8s_image_pull_policy }}
  86. args:
  87. - "--csi-address=$(ADDRESS)"
  88. - "--timeout=3m"
  89. - "--handle-volume-inuse-error=false"
  90. {% if cinder_csi_controller_replicas is defined and cinder_csi_controller_replicas > 1 %}
  91. - --leader-election=true
  92. {% endif %}
  93. {% for key, value in cinder_csi_resizer_extra_args.items() %}
  94. - "{{ '--' + key + '=' + value }}"
  95. {% endfor %}
  96. env:
  97. - name: ADDRESS
  98. value: /var/lib/csi/sockets/pluginproxy/csi.sock
  99. volumeMounts:
  100. - name: socket-dir
  101. mountPath: /var/lib/csi/sockets/pluginproxy/
  102. - name: liveness-probe
  103. image: {{ csi_livenessprobe_image_repo }}:{{ cinder_csi_livenessprobe_image_tag }}
  104. imagePullPolicy: {{ k8s_image_pull_policy }}
  105. args:
  106. - "--csi-address=$(ADDRESS)"
  107. {% for key, value in cinder_liveness_probe_extra_args.items() %}
  108. - "{{ '--' + key + '=' + value }}"
  109. {% endfor %}
  110. env:
  111. - name: ADDRESS
  112. value: /var/lib/csi/sockets/pluginproxy/csi.sock
  113. volumeMounts:
  114. - mountPath: /var/lib/csi/sockets/pluginproxy/
  115. name: socket-dir
  116. - name: cinder-csi-plugin
  117. image: {{ cinder_csi_plugin_image_repo }}:{{ cinder_csi_plugin_image_tag }}
  118. imagePullPolicy: {{ k8s_image_pull_policy }}
  119. args:
  120. - /bin/cinder-csi-plugin
  121. - "--endpoint=$(CSI_ENDPOINT)"
  122. - "--cloud-config=$(CLOUD_CONFIG)"
  123. - "--cluster=$(CLUSTER_NAME)"
  124. {% for key, value in cinder_csi_plugin_extra_args.items() %}
  125. - "{{ '--' + key + '=' + value }}"
  126. {% endfor %}
  127. env:
  128. - name: CSI_ENDPOINT
  129. value: unix://csi/csi.sock
  130. - name: CLOUD_CONFIG
  131. value: /etc/config/cloud.conf
  132. - name: CLUSTER_NAME
  133. value: {{ cluster_name }}
  134. ports:
  135. - containerPort: 9808
  136. name: healthz
  137. protocol: TCP
  138. livenessProbe:
  139. failureThreshold: 5
  140. httpGet:
  141. path: /healthz
  142. port: healthz
  143. initialDelaySeconds: 10
  144. timeoutSeconds: 10
  145. periodSeconds: 60
  146. volumeMounts:
  147. - name: socket-dir
  148. mountPath: /csi
  149. - name: secret-cinderplugin
  150. mountPath: /etc/config
  151. readOnly: true
  152. - name: ca-certs
  153. mountPath: /etc/ssl/certs
  154. readOnly: true
  155. {% if ssl_ca_dirs | length %}
  156. {% for dir in ssl_ca_dirs %}
  157. - name: {{ dir | regex_replace('^/(.*)$', '\\1' ) | regex_replace('/', '-') }}
  158. mountPath: {{ dir }}
  159. readOnly: true
  160. {% endfor %}
  161. {% endif %}
  162. {% if cinder_cacert is defined and cinder_cacert != "" %}
  163. - name: cinder-cacert
  164. mountPath: {{ kube_config_dir }}/cinder-cacert.pem
  165. readOnly: true
  166. {% endif %}
  167. volumes:
  168. - name: socket-dir
  169. emptyDir:
  170. - name: secret-cinderplugin
  171. secret:
  172. secretName: cloud-config
  173. - name: ca-certs
  174. hostPath:
  175. path: /etc/ssl/certs
  176. type: DirectoryOrCreate
  177. {% if ssl_ca_dirs | length %}
  178. {% for dir in ssl_ca_dirs %}
  179. - name: {{ dir | regex_replace('^/(.*)$', '\\1' ) | regex_replace('/', '-') }}
  180. hostPath:
  181. path: {{ dir }}
  182. type: DirectoryOrCreate
  183. {% endfor %}
  184. {% endif %}
  185. {% if cinder_cacert is defined and cinder_cacert != "" %}
  186. - name: cinder-cacert
  187. hostPath:
  188. path: {{ kube_config_dir }}/cinder-cacert.pem
  189. type: FileOrCreate
  190. {% endif %}