github.com/alibaba/sealer@v0.8.6-0.20220430115802-37a2bdaa8173/applications/openebs/localpv/localpv-operator.yaml (about)

     1  apiVersion: v1
     2  kind: Namespace
     3  metadata:
     4    name: openebs
     5  ---
     6  # Create Maya Service Account
     7  apiVersion: v1
     8  kind: ServiceAccount
     9  metadata:
    10    name: openebs-maya-operator
    11    namespace: openebs
    12  ---
    13  # Define Role that allows operations on K8s pods/deployments
    14  kind: ClusterRole
    15  apiVersion: rbac.authorization.k8s.io/v1
    16  metadata:
    17    name: openebs-maya-operator
    18  rules:
    19    - apiGroups: [ "*" ]
    20      resources: [ "nodes", "nodes/proxy" ]
    21      verbs: [ "*" ]
    22    - apiGroups: [ "*" ]
    23      resources: [ "namespaces", "services", "pods", "deployments", "events", "endpoints", "configmaps", "jobs" ]
    24      verbs: [ "*" ]
    25    - apiGroups: [ "*" ]
    26      resources: [ "storageclasses", "persistentvolumeclaims", "persistentvolumes" ]
    27      verbs: [ "*" ]
    28  ---
    29  # Bind the Service Account with the Role Privileges.
    30  # TODO: Check if default account also needs to be there
    31  kind: ClusterRoleBinding
    32  apiVersion: rbac.authorization.k8s.io/v1
    33  metadata:
    34    name: openebs-maya-operator
    35  subjects:
    36    - kind: ServiceAccount
    37      name: openebs-maya-operator
    38      namespace: openebs
    39  roleRef:
    40    kind: ClusterRole
    41    name: openebs-maya-operator
    42    apiGroup: rbac.authorization.k8s.io
    43  ---
    44  apiVersion: apps/v1
    45  kind: Deployment
    46  metadata:
    47    name: openebs-localpv-provisioner
    48    namespace: openebs
    49    labels:
    50      name: openebs-localpv-provisioner
    51      openebs.io/component-name: openebs-localpv-provisioner
    52      openebs.io/version: 2.11.0
    53  spec:
    54    selector:
    55      matchLabels:
    56        name: openebs-localpv-provisioner
    57        openebs.io/component-name: openebs-localpv-provisioner
    58    replicas: 1
    59    strategy:
    60      type: Recreate
    61    template:
    62      metadata:
    63        labels:
    64          name: openebs-localpv-provisioner
    65          openebs.io/component-name: openebs-localpv-provisioner
    66          openebs.io/version: 2.11.0
    67      spec:
    68        serviceAccountName: openebs-maya-operator
    69        containers:
    70          - name: openebs-provisioner-hostpath
    71            imagePullPolicy: IfNotPresent
    72            image: openebs/provisioner-localpv:2.11.1
    73            env:
    74              # OPENEBS_IO_K8S_MASTER enables openebs provisioner to connect to K8s
    75              # based on this address. This is ignored if empty.
    76              # This is supported for openebs provisioner version 0.5.2 onwards
    77              #- name: OPENEBS_IO_K8S_MASTER
    78              #  value: "http://10.128.0.12:8080"
    79              # OPENEBS_IO_KUBE_CONFIG enables openebs provisioner to connect to K8s
    80              # based on this config. This is ignored if empty.
    81              # This is supported for openebs provisioner version 0.5.2 onwards
    82              #- name: OPENEBS_IO_KUBE_CONFIG
    83              #  value: "/home/ubuntu/.kube/config"
    84              - name: NODE_NAME
    85                valueFrom:
    86                  fieldRef:
    87                    fieldPath: spec.nodeName
    88              - name: OPENEBS_NAMESPACE
    89                valueFrom:
    90                  fieldRef:
    91                    fieldPath: metadata.namespace
    92              # OPENEBS_SERVICE_ACCOUNT provides the service account of this pod as
    93              # environment variable
    94              - name: OPENEBS_SERVICE_ACCOUNT
    95                valueFrom:
    96                  fieldRef:
    97                    fieldPath: spec.serviceAccountName
    98              - name: OPENEBS_IO_ENABLE_ANALYTICS
    99                value: "true"
   100              - name: OPENEBS_IO_INSTALLER_TYPE
   101                value: "openebs-operator-hostpath"
   102              - name: OPENEBS_IO_HELPER_IMAGE
   103                value: "openebs/linux-utils:2.11.0"
   104            # LEADER_ELECTION_ENABLED is used to enable/disable leader election. By default
   105            # leader election is enabled.
   106            #- name: LEADER_ELECTION_ENABLED
   107            #  value: "true"
   108            # OPENEBS_IO_IMAGE_PULL_SECRETS environment variable is used to pass the image pull secrets
   109            # to the helper pod launched by local-pv hostpath provisioner
   110            #- name: OPENEBS_IO_IMAGE_PULL_SECRETS
   111            #  value: ""
   112            # Process name used for matching is limited to the 15 characters
   113            # present in the pgrep output.
   114            # So fullname can't be used here with pgrep (>15 chars).A regular expression
   115            # that matches the entire command name has to specified.
   116            # Anchor `^` : matches any string that starts with `provisioner-loc`
   117            # `.*`: matches any string that has `provisioner-loc` followed by zero or more char
   118            livenessProbe:
   119              exec:
   120                command:
   121                  - sh
   122                  - -c
   123                  - test `pgrep -c "^provisioner-loc.*"` = 1
   124              initialDelaySeconds: 30
   125              periodSeconds: 60
   126  ---
   127  apiVersion: storage.k8s.io/v1
   128  kind: StorageClass
   129  metadata:
   130    name: local-hostpath
   131    annotations:
   132      openebs.io/cas-type: local
   133      cas.openebs.io/config: |
   134        - name: StorageType
   135          value: hostpath
   136        - name: BasePath
   137          value: /var/local-hostpath
   138  provisioner: openebs.io/local
   139  reclaimPolicy: Delete
   140  volumeBindingMode: WaitForFirstConsumer