github.com/openebs/node-disk-manager@v1.9.1-0.20230225014141-4531f06ffa1e/build/generate-manifests.sh (about)

     1  #!/bin/bash
     2  # Copyright 2020 The OpenEBS Authors
     3  #
     4  # Licensed under the Apache License, Version 2.0 (the "License");
     5  # you may not use this file except in compliance with the License.
     6  # You may obtain a copy of the License at
     7  #
     8  #     http://www.apache.org/licenses/LICENSE-2.0
     9  #
    10  # Unless required by applicable law or agreed to in writing, software
    11  # distributed under the License is distributed on an "AS IS" BASIS,
    12  # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    13  # See the License for the specific language governing permissions and
    14  # limitations under the License.
    15  
    16  set -e
    17  
    18  ## find or download controller-gen
    19  CONTROLLER_GEN=$(which controller-gen)
    20  
    21  if [ "$CONTROLLER_GEN" = "" ]
    22  then
    23    echo "ERROR: failed to get controller-gen, Please run make bootstrap to install it";
    24    exit 1;
    25  fi
    26  
    27  $CONTROLLER_GEN crd:trivialVersions=false,preserveUnknownFields=false paths=./api/... output:crd:artifacts:config=deploy/crds
    28  
    29  ## create the operator file using all the yamls
    30  
    31  echo "# This manifest is autogenerated via 'make manifests' command.
    32  # Do the modification to the yamls in deploy/yamls/  directory
    33  # and then run 'make manifests' command
    34  
    35  # This manifest deploys the OpenEBS NDM components with associated RBAC rules and crds.
    36  " > deploy/ndm-operator.yaml
    37  
    38  # create the ndm-operator.yaml manifest
    39  {
    40    # Add crd creation to the Operator yaml
    41    cat deploy/crds/openebs.io_blockdevices.yaml
    42    cat deploy/crds/openebs.io_blockdeviceclaims.yaml
    43  
    44    # Add namespace creation to the Operator yaml
    45    cat deploy/yamls/namespace.yaml
    46  
    47    # Add NDM config map
    48    cat deploy/yamls/node-disk-manager-config.yaml
    49  
    50    # Add the openebs service account
    51    cat deploy/yamls/serviceaccount.yaml
    52  
    53    # Add clusterrole and rolebinding
    54    cat deploy/yamls/clusterrole.yaml
    55    cat deploy/yamls/clusterrolebinding.yaml
    56  
    57    # Add the basic components: NDM daemon and operator
    58    cat deploy/yamls/node-disk-manager.yaml
    59    cat deploy/yamls/node-disk-operator.yaml
    60  
    61    # Add optional components for metrics: NDM cluster and node exporter
    62    cat deploy/yamls/ndm-cluster-exporter.yaml
    63    cat deploy/yamls/ndm-node-exporter.yaml
    64  } >> deploy/ndm-operator.yaml