-
Notifications
You must be signed in to change notification settings - Fork 10
/
up.sh
executable file
·105 lines (100 loc) · 5.37 KB
/
up.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
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
#!/bin/bash
# up.sh: Deploy galaxy-operator to K8s
if command -v kubectl > /dev/null; then
KUBECTL=$(command -v kubectl)
elif [ -x /usr/local/bin/kubectl ]; then
KUBECTL=/usr/local/bin/kubectl
else
echo "$0: ERROR 1: Cannot find kubectl"
fi
KUBE_ASSETS_DIR=${KUBE_ASSETS_DIR:-".ci/assets/kubernetes"}
OPERATOR_IMAGE=${OPERATOR_IMAGE:-"quay.io/ansible/galaxy-operator:main"}
echo "Make Deploy"
make deploy IMG=$OPERATOR_IMAGE
echo "Namespaces"
$KUBECTL get namespace
echo "Set context"
$KUBECTL config set-context --current --namespace=galaxy
echo "Get Deployment"
$KUBECTL get deployment
# TODO: Check if these should only ever be run once; or require
# special logic to update
# The Custom Resource (and any ConfigMaps) do not.
if [[ -e config/samples/galaxy_v1beta1_galaxy_cr.yaml ]]; then
CUSTOM_RESOURCE=galaxy_v1beta1_galaxy_cr.yaml
elif [[ "$CI_TEST" == "true" && "$CI_TEST_IMAGE" == "minimal" ]]; then
CUSTOM_RESOURCE=galaxy_v1beta1_galaxy_cr.ci.yaml
echo "Will deploy admin password secret for testing ..."
$KUBECTL apply -f $KUBE_ASSETS_DIR/galaxy-admin-password.secret.yaml
echo "Will deploy container auth secret for testing ..."
$KUBECTL apply -f $KUBE_ASSETS_DIR/galaxy-container-auth.secret.yaml
elif [[ "$CI_TEST" == "true" && "$CI_TEST_IMAGE" == "s6" ]]; then
CUSTOM_RESOURCE=galaxy_v1beta1_galaxy_cr.s6.ci.yaml
echo "Will deploy admin password secret for testing ..."
$KUBECTL apply -f $KUBE_ASSETS_DIR/galaxy-admin-password.secret.yaml
echo "Will deploy container auth secret for testing ..."
$KUBECTL apply -f $KUBE_ASSETS_DIR/galaxy-container-auth.secret.yaml
elif [[ "$CI_TEST" == "aws" ]]; then
CUSTOM_RESOURCE=galaxy_v1beta1_galaxy_cr.object_storage.aws.yaml
echo "Will deploy admin password secret for testing ..."
$KUBECTL apply -f $KUBE_ASSETS_DIR/galaxy-admin-password.secret.yaml
echo "Will deploy object storage secret for testing ..."
$KUBECTL apply -f $KUBE_ASSETS_DIR/galaxy-object-storage.aws.secret.yaml
elif [[ "$CI_TEST" == "azure" ]]; then
CUSTOM_RESOURCE=galaxy_v1beta1_galaxy_cr.object_storage.azure.yaml
echo "Will deploy admin password secret for testing ..."
$KUBECTL apply -f $KUBE_ASSETS_DIR/galaxy-admin-password.secret.yaml
echo "Will deploy object storage secret for testing ..."
$KUBECTL apply -f $KUBE_ASSETS_DIR/galaxy-object-storage.azure.secret.yaml
elif [[ "$CI_TEST_STORAGE" == "azure" ]]; then
echo "Will deploy object storage secret for testing ..."
$KUBECTL apply -f $KUBE_ASSETS_DIR/galaxy-object-storage.azure.secret.yaml
CUSTOM_RESOURCE=galaxy_v1beta1_galaxy_cr.galaxy.azure.ci.yaml
echo "Will deploy admin password secret for testing ..."
$KUBECTL apply -f $KUBE_ASSETS_DIR/galaxy-admin-password.secret.yaml
echo "Will deploy container auth secret for testing ..."
$KUBECTL apply -f $KUBE_ASSETS_DIR/galaxy-container-auth.secret.yaml
elif [[ "$CI_TEST_STORAGE" == "s3" ]]; then
echo "Will deploy object storage secret for testing ..."
$KUBECTL apply -f $KUBE_ASSETS_DIR/galaxy-object-storage.aws.secret.yaml
CUSTOM_RESOURCE=galaxy_v1beta1_galaxy_cr.galaxy.s3.ci.yaml
echo "Will deploy admin password secret for testing ..."
$KUBECTL apply -f $KUBE_ASSETS_DIR/galaxy-admin-password.secret.yaml
echo "Will deploy container auth secret for testing ..."
$KUBECTL apply -f $KUBE_ASSETS_DIR/galaxy-container-auth.secret.yaml
elif [[ "$CI_TEST" == "galaxy" && "$CI_TEST_IMAGE" == "s6" ]]; then
CUSTOM_RESOURCE=galaxy_v1beta1_galaxy_cr.galaxy.s6.ci.yaml
echo "Will deploy admin password secret for testing ..."
$KUBECTL apply -f $KUBE_ASSETS_DIR/galaxy-admin-password.secret.yaml
echo "Will deploy signing secret for testing ..."
$KUBECTL apply -f $KUBE_ASSETS_DIR/galaxy_sign.secret.yaml
$KUBECTL apply -f $KUBE_ASSETS_DIR/signing_scripts.configmap.yaml
elif [[ "$CI_TEST" == "galaxy" && "$CI_TEST_DATABASE" == "internal" ]]; then
CUSTOM_RESOURCE=galaxy_v1beta1_galaxy_cr.galaxy.ci.yaml
echo "Will deploy admin password secret for testing ..."
$KUBECTL apply -f $KUBE_ASSETS_DIR/galaxy-admin-password.secret.yaml
echo "Will deploy signing secret for testing ..."
$KUBECTL apply -f $KUBE_ASSETS_DIR/galaxy_sign.secret.yaml
$KUBECTL apply -f $KUBE_ASSETS_DIR/signing_scripts.configmap.yaml
elif [[ "$CI_TEST" == "galaxy" && "$CI_TEST_DATABASE" == "external" ]]; then
CUSTOM_RESOURCE=galaxy_v1beta1_galaxy_cr.galaxy.externaldb.ci.yaml
echo "Will deploy postgresql secret for testing..."
$KUBECTL apply -f $KUBE_ASSETS_DIR/galaxy-external-database.secret.yaml
echo "Will deploy admin password secret for testing ..."
$KUBECTL apply -f $KUBE_ASSETS_DIR/galaxy-admin-password.secret.yaml
echo "Will deploy signing secret for testing ..."
$KUBECTL apply -f $KUBE_ASSETS_DIR/galaxy_sign.secret.yaml
$KUBECTL apply -f $KUBE_ASSETS_DIR/signing_scripts.configmap.yaml
elif [[ "$CI_TEST" == "galaxy-container" ]]; then
CUSTOM_RESOURCE=galaxy_v1beta1_galaxy_cr.galaxy.yaml
echo "Will deploy admin password secret for testing ..."
$KUBECTL apply -f $KUBE_ASSETS_DIR/galaxy-admin-password.secret.yaml
echo "Will deploy container auth secret for testing ..."
$KUBECTL apply -f $KUBE_ASSETS_DIR/galaxy-container-auth.secret.yaml
elif [[ "$(hostname)" == "galaxy-demo"* ]]; then
CUSTOM_RESOURCE=galaxy_v1beta1_galaxy_cr.galaxy-demo.yaml
else
CUSTOM_RESOURCE=galaxy_v1beta1_galaxy_cr.default.yaml
fi
echo "Will deploy config Custom Resource config/samples/$CUSTOM_RESOURCE"
$KUBECTL apply -f config/samples/$CUSTOM_RESOURCE