-
Notifications
You must be signed in to change notification settings - Fork 1
/
deploy_ocm_gear.sh
executable file
·81 lines (70 loc) · 2.21 KB
/
deploy_ocm_gear.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
#!/usr/bin/env bash
set -euo pipefail
OWN_DIR=$(readlink -f "$(dirname "${0}")")
CFG_DIR="${OWN_DIR}/cfg"
CFG_SET="ocm_gear"
CREATE_CFG_FACTORY=""
INGRESS_NAMESPACE=ingress-nginx
INSTALL_INGRESS_CONTROLLER=""
KUBECONFIG=""
KUBERNETES_CFG_NAME=""
NAMESPACE=delivery
OCM_GEAR_VERSION=""
VALUES_DIR="${OWN_DIR}/helm-values"
parse_flags() {
while test $# -gt 0; do
case "$1" in
--cfg-dir)
shift; CFG_DIR="$1"
;;
--cfg-set)
shift; CFG_SET="$1"
;;
--create-cfg-factory)
CREATE_CFG_FACTORY=true
;;
--ingress-namespace)
shift; INGRESS_NAMESPACE="$1"
;;
--install-ingress-controller)
INSTALL_INGRESS_CONTROLLER=true
;;
--kubeconfig)
shift; KUBECONFIG="$1"
;;
--kubernetes-cfg-name)
shift; KUBERNETES_CFG_NAME="$1"
;;
--namespace)
shift; NAMESPACE="$1"
;;
--values-dir)
shift; VALUES_DIR="$1"
;;
--version)
shift; OCM_GEAR_VERSION="$1"
;;
esac
shift
done
}
parse_flags "$@"
OCM_GEAR_COMPONENT_REF="europe-docker.pkg.dev/gardener-project/releases//ocm.software/ocm-gear"
OCM_GEAR_VERSION="${OCM_GEAR_VERSION:-$(ocm show versions ${OCM_GEAR_COMPONENT_REF} | tail -1)}"
echo ">>> Installing OCM-Gear in version ${OCM_GEAR_VERSION}"
ocm download resources ${OCM_GEAR_COMPONENT_REF}:${OCM_GEAR_VERSION} installation -O "${OWN_DIR}/resource-installation"
tar -xzf "${OWN_DIR}/resource-installation"
${OWN_DIR}/installation/install.sh \
${CFG_DIR:+"--cfg-dir"} ${CFG_DIR:+${CFG_DIR}} \
${CFG_SET:+"--cfg-set"} ${CFG_SET:+${CFG_SET}} \
${CREATE_CFG_FACTORY:+"--create-cfg-factory"} \
${INGRESS_NAMESPACE:+"--ingress-namespace"} ${INGRESS_NAMESPACE:+${INGRESS_NAMESPACE}} \
${INSTALL_INGRESS_CONTROLLER:+"--install-ingress-controller"} \
${KUBECONFIG:+"--kubeconfig"} ${KUBECONFIG:+${KUBECONFIG}} \
${KUBERNETES_CFG_NAME:+"--kubernetes-cfg-name"} ${KUBERNETES_CFG_NAME:+${KUBERNETES_CFG_NAME}} \
${NAMESPACE:+"--namespace"} ${NAMESPACE:+${NAMESPACE}} \
${VALUES_DIR:+"--values-dir"} ${VALUES_DIR:+${VALUES_DIR}} \
${OCM_GEAR_VERSION:+"--version"} ${OCM_GEAR_VERSION:+${OCM_GEAR_VERSION}}
rm "${OWN_DIR}/resource-installation"
rm -r "${OWN_DIR}/installation"
rm -r "${VALUES_DIR}"