Upgrade ironic and baremetal-operator components
[icn.git] / deploy / cert-manager / cert-manager.sh
1 #!/usr/bin/env bash
2 set -eux -o pipefail
3
4 SCRIPTDIR="$(readlink -f $(dirname ${BASH_SOURCE[0]}))"
5 LIBDIR="$(dirname $(dirname ${SCRIPTDIR}))/env/lib"
6
7 source $LIBDIR/logging.sh
8 source $LIBDIR/common.sh
9
10 # Cert-Manager version to use
11 CERT_MANAGER_VERSION="v1.5.3"
12
13 # This may be used to update the in-place cert-manager YAML
14 # files from the upstream project
15 function build_source {
16     mkdir -p ${SCRIPTDIR}/base
17     curl -sL https://github.com/jetstack/cert-manager/releases/download/${CERT_MANAGER_VERSION}/cert-manager.yaml -o ${SCRIPTDIR}/base/cert-manager.yaml
18     pushd ${SCRIPTDIR}/base && kustomize create --autodetect && popd
19 }
20
21 function deploy {
22     kustomize build ${SCRIPTDIR}/icn | kubectl apply -f -
23     kubectl -n cert-manager wait --for=condition=Available --timeout=300s deployment --all
24 }
25
26 function clean {
27     kustomize build ${SCRIPTDIR}/icn | kubectl delete -f -
28 }
29
30 case $1 in
31     "build-source") build_source ;;
32     "clean") clean ;;
33     "deploy") deploy ;;
34     *) cat <<EOF
35 Usage: $(basename $0) COMMAND
36
37 Commands:
38   build-source  - Rebuild the in-tree cert-manager YAML files
39   clean         - Remove the cert-manager
40   deploy        - Deploy the cert-manager
41 EOF
42        ;;
43 esac