-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathcluster-api-migration.sh
executable file
·89 lines (74 loc) · 1.63 KB
/
cluster-api-migration.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
#!/bin/bash
# shellcheck disable=SC1091,SC2034
set -eo pipefail
PROVIDER=${1:-"docker"}
COMMAND=${2-""}
FORCE=${FORCE:-"false"}
if [[ ! -d "providers/${PROVIDER}" ]]; then
echo "Provider not found: $PROVIDER"
exit 1
fi
SCRIPT_DIR=$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" &> /dev/null && pwd)
source "$SCRIPT_DIR/config.env"
source "$SCRIPT_DIR/lib/prereqs.sh"
source "$SCRIPT_DIR/lib/utils.sh"
source "$SCRIPT_DIR/lib/init.sh"
source "$SCRIPT_DIR/lib/migration.sh"
TMP_PATH=$SCRIPT_DIR/output
TMP_BIN_PATH=$TMP_PATH/bin
PATH=$TMP_BIN_PATH/:$PATH
PROVIDER_MANIFESTS_DIR="$SCRIPT_DIR/providers/$PROVIDER/manifests"
# Run the prerequisites
# * download necessary tools
# * source provider specific migration phases
# * run provider specific prerequisites
prereqs
case "${COMMAND}" in
"purge_and_init_mgmt_cluster")
purge_and_init_mgmt_cluster
;;
"kustomize_workload_manifest")
kustomize_workload_manifest
;;
"init_workload_cluster")
init_workload_cluster
;;
"migration_phase_cluster")
migration_phase_cluster
;;
"migration_phase_control_plane")
migration_phase_control_plane
;;
"migration_phase_worker")
migration_phase_worker
;;
"rolling_upgrade_control_plane")
rolling_upgrade_control_plane
;;
"rolling_upgrade_worker")
rolling_upgrade_worker
;;
"")
purge_and_init_mgmt_cluster
kustomize_workload_manifest
press_enter
init_workload_cluster
purge_and_init_mgmt_cluster
press_enter
migration_phase_cluster
press_enter
migration_phase_control_plane
press_enter
migration_phase_worker
press_enter
rolling_upgrade_control_plane
press_enter
rolling_upgrade_worker
;;
*)
echo "Invalid command: $1"
echo
usage
exit 1
;;
esac