Add suport of Vsphere CSI driver 2.2.X versions (#7848)

This commit is contained in:
Eugene Artemenko 2021-08-09 18:19:38 +03:00 committed by GitHub
parent 82a9064d8d
commit e2b67b5700
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 106 additions and 0 deletions

View file

@ -34,6 +34,9 @@ You need to source the vSphere credentials you use to deploy your machines that
| vsphere_csi_node_driver_registrar_image_tag | TRUE | string | | "v1.1.0" | CSI node driver registrat image tag to use | | vsphere_csi_node_driver_registrar_image_tag | TRUE | string | | "v1.1.0" | CSI node driver registrat image tag to use |
| vsphere_csi_driver_image_tag | TRUE | string | | "v1.0.2" | CSI driver image tag to use | | vsphere_csi_driver_image_tag | TRUE | string | | "v1.0.2" | CSI driver image tag to use |
| vsphere_csi_resizer_tag | TRUE | string | | "v1.1.0" | CSI resizer image tag to use | vsphere_csi_resizer_tag | TRUE | string | | "v1.1.0" | CSI resizer image tag to use
| vsphere_csi_aggressive_node_drain | FALSE | boolean | | false | Enable aggressive node drain strategy |
| vsphere_csi_aggressive_node_unreachable_timeout | FALSE | int | 300 | | Timeout till node will be drained when it in an unreachable state |
| vsphere_csi_aggressive_node_not_ready_timeout | FALSE | int | 300 | | Timeout till node will be drained when it in not-ready state |
## Usage example ## Usage example

View file

@ -16,3 +16,7 @@ vsphere_csi_resizer_tag: "v1.0.0"
vsphere_csi_controller_replicas: 1 vsphere_csi_controller_replicas: 1
csi_endpoint: '{% if external_vsphere_version >= "7.0u1" %}/csi{% else %}/var/lib/csi/sockets/pluginproxy{% endif %}' csi_endpoint: '{% if external_vsphere_version >= "7.0u1" %}/csi{% else %}/var/lib/csi/sockets/pluginproxy{% endif %}'
vsphere_csi_aggressive_node_drain: False
vsphere_csi_aggressive_node_unreachable_timeout: 300
vsphere_csi_aggressive_node_not_ready_timeout: 300

View file

@ -23,6 +23,7 @@
dest: "{{ kube_config_dir }}/{{ item }}" dest: "{{ kube_config_dir }}/{{ item }}"
with_items: with_items:
- vsphere-csi-controller-rbac.yml - vsphere-csi-controller-rbac.yml
- vsphere-csi-node-rbac.yaml
- "{{ controller_spec }}" - "{{ controller_spec }}"
- vsphere-csi-node.yml - vsphere-csi-node.yml
register: vsphere_csi_manifests register: vsphere_csi_manifests

View file

@ -28,6 +28,18 @@ spec:
- operator: "Exists" - operator: "Exists"
key: node-role.kubernetes.io/control-plane key: node-role.kubernetes.io/control-plane
effect: NoSchedule effect: NoSchedule
{% if vsphere_csi_aggressive_node_drain %}
# set below toleration if you need an aggressive pod eviction in case when
# node becomes not-ready or unreachable. Default is 300 seconds if not specified.
- key: node.kubernetes.io/not-ready
operator: Exists
effect: NoExecute
tolerationSeconds: {{ vsphere_csi_aggressive_node_not_ready_timeout }}
- key: node.kubernetes.io/unreachable
operator: Exists
effect: NoExecute
tolerationSeconds: {{ vsphere_csi_aggressive_node_unreachable_timeout }}
{% endif %}
dnsPolicy: "Default" dnsPolicy: "Default"
containers: containers:
- name: csi-attacher - name: csi-attacher
@ -51,6 +63,11 @@ spec:
- "--timeout=300s" - "--timeout=300s"
- "--csi-address=$(ADDRESS)" - "--csi-address=$(ADDRESS)"
- "--leader-election" - "--leader-election"
{% if vsphere_csi_controller is version('v2.2.0', '>=') %}
- "--handle-volume-inuse-error=false"
- "--kube-api-qps=100"
- "--kube-api-burst=100"
{% endif %}
env: env:
- name: ADDRESS - name: ADDRESS
value: /csi/csi.sock value: /csi/csi.sock
@ -97,6 +114,9 @@ spec:
- name: healthz - name: healthz
containerPort: 9808 containerPort: 9808
protocol: TCP protocol: TCP
- name: prometheus
containerPort: 2112
protocol: TCP
livenessProbe: livenessProbe:
httpGet: httpGet:
path: /healthz path: /healthz
@ -125,6 +145,10 @@ spec:
- "--fss-namespace=$(CSI_NAMESPACE)" - "--fss-namespace=$(CSI_NAMESPACE)"
{% endif %} {% endif %}
imagePullPolicy: {{ k8s_image_pull_policy }} imagePullPolicy: {{ k8s_image_pull_policy }}
ports:
- containerPort: 2113
name: prometheus
protocol: TCP
env: env:
- name: FULL_SYNC_INTERVAL_MINUTES - name: FULL_SYNC_INTERVAL_MINUTES
value: "30" value: "30"
@ -154,6 +178,10 @@ spec:
- "--csi-address=$(ADDRESS)" - "--csi-address=$(ADDRESS)"
- "--leader-election" - "--leader-election"
- "--default-fstype=ext4" - "--default-fstype=ext4"
{% if vsphere_csi_controller is version('v2.2.0', '>=') %}
- "--kube-api-qps=100"
- "--kube-api-burst=100"
{% endif %}
# needed only for topology aware setup # needed only for topology aware setup
#- "--feature-gates=Topology=true" #- "--feature-gates=Topology=true"
#- "--strict-topology" #- "--strict-topology"
@ -173,6 +201,8 @@ spec:
apiVersion: v1 apiVersion: v1
data: data:
"csi-migration": "false" # csi-migration feature is only available for vSphere 7.0U1 "csi-migration": "false" # csi-migration feature is only available for vSphere 7.0U1
"csi-auth-check": "true"
"online-volume-extend": "true"
kind: ConfigMap kind: ConfigMap
metadata: metadata:
name: internal-feature-states.csi.vsphere.vmware.com name: internal-feature-states.csi.vsphere.vmware.com
@ -185,4 +215,24 @@ metadata:
spec: spec:
attachRequired: true attachRequired: true
podInfoOnMount: false podInfoOnMount: false
---
apiVersion: v1
kind: Service
metadata:
name: vsphere-csi-controller
namespace: kube-system
labels:
app: vsphere-csi-controller
spec:
ports:
- name: ctlr
port: 2112
targetPort: 2112
protocol: TCP
- name: syncer
port: 2113
targetPort: 2113
protocol: TCP
selector:
app: vsphere-csi-controller

View file

@ -0,0 +1,30 @@
---
kind: ServiceAccount
apiVersion: v1
metadata:
name: vsphere-csi-node
namespace: kube-system
---
kind: Role
apiVersion: rbac.authorization.k8s.io/v1
metadata:
name: vsphere-csi-node-role
namespace: kube-system
rules:
- apiGroups: [""]
resources: ["configmaps"]
verbs: ["get", "list", "watch"]
---
kind: RoleBinding
apiVersion: rbac.authorization.k8s.io/v1
metadata:
name: vsphere-csi-node-binding
namespace: kube-system
subjects:
- kind: ServiceAccount
name: vsphere-csi-node
namespace: kube-system
roleRef:
kind: Role
name: vsphere-csi-node-role
apiGroup: rbac.authorization.k8s.io

View file

@ -39,8 +39,10 @@ spec:
value: /csi/csi.sock value: /csi/csi.sock
- name: DRIVER_REG_SOCK_PATH - name: DRIVER_REG_SOCK_PATH
value: /var/lib/kubelet/plugins/csi.vsphere.vmware.com/csi.sock value: /var/lib/kubelet/plugins/csi.vsphere.vmware.com/csi.sock
{% if vsphere_csi_controller is version('v2.2.0', '<') %}
securityContext: securityContext:
privileged: true privileged: true
{% endif %}
volumeMounts: volumeMounts:
- name: plugin-dir - name: plugin-dir
mountPath: /csi mountPath: /csi
@ -109,6 +111,12 @@ spec:
mountPropagation: "Bidirectional" mountPropagation: "Bidirectional"
- name: device-dir - name: device-dir
mountPath: /dev mountPath: /dev
{% if vsphere_csi_controller is version('v2.2.0', '>=') %}
- name: blocks-dir
mountPath: /sys/block
- name: sys-devices-dir
mountPath: /sys/devices
{% endif %}
ports: ports:
- containerPort: 9808 - containerPort: 9808
name: healthz name: healthz
@ -150,6 +158,16 @@ spec:
- name: device-dir - name: device-dir
hostPath: hostPath:
path: /dev path: /dev
{% if vsphere_csi_controller is version('v2.2.0', '>=') %}
- name: blocks-dir
hostPath:
path: /sys/block
type: Directory
- name: sys-devices-dir
hostPath:
path: /sys/devices
type: Directory
{% endif %}
tolerations: tolerations:
- effect: NoExecute - effect: NoExecute
operator: Exists operator: Exists