-
Notifications
You must be signed in to change notification settings - Fork 16
Expand file tree
/
Copy path02-infra.env
More file actions
24 lines (22 loc) · 860 Bytes
/
02-infra.env
File metadata and controls
24 lines (22 loc) · 860 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
# shellcheck shell=bash
is_infra_cluster() {
local server
server=$(try_kubectl config view --minify -o jsonpath='{.clusters[0].cluster.server}')
if [[ "$server" =~ infra\.rox\.systems ]]; then
return 0
fi
if [[ "$server" =~ openshiftapps\.com || "$server" =~ devshift\.org ]]; then
# Selected cluster is ROSA or OSD. Need to make sure that it's an infra cluster.
if ! command -v infractl >/dev/null 2>&1; then
echo "Can't auto-detect if the selected cluster is an infra cluster because the infractl tool is not installed."
return 1
fi
if infractl list --json | jq -r '.Clusters[].URL' 2>/dev/null | grep -q $(oc whoami --show-console); then
return 0
fi
fi
return 1
}
if is_infra_cluster; then
export CLUSTER_TYPE_DEFAULT="infra-openshift"
fi