github.com/1aal/kubeblocks@v0.0.0-20231107070852-e1c03e598921/deploy/csi-hostpath-driver/templates/statefulset.yaml (about)

     1  kind: StatefulSet
     2  apiVersion: apps/v1
     3  metadata:
     4    name: {{ include "csi-hostpath-driver.fullname" . }}
     5    labels:
     6      {{ include "csi-hostpath-driver.labels" . | nindent 4 }}
     7  spec:
     8    serviceName: {{ include "csi-hostpath-driver.fullname" . }}
     9    # One replica only:
    10    # Host path driver only works when everything runs
    11    # on a single node.
    12    replicas: 1
    13    selector:
    14      matchLabels:
    15        {{ include "csi-hostpath-driver.selectorLabels" . | nindent 6 }}
    16    template:
    17      metadata:
    18        labels:
    19          {{ include "csi-hostpath-driver.selectorLabels" . | nindent 8 }}
    20      spec:
    21        serviceAccountName: {{ include "csi-hostpath-driver.serviceAccountName" . }}
    22        {{ with .Values.imagePullSecrets }}
    23        imagePullSecrets:
    24          {{ toYaml . | nindent 8 }}
    25        {{- end }}
    26        serviceAccountName: {{ include "csi-hostpath-driver.serviceAccountName" . }}
    27        securityContext:
    28          {{  toYaml .Values.podSecurityContext | nindent 8 }}
    29        containers:
    30          - name: hostpath
    31            #image: registry.k8s.io/sig-storage/hostpathplugin:v1.9.0
    32            image: "{{ .Values.image.registry }}/{{ .Values.image.repository }}:{{ .Values.image.tag | default .Chart.AppVersion }}"
    33            imagePullPolicy: {{ .Values.image.pullPolicy }}
    34            args:
    35              - "--drivername=hostpath.csi.k8s.io"
    36              - "--v=5"
    37              - "--endpoint=$(CSI_ENDPOINT)"
    38              - "--nodeid=$(KUBE_NODE_NAME)"
    39            env:
    40              - name: CSI_ENDPOINT
    41                value: unix:///csi/csi.sock
    42              - name: KUBE_NODE_NAME
    43                valueFrom:
    44                  fieldRef:
    45                    apiVersion: v1
    46                    fieldPath: spec.nodeName
    47            securityContext:
    48              privileged: true
    49            ports:
    50              - containerPort: 9898
    51                name: healthz
    52                protocol: TCP
    53            livenessProbe:
    54              failureThreshold: 5
    55              httpGet:
    56                path: /healthz
    57                port: healthz
    58              initialDelaySeconds: 10
    59              timeoutSeconds: 3
    60              periodSeconds: 2
    61            volumeMounts:
    62              - mountPath: /csi
    63                name: socket-dir
    64              - mountPath: /var/lib/kubelet/pods
    65                mountPropagation: Bidirectional
    66                name: mountpoint-dir
    67              - mountPath: /var/lib/kubelet/plugins
    68                mountPropagation: Bidirectional
    69                name: plugins-dir
    70              - mountPath: /csi-data-dir
    71                name: csi-data-dir
    72              - mountPath: /dev
    73                name: dev-dir
    74  
    75          - name: csi-external-health-monitor-controller
    76            #image: registry.k8s.io/sig-storage/csi-external-health-monitor-controller:v0.7.0
    77            image: "{{ .Values.image.registry }}/{{ .Values.sidecars.healthmonitor.image.repository }}:{{ .Values.sidecars.healthmonitor.image.tag }}"
    78            imagePullPolicy: {{ .Values.image.pullPolicy }}
    79            args:
    80              - "--v=5"
    81              - "--csi-address=$(ADDRESS)"
    82              - "--leader-election"
    83            env:
    84              - name: ADDRESS
    85                value: /csi/csi.sock
    86  
    87            volumeMounts:
    88              - name: socket-dir
    89                mountPath: /csi
    90  
    91          - name: node-driver-registrar
    92            #image: registry.k8s.io/sig-storage/csi-node-driver-registrar:v2.6.0
    93            image: "{{ .Values.image.registry }}/{{ .Values.sidecars.registrar.image.repository }}:{{ .Values.sidecars.registrar.image.tag }}"
    94            imagePullPolicy: {{ .Values.image.pullPolicy }}
    95            args:
    96              - --v=5
    97              - --csi-address=/csi/csi.sock
    98              - --kubelet-registration-path=/var/lib/kubelet/plugins/csi-hostpath/csi.sock
    99            securityContext:
   100              # This is necessary only for systems with SELinux, where
   101              # non-privileged sidecar containers cannot access unix domain socket
   102              # created by privileged CSI driver container.
   103              privileged: true
   104            env:
   105              - name: KUBE_NODE_NAME
   106                valueFrom:
   107                  fieldRef:
   108                    apiVersion: v1
   109                    fieldPath: spec.nodeName
   110            volumeMounts:
   111              - mountPath: /csi
   112                name: socket-dir
   113              - mountPath: /registration
   114                name: registration-dir
   115              - mountPath: /csi-data-dir
   116                name: csi-data-dir
   117  
   118          - name: liveness-probe
   119            volumeMounts:
   120              - mountPath: /csi
   121                name: socket-dir
   122            #image: registry.k8s.io/sig-storage/livenessprobe:v2.8.0
   123            image: "{{ .Values.image.registry }}/{{ .Values.sidecars.livenessprobe.image.repository }}:{{ .Values.sidecars.livenessprobe.image.tag }}"
   124            imagePullPolicy: {{ .Values.image.pullPolicy }}
   125            args:
   126              - --csi-address=/csi/csi.sock
   127              - --health-port=9898
   128  
   129          - name: csi-attacher
   130            #image: registry.k8s.io/sig-storage/csi-attacher:v4.0.0
   131            image: "{{ .Values.image.registry }}/{{ .Values.sidecars.attacher.image.repository }}:{{ .Values.sidecars.attacher.image.tag }}"
   132            imagePullPolicy: {{ .Values.image.pullPolicy }}
   133            args:
   134              - --v=5
   135              - --csi-address=/csi/csi.sock
   136            securityContext:
   137              # This is necessary only for systems with SELinux, where
   138              # non-privileged sidecar containers cannot access unix domain socket
   139              # created by privileged CSI driver container.
   140              privileged: true
   141            volumeMounts:
   142              - mountPath: /csi
   143                name: socket-dir
   144  
   145          - name: csi-provisioner
   146            #image: registry.k8s.io/sig-storage/csi-provisioner:v3.3.0
   147            image: "{{ .Values.image.registry }}/{{ .Values.sidecars.provisioner.image.repository }}:{{ .Values.sidecars.provisioner.image.tag }}"
   148            imagePullPolicy: {{ .Values.image.pullPolicy }}
   149            args:
   150              - -v=5
   151              - --csi-address=/csi/csi.sock
   152              - --feature-gates=Topology=true
   153              # end csi-provisioner args
   154            securityContext:
   155              # This is necessary only for systems with SELinux, where
   156              # non-privileged sidecar containers cannot access unix domain socket
   157              # created by privileged CSI driver container.
   158              privileged: true
   159            volumeMounts:
   160              - mountPath: /csi
   161                name: socket-dir
   162  
   163          - name: csi-resizer
   164            #image: registry.k8s.io/sig-storage/csi-resizer:v1.6.0
   165            image: "{{ .Values.image.registry }}/{{ .Values.sidecars.resizer.image.repository }}:{{ .Values.sidecars.resizer.image.tag }}"
   166            imagePullPolicy: {{ .Values.image.pullPolicy }}
   167            args:
   168              - -v=5
   169              - -csi-address=/csi/csi.sock
   170            securityContext:
   171              # This is necessary only for systems with SELinux, where
   172              # non-privileged sidecar containers cannot access unix domain socket
   173              # created by privileged CSI driver container.
   174              privileged: true
   175            volumeMounts:
   176              - mountPath: /csi
   177                name: socket-dir
   178  
   179          - name: csi-snapshotter
   180            #image: registry.k8s.io/sig-storage/csi-snapshotter:v6.1.0
   181            image: "{{ .Values.image.registry }}/{{ .Values.sidecars.snapshotter.image.repository }}:{{ .Values.sidecars.snapshotter.image.tag }}"
   182            imagePullPolicy: {{ .Values.image.pullPolicy }}
   183            args:
   184              - -v=5
   185              - --csi-address=/csi/csi.sock
   186            securityContext:
   187              # This is necessary only for systems with SELinux, where
   188              # non-privileged sidecar containers cannot access unix domain socket
   189              # created by privileged CSI driver container.
   190              privileged: true
   191            volumeMounts:
   192              - mountPath: /csi
   193                name: socket-dir
   194  
   195        {{- with .Values.nodeSelector }}
   196        nodeSelector:
   197          {{- toYaml . | nindent 8 }}
   198        {{- end }}
   199        {{- with .Values.affinity }}
   200        affinity:
   201          {{- toYaml . | nindent 8 }}
   202        {{- end }}
   203        {{- with .Values.tolerations }}
   204        tolerations:
   205          {{- toYaml . | nindent 8 }}
   206        {{- end }}
   207  
   208        volumes:
   209          - hostPath:
   210              path: /var/lib/kubelet/plugins/csi-hostpath
   211              type: DirectoryOrCreate
   212            name: socket-dir
   213          - hostPath:
   214              path: /var/lib/kubelet/pods
   215              type: DirectoryOrCreate
   216            name: mountpoint-dir
   217          - hostPath:
   218              path: /var/lib/kubelet/plugins_registry
   219              type: Directory
   220            name: registration-dir
   221          - hostPath:
   222              path: /var/lib/kubelet/plugins
   223              type: Directory
   224            name: plugins-dir
   225          - hostPath:
   226              # 'path' is where PV data is persisted on host.
   227              # using /tmp is also possible while the PVs will not available after plugin container recreation or host reboot
   228              path: /var/lib/csi-hostpath-data/
   229              type: DirectoryOrCreate
   230            name: csi-data-dir
   231          - hostPath:
   232              path: /dev
   233              type: Directory
   234            name: dev-dir