github.com/PDOK/gokoala@v0.50.6/hack/generate-crd.sh (about)

     1  #!/bin/bash
     2  
     3  set -o errexit
     4  set -o nounset
     5  set -o pipefail
     6  
     7  GOKOALA_ROOT=$(dirname "${BASH_SOURCE[0]}")/..
     8  cd "${GOKOALA_ROOT}"
     9  
    10  if ! command -v controller-gen &> /dev/null
    11  then
    12      echo "controller-gen not found, using Docker container instead"
    13      # Build controller-tools
    14      docker build -f hack/crd/Dockerfile -t gokoala-controller-tools .
    15  
    16      # Run against GoKoala
    17      docker run -v `pwd`/:/gokoala gokoala-controller-tools crd paths="/gokoala/hack/crd/..." output:dir="/gokoala/hack/tmp"
    18  else
    19     echo "controller-gen found, using this local install instead of Docker container"
    20  
    21     # Run against GoKoala config
    22     controller-gen crd paths="$(pwd)/hack/crd/..." output:dir="$(pwd)/hack/tmp"
    23  fi
    24  
    25  # Assertions
    26  cat hack/tmp/pdok_gokoalas.yaml
    27  cat hack/tmp/pdok_gokoalas.yaml | grep "kind: GoKoala"
    28