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.

148 lines
4.8 KiB

  1. # This YAML file contains driver-registrar & csi driver nodeplugin API objects,
  2. # which are necessary to run csi nodeplugin for cinder.
  3. kind: DaemonSet
  4. apiVersion: apps/v1
  5. metadata:
  6. name: csi-cinder-nodeplugin
  7. namespace: kube-system
  8. spec:
  9. selector:
  10. matchLabels:
  11. app: csi-cinder-nodeplugin
  12. template:
  13. metadata:
  14. labels:
  15. app: csi-cinder-nodeplugin
  16. spec:
  17. tolerations:
  18. - operator: Exists
  19. serviceAccountName: csi-cinder-node-sa
  20. hostNetwork: true
  21. dnsPolicy: ClusterFirstWithHostNet
  22. containers:
  23. - name: node-driver-registrar
  24. image: {{ csi_node_driver_registrar_image_repo }}:{{ csi_node_driver_registrar_image_tag }}
  25. imagePullPolicy: {{ k8s_image_pull_policy }}
  26. args:
  27. - "--csi-address=$(ADDRESS)"
  28. - "--kubelet-registration-path=$(DRIVER_REG_SOCK_PATH)"
  29. env:
  30. - name: ADDRESS
  31. value: /csi/csi.sock
  32. - name: DRIVER_REG_SOCK_PATH
  33. value: /var/lib/kubelet/plugins/cinder.csi.openstack.org/csi.sock
  34. - name: KUBE_NODE_NAME
  35. valueFrom:
  36. fieldRef:
  37. fieldPath: spec.nodeName
  38. volumeMounts:
  39. - name: socket-dir
  40. mountPath: /csi
  41. - name: registration-dir
  42. mountPath: /registration
  43. - name: liveness-probe
  44. image: {{ csi_livenessprobe_image_repo }}:{{ csi_livenessprobe_image_tag }}
  45. args:
  46. - "--csi-address=/csi/csi.sock"
  47. volumeMounts:
  48. - name: socket-dir
  49. mountPath: /csi
  50. - name: cinder-csi-plugin
  51. securityContext:
  52. privileged: true
  53. capabilities:
  54. add: ["SYS_ADMIN"]
  55. allowPrivilegeEscalation: true
  56. image: {{ cinder_csi_plugin_image_repo }}:{{ cinder_csi_plugin_image_tag }}
  57. imagePullPolicy: {{ k8s_image_pull_policy }}
  58. args:
  59. - /bin/cinder-csi-plugin
  60. - "--endpoint=$(CSI_ENDPOINT)"
  61. - "--cloud-config=$(CLOUD_CONFIG)"
  62. env:
  63. - name: CSI_ENDPOINT
  64. value: unix://csi/csi.sock
  65. - name: CLOUD_CONFIG
  66. value: /etc/config/cloud.conf
  67. ports:
  68. - containerPort: 9808
  69. name: healthz
  70. protocol: TCP
  71. livenessProbe:
  72. failureThreshold: 5
  73. httpGet:
  74. path: /healthz
  75. port: healthz
  76. initialDelaySeconds: 10
  77. timeoutSeconds: 3
  78. periodSeconds: 10
  79. volumeMounts:
  80. - name: socket-dir
  81. mountPath: /csi
  82. - name: kubelet-dir
  83. mountPath: /var/lib/kubelet
  84. mountPropagation: "Bidirectional"
  85. - name: pods-probe-dir
  86. mountPath: /dev
  87. mountPropagation: "HostToContainer"
  88. - name: secret-cinderplugin
  89. mountPath: /etc/config
  90. readOnly: true
  91. - name: ca-certs
  92. mountPath: /etc/ssl/certs
  93. readOnly: true
  94. {% if ssl_ca_dirs | length %}
  95. {% for dir in ssl_ca_dirs %}
  96. - name: {{ dir | regex_replace('^/(.*)$', '\\1' ) | regex_replace('/', '-') }}
  97. mountPath: {{ dir }}
  98. readOnly: true
  99. {% endfor %}
  100. {% endif %}
  101. {% if cinder_cacert is defined and cinder_cacert != "" %}
  102. - name: cinder-cacert
  103. mountPath: {{ kube_config_dir }}/cinder-cacert.pem
  104. readOnly: true
  105. {% endif %}
  106. volumes:
  107. - name: socket-dir
  108. hostPath:
  109. path: /var/lib/kubelet/plugins/cinder.csi.openstack.org
  110. type: DirectoryOrCreate
  111. - name: registration-dir
  112. hostPath:
  113. path: /var/lib/kubelet/plugins_registry/
  114. type: Directory
  115. - name: kubelet-dir
  116. hostPath:
  117. path: /var/lib/kubelet
  118. type: Directory
  119. - name: pods-probe-dir
  120. hostPath:
  121. path: /dev
  122. type: Directory
  123. - name: secret-cinderplugin
  124. secret:
  125. secretName: cloud-config
  126. - name: ca-certs
  127. hostPath:
  128. path: /etc/ssl/certs
  129. type: DirectoryOrCreate
  130. {% if ssl_ca_dirs | length %}
  131. {% for dir in ssl_ca_dirs %}
  132. - name: {{ dir | regex_replace('^/(.*)$', '\\1' ) | regex_replace('/', '-') }}
  133. hostPath:
  134. path: {{ dir }}
  135. type: DirectoryOrCreate
  136. {% endfor %}
  137. {% endif %}
  138. {% if cinder_cacert is defined and cinder_cacert != "" %}
  139. - name: cinder-cacert
  140. hostPath:
  141. path: {{ kube_config_dir }}/cinder-cacert.pem
  142. type: FileOrCreate
  143. {% endif %}
  144. {% if cinder_tolerations %}
  145. tolerations:
  146. {{ cinder_tolerations | to_nice_yaml(indent=2) | indent(width=8) }}
  147. {% endif %}