github.com/openebs/node-disk-manager@v1.9.1-0.20230225014141-4531f06ffa1e/deploy/helm/charts/templates/daemonset.yaml (about)

     1  {{- if .Values.ndm.enabled }}
     2  apiVersion: apps/v1
     3  kind: DaemonSet
     4  metadata:
     5    name: {{ template "openebs-ndm.fullname" . }}
     6    {{- with .Values.ndm.annotations }}
     7    annotations: {{ toYaml . | nindent 4 }}
     8    {{- end }}
     9    labels:
    10      {{- include "openebs-ndm.labels" . | nindent 4 }}
    11  spec:
    12    updateStrategy:
    13  {{ toYaml .Values.ndm.updateStrategy | indent 4 }}
    14    selector:
    15      matchLabels:
    16        {{- include "openebs-ndm.matchLabels" . | nindent 6 }}
    17    template:
    18      metadata:
    19        {{- with .Values.ndm.podAnnotations }}
    20        annotations: {{ toYaml . | nindent 8 }}
    21        {{- end }}
    22        labels:
    23          {{- include "openebs-ndm.labels" . | nindent 8 }}
    24          {{- with .Values.ndm.podLabels}}
    25          {{ toYaml . }}
    26          {{- end}}
    27      spec:
    28        serviceAccountName: {{ template "openebs-ndm.serviceAccountName" . }}
    29  {{- if .Values.featureGates.enabled }}
    30  {{- if .Values.featureGates.APIService.enabled }}
    31        hostPID: true
    32  {{- end}}
    33  {{- end}}
    34        containers:
    35        - name: {{ template "openebs-ndm.name" . }}
    36          image: "{{ .Values.ndm.image.registry }}{{ .Values.ndm.image.repository }}:{{ .Values.ndm.image.tag }}"
    37          args:
    38            - -v=4
    39  {{- if .Values.featureGates.enabled }}
    40  {{- if .Values.featureGates.GPTBasedUUID.enabled }}
    41            - --feature-gates={{ .Values.featureGates.GPTBasedUUID.featureGateFlag }}
    42  {{- end}}
    43  {{- if .Values.featureGates.APIService.enabled }}
    44            - --feature-gates={{ .Values.featureGates.APIService.featureGateFlag }}
    45            - --api-service-address={{ .Values.featureGates.APIService.address }}
    46  {{- end}}
    47  {{- if .Values.featureGates.UseOSDisk.enabled }}
    48            - --feature-gates={{ .Values.featureGates.UseOSDisk.featureGateFlag }}
    49  {{- end}}
    50  {{- if .Values.featureGates.ChangeDetection.enabled }}
    51            - --feature-gates={{ .Values.featureGates.ChangeDetection.featureGateFlag }}
    52  {{- end}}
    53  {{- if .Values.featureGates.PartitionTableUUID.enabled }}
    54            - --feature-gates={{ .Values.featureGates.PartitionTableUUID.featureGateFlag }}
    55  {{- end}}
    56  {{- end}}
    57          imagePullPolicy: {{ .Values.ndm.image.pullPolicy }}
    58          resources:
    59  {{ toYaml .Values.ndm.resources | indent 12 }}
    60          securityContext:
    61            privileged: true
    62          env:
    63          # namespace in which NDM is installed will be passed to NDM Daemonset
    64          # as environment variable
    65          - name: NAMESPACE
    66            valueFrom:
    67              fieldRef:
    68                fieldPath: metadata.namespace
    69          # pass hostname as env variable using downward API to the NDM container
    70          - name: NODE_NAME
    71            valueFrom:
    72              fieldRef:
    73                fieldPath: spec.nodeName
    74  {{- if .Values.ndm.sparse }}
    75  {{- if .Values.ndm.sparse.path }}
    76          # specify the directory where the sparse files need to be created.
    77          # if not specified, then sparse files will not be created.
    78          - name: SPARSE_FILE_DIR
    79            value: "{{ .Values.ndm.sparse.path }}"
    80  {{- end }}
    81  {{- if .Values.ndm.sparse.size }}
    82          # Size(bytes) of the sparse file to be created.
    83          - name: SPARSE_FILE_SIZE
    84            value: "{{ .Values.ndm.sparse.size }}"
    85  {{- end }}
    86  {{- if .Values.ndm.sparse.count }}
    87          # Specify the number of sparse files to be created
    88          - name: SPARSE_FILE_COUNT
    89            value: "{{ .Values.ndm.sparse.count }}"
    90  {{- end }}
    91  {{- end }}
    92          # Process name used for matching is limited to the 15 characters
    93          # present in the pgrep output.
    94          # So fullname can be used here with pgrep (cmd is < 15 chars).
    95          livenessProbe:
    96            exec:
    97              command:
    98              - pgrep
    99              - "ndm"
   100            initialDelaySeconds: {{ .Values.ndm.healthCheck.initialDelaySeconds }}
   101            periodSeconds: {{ .Values.ndm.healthCheck.periodSeconds }}
   102          volumeMounts:
   103          - name: config
   104            mountPath: /host/node-disk-manager.config
   105            subPath: node-disk-manager.config
   106            readOnly: true
   107          - name: udev
   108            mountPath: /run/udev
   109          - name: procmount
   110            mountPath: /host/proc
   111            readOnly: true
   112          - name: devmount
   113            mountPath: /dev
   114          - name: basepath
   115            mountPath: /var/openebs/ndm
   116  {{- if .Values.ndm.sparse }}
   117  {{- if .Values.ndm.sparse.path }}
   118          - name: sparsepath
   119            mountPath: {{ .Values.ndm.sparse.path }}
   120  {{- end }}
   121  {{- end }}
   122        volumes:
   123        - name: config
   124          configMap:
   125            name: {{ include "openebs-ndm.fullname" . }}-config
   126        - name: udev
   127          hostPath:
   128            path: /run/udev
   129            type: Directory
   130        # mount /proc (to access mount file of process 1 of host) inside container
   131        # to read mount-point of disks and partitions
   132        - name: procmount
   133          hostPath:
   134            path: /proc
   135            type: Directory
   136        - name: devmount
   137        # the /dev directory is mounted so that we have access to the devices that
   138        # are connected at runtime of the pod.
   139          hostPath:
   140            path: /dev
   141            type: Directory
   142        - name: basepath
   143          hostPath:
   144            path: "{{ .Values.varDirectoryPath.baseDir }}/ndm"
   145            type: DirectoryOrCreate
   146  {{- if .Values.ndm.sparse }}
   147  {{- if .Values.ndm.sparse.path }}
   148        - name: sparsepath
   149          hostPath:
   150            path: {{ .Values.ndm.sparse.path }}
   151  {{- end }}
   152  {{- end }}
   153        # By default the node-disk-manager will be run on all kubernetes nodes
   154        # If you would like to limit this to only some nodes, say the nodes
   155        # that have storage attached, you could label those node and use
   156        # nodeSelector.
   157        #
   158        # e.g. label the storage nodes with - "openebs.io/nodegroup"="storage-node"
   159        # kubectl label node <node-name> "openebs.io/nodegroup"="storage-node"
   160        #nodeSelector:
   161        #  "openebs.io/nodegroup": "storage-node"
   162  {{- if .Values.imagePullSecrets }}
   163        imagePullSecrets:
   164  {{ toYaml .Values.imagePullSecrets | indent 8 }}
   165  {{- end }}
   166  {{- if .Values.ndm.nodeSelector }}
   167        nodeSelector:
   168  {{ toYaml .Values.ndm.nodeSelector | indent 8 }}
   169  {{- end }}
   170  {{- if .Values.ndm.tolerations }}
   171        tolerations:
   172  {{ toYaml .Values.ndm.tolerations | indent 8 }}
   173  {{- end }}
   174  {{- if .Values.ndm.securityContext }}
   175        securityContext:
   176  {{ toYaml .Values.ndm.securityContext | indent 8 }}
   177  {{- end }}
   178        hostNetwork: true
   179  {{- end }}