-
Notifications
You must be signed in to change notification settings - Fork 34
/
deploy-k8s-resources.sh
executable file
·52 lines (44 loc) · 1.61 KB
/
deploy-k8s-resources.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
#!/bin/bash
#
# SPDX-FileCopyrightText: 2024 SAP SE or an SAP affiliate company and Gardener contributors
#
# SPDX-License-Identifier: Apache-2.0
set -o errexit
COMPONENT_DIR="$(dirname $0)/.."
cd "${COMPONENT_DIR}"
COMPONENT_DIR="$(pwd)"
echo "COMPONENT_DIR: ${COMPONENT_DIR}"
source "${COMPONENT_DIR}/commands/settings"
TMP_DIR=`mktemp -d`
echo "TMP_DIR: ${TMP_DIR}"
echo "creating context"
outputFile="${TMP_DIR}/context.yaml"
export namespace="${NAMESPACE}"
export repoBaseUrl="${REPO_BASE_URL}"
inputFile="${COMPONENT_DIR}/installation/context.yaml.tpl"
envsubst < ${inputFile} > ${outputFile}
kubectl apply -f ${outputFile}
echo "creating target"
echo "target cluster kubeconfig: $TARGET_CLUSTER_KUBECONFIG_PATH"
outputFile="${TMP_DIR}/target.yaml"
export namespace="${NAMESPACE}"
export name="my-cluster"
export kubeconfig=`sed 's/^/ /' $TARGET_CLUSTER_KUBECONFIG_PATH`
inputFile="${COMPONENT_DIR}/installation/target.yaml.tpl"
envsubst < ${inputFile} > ${outputFile}
kubectl apply -f ${outputFile}
echo "creating target 2"
echo "target cluster kubeconfig: $TARGET_CLUSTER_KUBECONFIG_PATH_2"
outputFile="${TMP_DIR}/target2.yaml"
export namespace="${NAMESPACE}"
export name="my-cluster-2"
export kubeconfig=`sed 's/^/ /' $TARGET_CLUSTER_KUBECONFIG_PATH_2`
inputFile="${COMPONENT_DIR}/installation/target.yaml.tpl"
envsubst < ${inputFile} > ${outputFile}
kubectl apply -f ${outputFile}
echo "creating installation"
outputFile="${TMP_DIR}/installation.yaml"
export namespace="${NAMESPACE}"
inputFile="${COMPONENT_DIR}/installation/installation.yaml.tpl"
envsubst < ${inputFile} > ${outputFile}
kubectl apply -f ${outputFile}