devzone 7.5.1 → 7.5.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.devcontainer/devzone +4 -5
- package/.devcontainer/versions.env +1 -1
- package/.devcontainer/workspace-init.sh +5 -0
- package/bin/SHA256SUMS +6 -6
- package/bin/devzone-darwin-amd64 +0 -0
- package/bin/devzone-darwin-arm64 +0 -0
- package/bin/devzone-linux-amd64 +0 -0
- package/bin/devzone-linux-arm64 +0 -0
- package/bin/devzone-windows-amd64.exe +0 -0
- package/bin/devzone-windows-arm64.exe +0 -0
- package/manage/devzone +29 -7
- package/manage/scripts/workspace/argocd-workspace.sh +1 -1
- package/manage/workspace.sh +1 -3
- package/package.json +1 -1
- package/.devcontainer/devzone-status.sh +0 -144
- package/.devcontainer/services-admin.sh +0 -115
- package/manage/scripts/create-mode.sh +0 -103
- package/manage/scripts/devzone-create.sh +0 -110
- package/manage/scripts/kube-ready.sh +0 -75
package/.devcontainer/devzone
CHANGED
|
@@ -100,13 +100,12 @@ GITLAB_URL_MODULE=http://gitlab.localhost:8929
|
|
|
100
100
|
# shellcheck source=SCRIPTDIR/devzone-platform.sh
|
|
101
101
|
# shellcheck disable=SC1091
|
|
102
102
|
. "$ICI/devzone-platform.sh"
|
|
103
|
-
# shellcheck source=SCRIPTDIR/devzone-status.sh
|
|
104
|
-
# shellcheck disable=SC1091
|
|
105
|
-
. "$ICI/devzone-status.sh"
|
|
106
|
-
|
|
107
103
|
|
|
108
104
|
case "${1:-}" in
|
|
109
|
-
"" | status | modules)
|
|
105
|
+
"" | status | modules)
|
|
106
|
+
echo "devzone status: Go binary of the pod unavailable (.devcontainer/bin)" >&2
|
|
107
|
+
exit 1
|
|
108
|
+
;;
|
|
110
109
|
state)
|
|
111
110
|
export DEVZONE_STATE="$ETAT"
|
|
112
111
|
case "${2:-}" in
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
# Single source for the repowarden version used by workspace-init.sh and manage/scripts/ci/versions.sh.
|
|
2
|
-
REPOWARDEN_VERSION=4.18.
|
|
2
|
+
REPOWARDEN_VERSION=4.18.2
|
|
3
3
|
|
|
4
4
|
# Pinned metrics-server release installed on the local clusters by devzone.
|
|
5
5
|
METRICS_SERVER_VERSION=v0.9.0
|
|
@@ -4,6 +4,9 @@
|
|
|
4
4
|
# step. No Docker socket is used and no kubeconfig is fabricated.
|
|
5
5
|
set -uo pipefail
|
|
6
6
|
|
|
7
|
+
# A crash must not leave a multi-gigabyte core file in a worktree (#961).
|
|
8
|
+
ulimit -c 0 2>/dev/null || true
|
|
9
|
+
|
|
7
10
|
HERE="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
|
8
11
|
VERSIONS_ENV="$HERE/versions.env"
|
|
9
12
|
PROMPT_START="# >>> devzone prompt >>>"
|
|
@@ -77,6 +80,8 @@ init_prompt() {
|
|
|
77
80
|
fi
|
|
78
81
|
cat >>"$bashrc" <<'PROMPT'
|
|
79
82
|
# >>> devzone prompt >>>
|
|
83
|
+
# Interactive shells in the pod must not write core files either (#961).
|
|
84
|
+
ulimit -c 0 2>/dev/null || true
|
|
80
85
|
PS1='$(devzone kube prompt) '"$PS1"
|
|
81
86
|
# <<< devzone prompt <<<
|
|
82
87
|
PROMPT
|
package/bin/SHA256SUMS
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
1
|
+
d4382c403b479bc421b234cdfd094b018e15df7634f50491cb8c1a852c80472a devzone-linux-amd64
|
|
2
|
+
3b4f2ccbb677cb19f8726738df2f2a91af5d59707029caab9b15908f753c4d8d devzone-linux-arm64
|
|
3
|
+
f0ff8d1030d6c45ba53f40128d79101a1d6ed5c41357ec6cea57e6ee3e6b8f8f devzone-darwin-amd64
|
|
4
|
+
652bc3b7565332aaba690984f95dffa38c92c4845c0396190b635a18c6a32e8e devzone-darwin-arm64
|
|
5
|
+
0b80aa8dad7e915d1ce42ad64080933bb806f97b2f89bcc502ea6eb5c1f064aa devzone-windows-amd64.exe
|
|
6
|
+
37c6abe52e7b58191e7edd49769bf0a4d73ae65047e4e51cc6ff8e62ca73f6f7 devzone-windows-arm64.exe
|
package/bin/devzone-darwin-amd64
CHANGED
|
Binary file
|
package/bin/devzone-darwin-arm64
CHANGED
|
Binary file
|
package/bin/devzone-linux-amd64
CHANGED
|
Binary file
|
package/bin/devzone-linux-arm64
CHANGED
|
Binary file
|
|
Binary file
|
|
Binary file
|
package/manage/devzone
CHANGED
|
@@ -108,13 +108,38 @@ go_install() {
|
|
|
108
108
|
|
|
109
109
|
# Runs the Go binary when it applies (never returns then); otherwise returns
|
|
110
110
|
go_launch() {
|
|
111
|
-
local platform ext="" name bin want have ver base target
|
|
111
|
+
local platform ext="" name bin want have ver base target tmpgo
|
|
112
112
|
if [ -n "${DEVZONE_NO_GO:-}" ] || [ -n "${DEVZONE_FROM_GO:-}" ]; then return 0; fi
|
|
113
113
|
platform="$(go_platform)" || return 0
|
|
114
114
|
case "$platform" in windows-*) ext=.exe ;; esac
|
|
115
115
|
name="devzone-$platform$ext"
|
|
116
116
|
bin="$PAQUET/bin/$name"
|
|
117
|
-
[ -f "$bin" ]
|
|
117
|
+
if [ ! -f "$bin" ]; then
|
|
118
|
+
# No packaged binary (a checkout): resolve one with go when it is
|
|
119
|
+
# available, into the cache, and export it; stay in bash then (#884)
|
|
120
|
+
ver="$(version)"
|
|
121
|
+
base="${XDG_CACHE_HOME:-}"
|
|
122
|
+
if [ -z "$base" ] && [ -n "${HOME:-}" ]; then base="$HOME/.cache"; fi
|
|
123
|
+
target=""
|
|
124
|
+
if [ -n "$base" ] && [ "$ver" != inconnue ] && command -v go >/dev/null 2>&1; then
|
|
125
|
+
target="$base/devzone/bin/$ver/devzone$ext"
|
|
126
|
+
if [ ! -x "$target" ] || [ "$(cat "$target.sha256" 2>/dev/null)" != built ]; then
|
|
127
|
+
tmpgo="$(mktemp "${TMPDIR:-/tmp}/devzone-go.XXXXXX")" || tmpgo=""
|
|
128
|
+
if [ -n "$tmpgo" ] && (cd "$PAQUET" && go build -o "$tmpgo" ./cmd/devzone 2>/dev/null) \
|
|
129
|
+
&& mkdir -p "$(dirname "$target")" && mv -f "$tmpgo" "$target" && printf 'built\n' >"$target.sha256"; then
|
|
130
|
+
:
|
|
131
|
+
else
|
|
132
|
+
rm -f "$tmpgo"
|
|
133
|
+
target=""
|
|
134
|
+
fi
|
|
135
|
+
fi
|
|
136
|
+
fi
|
|
137
|
+
if [ -n "$target" ]; then export DEVZONE_HOST_BIN="$target"; fi
|
|
138
|
+
return 0
|
|
139
|
+
fi
|
|
140
|
+
# The shell scripts still run call the Go program for their checks (#884):
|
|
141
|
+
# the launcher exports it first; the exec path below refines it to the cache
|
|
142
|
+
export DEVZONE_HOST_BIN="$bin"
|
|
118
143
|
ver="$(version)"
|
|
119
144
|
[ "$ver" != inconnue ] || return 0
|
|
120
145
|
base="${XDG_CACHE_HOME:-}"
|
|
@@ -231,10 +256,7 @@ case "${1:-}" in
|
|
|
231
256
|
echo "✖ devzone $1: pod command; run it in the pod (make shell), or choose another folder name" >&2
|
|
232
257
|
exit 2
|
|
233
258
|
fi
|
|
234
|
-
#
|
|
235
|
-
|
|
236
|
-
# shellcheck source=SCRIPTDIR/scripts/devzone-create.sh
|
|
237
|
-
. "$PAQUET/manage/scripts/devzone-create.sh"
|
|
238
|
-
create_workstation "$1" "${@:2}"
|
|
259
|
+
# Creation lives in Go (#884): the shell only names the folder and the package
|
|
260
|
+
DEVZONE_PAQUET="$PAQUET" "${DEVZONE_HOST_BIN:?devzone: Go program not found (DEVZONE_HOST_BIN), run it through manage/devzone}" create-workstation "$1" "${@:2}"
|
|
239
261
|
;;
|
|
240
262
|
esac
|
|
@@ -159,7 +159,7 @@ argocd_install() {
|
|
|
159
159
|
argocd_ensure() {
|
|
160
160
|
argocd_wanted || return 0
|
|
161
161
|
argocd_installed && return 0
|
|
162
|
-
if !
|
|
162
|
+
if ! "${DEVZONE_HOST_BIN:?devzone: Go program not found (DEVZONE_HOST_BIN), run it through manage/devzone}" kube-ready >/dev/null; then
|
|
163
163
|
echo "⚠ Argo CD not checked: the cluster does not answer (devzone workspace services enable argocd once it does)" >&2
|
|
164
164
|
return 0
|
|
165
165
|
fi
|
package/manage/workspace.sh
CHANGED
|
@@ -53,7 +53,7 @@ default_image_tag() {
|
|
|
53
53
|
# Installs or upgrades the workspace in the cluster; the cluster is checked first (#565): no Argo CD, helm or pod wait for a stopped one.
|
|
54
54
|
start_workspace() {
|
|
55
55
|
local repo tag image with_image="" args=()
|
|
56
|
-
|
|
56
|
+
"${DEVZONE_HOST_BIN:?devzone: Go program not found (DEVZONE_HOST_BIN), run it through manage/devzone}" kube-ready --hint >&2 || return 1
|
|
57
57
|
repo="$IMAGE_REPO"
|
|
58
58
|
tag="$(default_image_tag)"
|
|
59
59
|
while [ $# -gt 0 ]; do
|
|
@@ -120,8 +120,6 @@ shell_workspace() {
|
|
|
120
120
|
kubectl $(kubectl_flag) exec -it devzone-workspace-0 --namespace devzone-workspace -c workspace -- bash
|
|
121
121
|
}
|
|
122
122
|
|
|
123
|
-
# shellcheck source=manage/scripts/kube-ready.sh
|
|
124
|
-
. "$HERE/scripts/kube-ready.sh"
|
|
125
123
|
# shellcheck source=manage/scripts/workspace/argocd-workspace.sh
|
|
126
124
|
. "$HERE/scripts/workspace/argocd-workspace.sh"
|
|
127
125
|
# shellcheck source=manage/scripts/workspace/argocd-services.sh
|
package/package.json
CHANGED
|
@@ -1,144 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env bash
|
|
2
|
-
# shellcheck shell=bash
|
|
3
|
-
# devzone, status summary of the modules.
|
|
4
|
-
# Sourced by .devcontainer/devzone (split of the 1 600 lines file, #722):
|
|
5
|
-
# functions only, shared variables are defined in devzone.
|
|
6
|
-
|
|
7
|
-
# Full state: ✔ ready, ✖ required, ○ optional, ⚠ to fix; each point to do with
|
|
8
|
-
# its command (shown at each startup)
|
|
9
|
-
show_state() {
|
|
10
|
-
local name email status m late path ports_state ctx_work ctx_host packages_mark packages_names argocd_repo
|
|
11
|
-
echo "devzone: state (devzone to show it again)"
|
|
12
|
-
"${DEVZONE_HOST_BIN:?devzone: Go pod binary unavailable}" version-available-line
|
|
13
|
-
name="$(git config --get user.name || true)"
|
|
14
|
-
email="$(git config --get user.email || true)"
|
|
15
|
-
if [ -n "$name" ] && [ -n "$email" ]; then
|
|
16
|
-
echo " ✔ git identity $name <$email>"
|
|
17
|
-
else
|
|
18
|
-
echo " ✖ git identity needed to commit: gh auth login -s workflow (automatic),"
|
|
19
|
-
echo " or git config --file ~/.config/git/config user.name \"<name>\" and user.email \"<email>\""
|
|
20
|
-
fi
|
|
21
|
-
if [ "$(platform_read)" = gitlab ]; then
|
|
22
|
-
# gitlab platform: the instance and glab, then the lines specific to
|
|
23
|
-
# GitHub (gh checks) reported as not applicable here, pending the GitLab
|
|
24
|
-
# support of repowarden (#531)
|
|
25
|
-
platform_line
|
|
26
|
-
url="$(gitlab_url_read)"
|
|
27
|
-
if git config --global --get "credential.$url.helper" 2>/dev/null | grep -q 'glab auth git-credential'; then
|
|
28
|
-
echo " ✔ git via glab"
|
|
29
|
-
else
|
|
30
|
-
echo " ⚠ git via glab to set: devzone platform gitlab"
|
|
31
|
-
fi
|
|
32
|
-
echo " ○ GitHub not needed here (gitlab platform chosen)"
|
|
33
|
-
echo " ⚠ repowarden stays on GitHub (bots and tickets): GitLab support coming (simdevWarden/repowarden#531)"
|
|
34
|
-
else
|
|
35
|
-
platform_line
|
|
36
|
-
if ! status="$(gh auth status 2>&1)"; then
|
|
37
|
-
echo " ○ GitHub optional (push and PR, repowarden tickets) : gh auth login -s workflow"
|
|
38
|
-
elif grep -q "Token scopes:" <<<"$status" && ! grep -q "'workflow'" <<<"$status"; then
|
|
39
|
-
echo " ⚠ GitHub connected, without workflow permission (push of .github/workflows/ refused): gh auth refresh -h github.com -s workflow"
|
|
40
|
-
else
|
|
41
|
-
echo " ✔ GitHub connected"
|
|
42
|
-
fi
|
|
43
|
-
fi
|
|
44
|
-
if late="$("${DEVZONE_HOST_BIN:?devzone: Go pod binary unavailable}" state outdated-tools 2>/dev/null)"; then
|
|
45
|
-
if [ -z "$late" ]; then
|
|
46
|
-
echo " ✔ tools pinned versions"
|
|
47
|
-
else
|
|
48
|
-
while read -r package pinned installed; do
|
|
49
|
-
[ -n "$package" ] || continue
|
|
50
|
-
echo " ⚠ tools $package $installed installed, $pinned pinned: devzone apply"
|
|
51
|
-
done <<<"$late"
|
|
52
|
-
fi
|
|
53
|
-
fi
|
|
54
|
-
while IFS= read -r path; do
|
|
55
|
-
[ -n "$path" ] || continue
|
|
56
|
-
echo " ⚠ worktree $path absent here (created outside the container?): manage it on that side, never git worktree prune here (manage/docs/reference.md, Git worktrees)"
|
|
57
|
-
done < <("${DEVZONE_HOST_BIN:?devzone: Go pod binary unavailable}" state missing-worktrees)
|
|
58
|
-
for m in "${MODULES[@]}"; do
|
|
59
|
-
if in_pod && service_module "$m"; then
|
|
60
|
-
# Kubernetes workspace pod (#528): presence by the cluster DNS
|
|
61
|
-
service_pod_line "$m"
|
|
62
|
-
elif [ "$(value_of "$m")" = on ] && [ -f "$(failure_marker_file "$m")" ]; then
|
|
63
|
-
printf ' ✖ module %-10s failed: incomplete install (%s): devzone apply\n' "$m" "$(cat "$(failure_marker_file "$m")")"
|
|
64
|
-
elif [ "$(value_of "$m")" = on ] && [ "$m" = gitlab ]; then
|
|
65
|
-
# gitlab active: its real state (ready, runner, failed)
|
|
66
|
-
printf ' ✔ module %-10s %s\n' "$m" "$("$ICI/devzone" gitlab status)"
|
|
67
|
-
elif [ "$(value_of "$m")" = on ] && [ "$m" = postgres ]; then
|
|
68
|
-
printf ' ✔ module %-10s %s\n' "$m" "$("$ICI/devzone" postgres status)"
|
|
69
|
-
elif [ "$(value_of "$m")" = on ] && [ "$m" = argocd ]; then
|
|
70
|
-
printf ' ✔ module %-10s %s\n' "$m" "$("$ICI/devzone" argocd status)"
|
|
71
|
-
elif [ "$(value_of "$m")" = on ] && [ "$m" = mysql ]; then
|
|
72
|
-
printf ' ✔ module %-10s %s\n' "$m" "$("$ICI/devzone" mysql status)"
|
|
73
|
-
elif [ "$(value_of "$m")" = on ]; then
|
|
74
|
-
printf ' ✔ module %-10s active: %s\n' "$m" "$(description "$m")"
|
|
75
|
-
else
|
|
76
|
-
printf ' ○ module %-10s optional, %s: devzone enable %s\n' "$m" "$(description "$m")" "$m"
|
|
77
|
-
fi
|
|
78
|
-
# Service held by an Argo CD Application (#916): the line is printed by devzone state held
|
|
79
|
-
held="$(DEVZONE_STATE="$ETAT" bash "$ICI/devzone" state held "$m" 2>/dev/null || true)"
|
|
80
|
-
[ -z "$held" ] || printf ' %s\n' "$held"
|
|
81
|
-
done
|
|
82
|
-
# GitOps repository of the instance (#539): the designation of .argocd.conf
|
|
83
|
-
argocd_repo="$(conf_get argocd repo)"
|
|
84
|
-
if [ -n "$argocd_repo" ] && [ "$argocd_repo" != none ]; then
|
|
85
|
-
printf ' ○ argocd GitOps repository: %s\n' "$argocd_repo"
|
|
86
|
-
elif in_pod; then
|
|
87
|
-
DEVZONE_STATE="$ETAT" bash "$ICI/devzone" state gitops-line
|
|
88
|
-
else
|
|
89
|
-
printf ' ○ argocd no GitOps repository: devzone argocd init\n'
|
|
90
|
-
fi
|
|
91
|
-
# Catalog applications (#414)
|
|
92
|
-
if [ -d "$ICI/catalog" ]; then
|
|
93
|
-
DEVZONE_STATE="$ETAT" "$ICI/devzone" catalog resume
|
|
94
|
-
fi
|
|
95
|
-
# GitLab Rails secret (#347): warning if the secrets were lost
|
|
96
|
-
if [ "$(value_of gitlab)" = on ] && [ ! -f "$RACINE/workspace/.gitlab/rails-secret.yaml" ]; then
|
|
97
|
-
echo " ⚠ gitlab GitLab reinstalled: if the browser shows 422, delete the site data of gitlab.localhost"
|
|
98
|
-
fi
|
|
99
|
-
# Remote devzone cluster: warning in the summary
|
|
100
|
-
current_cluster="$("$ICI/devzone" kube saved)"
|
|
101
|
-
if [ -n "$current_cluster" ] && ! "$ICI/devzone" kube local "$current_cluster"; then
|
|
102
|
-
printf ' ⚠ cluster remote: %s — services on a remote cluster\n' "$current_cluster"
|
|
103
|
-
fi
|
|
104
|
-
"$ICI/devzone" cluster clean --quiet || true
|
|
105
|
-
# Old kind-gitlab cluster still present: invite to migrate (#396)
|
|
106
|
-
if kind get clusters 2>/dev/null | grep -qx "gitlab${INSTANCE_SUFFIX}"; then
|
|
107
|
-
printf ' ⚠ old kind-gitlab cluster%s: devzone gitlab migrate\n' "$INSTANCE_SUFFIX"
|
|
108
|
-
fi
|
|
109
|
-
# Internal working cluster (kind): warning in the summary
|
|
110
|
-
ctx_work="$(kubectl config current-context 2>/dev/null || true)"
|
|
111
|
-
case "$ctx_work" in
|
|
112
|
-
kind-gitlab* | kind-devzone*)
|
|
113
|
-
ctx_host="$(KUBECONFIG="${DEVZONE_KUBE_HOST:-$HOME/.kube/hote.config}" kubectl config current-context 2>/dev/null || true)"
|
|
114
|
-
if [ -n "$ctx_host" ] && "$ICI/devzone" kube reachable "$ctx_host"; then
|
|
115
|
-
printf ' ⚠ working cluster: %s (devzone internal cluster); go back: devzone use %s\n' "$ctx_work" "$ctx_host"
|
|
116
|
-
fi
|
|
117
|
-
;;
|
|
118
|
-
esac
|
|
119
|
-
# RBAC check: access check to the PostgreSQL secrets
|
|
120
|
-
ctx_rbac="$(kubectl auth can-i --as=system:serviceaccount:default:default get secrets -n devzone-postgres 2>/dev/null || true)"
|
|
121
|
-
if [ "$ctx_rbac" = "yes" ]; then
|
|
122
|
-
printf ' ⚠ rbac : access to devzone-postgres secrets not restricted\n'
|
|
123
|
-
fi
|
|
124
|
-
ports_state="$(DEVZONE_STATE="$ETAT" devzone port resume 2>/dev/null || echo none)"
|
|
125
|
-
case "$ports_state" in
|
|
126
|
-
none*) printf ' ○ ports to the workstation %s\n' "$ports_state" ;;
|
|
127
|
-
*) printf ' ✔ ports to the workstation %s\n' "$ports_state" ;;
|
|
128
|
-
esac
|
|
129
|
-
# Grouped credentials (#332): the path only, never the content
|
|
130
|
-
if [ -f "$RACINE/.password" ]; then
|
|
131
|
-
printf ' ○ credentials: %s\n' "$RACINE/.password"
|
|
132
|
-
fi
|
|
133
|
-
# Mark set by packages.sh at the failed reapplication (351): names of the packages not installed
|
|
134
|
-
packages_mark="${DEVZONE_PACKAGES_MARKER:-/tmp/devzone-packages.failed}"
|
|
135
|
-
if [ -f "$packages_mark" ]; then
|
|
136
|
-
packages_names=""
|
|
137
|
-
while IFS= read -r n; do
|
|
138
|
-
if [ -n "$n" ]; then
|
|
139
|
-
packages_names="${packages_names:+$packages_names, }$n"
|
|
140
|
-
fi
|
|
141
|
-
done < "$packages_mark"
|
|
142
|
-
echo " ⚠ packages $packages_names: devzone packages"
|
|
143
|
-
fi
|
|
144
|
-
}
|
|
@@ -1,115 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env bash
|
|
2
|
-
# Installs or removes a devzone service (gitlab, postgres, argocd) from inside
|
|
3
|
-
# the Kubernetes workspace pod, with a temporary administrator token (#528).
|
|
4
|
-
# services-admin.sh enable|disable <service> [options of devzone enable]
|
|
5
|
-
# services-admin.sh seed gitlab data of gitlab seeded again, in the pod (#538)
|
|
6
|
-
# Run by the workstation (devzone workspace services, Go) through
|
|
7
|
-
# kubectl exec -i: the token comes on stdin, is never printed and lives only
|
|
8
|
-
# in a temporary kubeconfig removed at the end.
|
|
9
|
-
# Why: the pod has no kubeconfig and its service account is limited (#430),
|
|
10
|
-
# while the installers need an administrator. The temporary kubeconfig holds
|
|
11
|
-
# two contexts on the cluster of the pod (API server kubernetes.default.svc,
|
|
12
|
-
# CA of the pod): devzone-admin, the administrator the installers use through
|
|
13
|
-
# the line cluster=devzone-admin of the state, and devzone, the context the
|
|
14
|
-
# module scripts use (account_token may replace it by the limited account).
|
|
15
|
-
# The cluster line of the state is put back afterwards, and the relays
|
|
16
|
-
# started by the installer are stopped: in the pod the services are reached
|
|
17
|
-
# by the cluster DNS, and a relay would keep the token in use.
|
|
18
|
-
set -euo pipefail
|
|
19
|
-
|
|
20
|
-
HERE="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
|
21
|
-
# The devzone command beside this script, not the one of the PATH: the copy
|
|
22
|
-
# that runs the installers is the one of this folder (#591)
|
|
23
|
-
DEVZONE_CMD="$HERE/devzone"
|
|
24
|
-
RACINE="${DEVZONE_ROOT:-$(dirname "$HERE")}"
|
|
25
|
-
ETAT="${DEVZONE_STATE:-$RACINE/.devzone.modules}"
|
|
26
|
-
SA_DIR="${DEVZONE_SA_DIR:-/var/run/secrets/kubernetes.io/serviceaccount}"
|
|
27
|
-
API_SERVER="${DEVZONE_API_SERVER:-https://kubernetes.default.svc}"
|
|
28
|
-
ADMIN_CONTEXT=devzone-admin
|
|
29
|
-
ADMIN_USER=devzone-services-admin
|
|
30
|
-
ADMIN_CLUSTER=devzone-pod
|
|
31
|
-
|
|
32
|
-
refuse() {
|
|
33
|
-
echo "devzone services: $*" >&2
|
|
34
|
-
exit 2
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
action="${1:-}"
|
|
39
|
-
service="${2:-}"
|
|
40
|
-
case "$action" in
|
|
41
|
-
enable) action=enable ;;
|
|
42
|
-
disable) action=disable ;;
|
|
43
|
-
seed) ;;
|
|
44
|
-
*) refuse "usage: services-admin.sh enable|disable|seed gitlab|postgres|argocd [options]" ;;
|
|
45
|
-
esac
|
|
46
|
-
case "$service" in
|
|
47
|
-
gitlab | postgres | argocd) ;;
|
|
48
|
-
*) refuse "unknown service: ${service:-(none)} (gitlab, postgres, argocd)" ;;
|
|
49
|
-
esac
|
|
50
|
-
# The seed of the data (group, demo project, dev user, runner) is gitlab's (#538)
|
|
51
|
-
if [ "$action" = seed ] && [ "$service" != gitlab ]; then
|
|
52
|
-
refuse "seed: only gitlab"
|
|
53
|
-
fi
|
|
54
|
-
[ "${DEVZONE_WORKSPACE:-}" = kubernetes ] || refuse "only in the Kubernetes workspace pod"
|
|
55
|
-
[ -f "$SA_DIR/ca.crt" ] || refuse "cluster CA not found: $SA_DIR/ca.crt"
|
|
56
|
-
if [ -t 0 ]; then
|
|
57
|
-
refuse "the token is read on stdin (run by devzone workspace services)"
|
|
58
|
-
fi
|
|
59
|
-
token="$(cat)"
|
|
60
|
-
token="${token//[$'\r\n']/}"
|
|
61
|
-
[ -n "$token" ] || refuse "empty token on stdin"
|
|
62
|
-
|
|
63
|
-
kubeconfig="$(mktemp "${TMPDIR:-/tmp}/devzone-services-admin.XXXXXX")"
|
|
64
|
-
chmod 600 "$kubeconfig"
|
|
65
|
-
cluster_before="$(grep -E '^cluster=' "$ETAT" 2>/dev/null | tail -1 | cut -d= -f2- || true)"
|
|
66
|
-
|
|
67
|
-
# Always at the end, even on failure: kubeconfig removed, relays stopped,
|
|
68
|
-
# cluster line of the state as before
|
|
69
|
-
cleanup() {
|
|
70
|
-
rm -f "$kubeconfig"
|
|
71
|
-
"$DEVZONE_CMD" "$service" relay-stop >/dev/null 2>&1 || true
|
|
72
|
-
if [ -n "$cluster_before" ]; then
|
|
73
|
-
DEVZONE_STATE="$ETAT" bash "$HERE/devzone" state write cluster "$cluster_before" || true
|
|
74
|
-
else
|
|
75
|
-
DEVZONE_STATE="$ETAT" bash "$HERE/devzone" state remove cluster || true
|
|
76
|
-
fi
|
|
77
|
-
}
|
|
78
|
-
trap cleanup EXIT
|
|
79
|
-
|
|
80
|
-
ca_data="$(base64 <"$SA_DIR/ca.crt" | tr -d '\n')"
|
|
81
|
-
cat >"$kubeconfig" <<EOF
|
|
82
|
-
apiVersion: v1
|
|
83
|
-
kind: Config
|
|
84
|
-
clusters:
|
|
85
|
-
- name: $ADMIN_CLUSTER
|
|
86
|
-
cluster:
|
|
87
|
-
server: $API_SERVER
|
|
88
|
-
certificate-authority-data: $ca_data
|
|
89
|
-
users:
|
|
90
|
-
- name: $ADMIN_USER
|
|
91
|
-
user:
|
|
92
|
-
token: $token
|
|
93
|
-
contexts:
|
|
94
|
-
- name: $ADMIN_CONTEXT
|
|
95
|
-
context:
|
|
96
|
-
cluster: $ADMIN_CLUSTER
|
|
97
|
-
user: $ADMIN_USER
|
|
98
|
-
- name: devzone
|
|
99
|
-
context:
|
|
100
|
-
cluster: $ADMIN_CLUSTER
|
|
101
|
-
user: $ADMIN_USER
|
|
102
|
-
current-context: $ADMIN_CONTEXT
|
|
103
|
-
EOF
|
|
104
|
-
unset token ca_data
|
|
105
|
-
|
|
106
|
-
export KUBECONFIG="$kubeconfig"
|
|
107
|
-
export DEVZONE_KUBE_CONFIG="$kubeconfig"
|
|
108
|
-
export DEVZONE_SERVICES_ADMIN=1
|
|
109
|
-
DEVZONE_STATE="$ETAT" bash "$HERE/devzone" state write cluster "$ADMIN_CONTEXT" || refuse "cannot write the state: $ETAT"
|
|
110
|
-
echo "devzone services: $action $service in the cluster of the pod (temporary administrator)"
|
|
111
|
-
case "$action" in
|
|
112
|
-
# The seed is a module command: devzone gitlab seed (#538)
|
|
113
|
-
seed) "$DEVZONE_CMD" gitlab seed "${@:3}" ;;
|
|
114
|
-
*) "$DEVZONE_CMD" "$action" "$service" "${@:3}" ;;
|
|
115
|
-
esac
|
|
@@ -1,103 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env bash
|
|
2
|
-
# Workspace mode at creation (#497): a new devzone is a Kubernetes workspace,
|
|
3
|
-
# so the cluster must answer. Without a cluster there is no fallback (#671):
|
|
4
|
-
# creation stops and lists the ways to get a cluster. The Docker workstation is
|
|
5
|
-
# retired (#735). Sourced by manage/devzone (creer): create_mode_choose runs
|
|
6
|
-
# before any file is copied (so --kubernetes without a cluster creates
|
|
7
|
-
# nothing), create_mode_write once the folder exists.
|
|
8
|
-
# Sourced only: no code at file level. Compatible with bash 3.2 (macOS).
|
|
9
|
-
# shellcheck disable=SC2034 # CREATE_MODE is read by manage/devzone (creer)
|
|
10
|
-
# shellcheck source=manage/scripts/kube-ready.sh
|
|
11
|
-
. "$(dirname "${BASH_SOURCE[0]}")/kube-ready.sh"
|
|
12
|
-
|
|
13
|
-
# Context shown to the user: devzone if declared, otherwise the current one.
|
|
14
|
-
kube_context() {
|
|
15
|
-
if kubectl config get-contexts -o name 2>/dev/null | grep -qx 'devzone'; then
|
|
16
|
-
echo devzone
|
|
17
|
-
else
|
|
18
|
-
kubectl config current-context 2>/dev/null || echo none
|
|
19
|
-
fi
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
# Prints, on stderr, how to get a cluster: devzone only displays the commands,
|
|
23
|
-
# it never runs them and no cloud credential goes through it.
|
|
24
|
-
create_mode_no_cluster() {
|
|
25
|
-
cat >&2 <<EOF
|
|
26
|
-
✖ Kubernetes not reachable: $1. Nothing created.
|
|
27
|
-
devzone runs in a Kubernetes cluster. Pick one, then run the same command again:
|
|
28
|
-
- a remote cluster (AWS, GCP, Azure, other): add its context to your kubeconfig, then select it
|
|
29
|
-
aws eks update-kubeconfig --name <cluster>
|
|
30
|
-
gcloud container clusters get-credentials <cluster>
|
|
31
|
-
az aks get-credentials --name <cluster> --resource-group <group>
|
|
32
|
-
kubectl config use-context <context>
|
|
33
|
-
- a local cluster: Docker Desktop (Settings > Kubernetes > Enable Kubernetes), or minikube
|
|
34
|
-
minikube start -p devzone
|
|
35
|
-
EOF
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
# Chooses the mode from the option (kubernetes or empty) and sets CREATE_MODE
|
|
39
|
-
# to kubernetes, with one line of notice. Returns 1, nothing set on disk, when
|
|
40
|
-
# the cluster does not answer.
|
|
41
|
-
create_mode_choose() {
|
|
42
|
-
local option="$1" reason
|
|
43
|
-
if reason="$(kube_ready_reason)"; then
|
|
44
|
-
CREATE_MODE=kubernetes
|
|
45
|
-
echo "✔ Kubernetes ready ($(kube_context)): workspace in the cluster"
|
|
46
|
-
create_mode_existing
|
|
47
|
-
return 0
|
|
48
|
-
fi
|
|
49
|
-
# No option, in a terminal: a menu (remote cluster, minikube) instead of a
|
|
50
|
-
# failure (#653); the choice is accepted only if the cluster then answers.
|
|
51
|
-
# The menu is the Go program's (#884), found through DEVZONE_HOST_BIN; without
|
|
52
|
-
# it no menu is offered (false), and the failure below lists the ways to get a cluster
|
|
53
|
-
if [ -z "$option" ] && "${DEVZONE_HOST_BIN:-false}" cluster-offer && reason="$(kube_ready_reason)"; then
|
|
54
|
-
CREATE_MODE=kubernetes
|
|
55
|
-
echo "✔ Kubernetes ready ($(kube_context)): workspace in the cluster"
|
|
56
|
-
create_mode_existing
|
|
57
|
-
return 0
|
|
58
|
-
fi
|
|
59
|
-
create_mode_no_cluster "$reason"
|
|
60
|
-
return 1
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
# A workspace already installed in the cluster (helm release devzone-workspace,
|
|
64
|
-
# or Argo CD Application devzone-workspace), from any folder: the new folder
|
|
65
|
-
# drives it too, and creation goes on (the start is a helm upgrade, the volumes
|
|
66
|
-
# stay). Notice only.
|
|
67
|
-
create_mode_existing() {
|
|
68
|
-
local ctx
|
|
69
|
-
ctx="$(kube_context)"
|
|
70
|
-
if helm status devzone-workspace --namespace devzone-workspace --kube-context "$ctx" >/dev/null 2>&1 ||
|
|
71
|
-
kubectl get application.argoproj.io devzone-workspace --namespace devzone-argocd --context "$ctx" >/dev/null 2>&1; then
|
|
72
|
-
echo "ℹ a devzone workspace already runs in this cluster: this folder drives it too"
|
|
73
|
-
fi
|
|
74
|
-
return 0
|
|
75
|
-
}
|
|
76
|
-
|
|
77
|
-
# Writes workspace=<mode> in <folder>/.devzone.modules: an earlier workspace=
|
|
78
|
-
# line is replaced, the other lines are kept.
|
|
79
|
-
create_mode_write() {
|
|
80
|
-
local folder="$1" mode="$2" f
|
|
81
|
-
f="$folder/.devzone.modules"
|
|
82
|
-
{
|
|
83
|
-
if [ -f "$f" ]; then grep -v '^workspace=' "$f" || true; fi
|
|
84
|
-
echo "workspace=$mode"
|
|
85
|
-
} >"$f.tmp" && mv "$f.tmp" "$f"
|
|
86
|
-
}
|
|
87
|
-
|
|
88
|
-
# Kubernetes creation: installs the workspace from the package script, run in
|
|
89
|
-
# the new folder (as devzone workspace start does). DEVZONE_WORKSPACE_SH
|
|
90
|
-
# replaces the script (tests); DEVZONE_NO_START only prints the command.
|
|
91
|
-
create_mode_start() {
|
|
92
|
-
local folder="$1" script="$2"
|
|
93
|
-
if [ -n "${DEVZONE_NO_START:-}" ]; then
|
|
94
|
-
echo "To start the workspace: cd $folder && devzone workspace start"
|
|
95
|
-
return 0
|
|
96
|
-
fi
|
|
97
|
-
echo "▶ Starting the workspace in the cluster (a few minutes the first time)…"
|
|
98
|
-
if ! (cd "$folder" && bash "${DEVZONE_WORKSPACE_SH:-$script}" start); then
|
|
99
|
-
echo "✖ Workspace not started. The folder is ready: only the start remains (cd $folder && devzone workspace start)" >&2
|
|
100
|
-
return 1
|
|
101
|
-
fi
|
|
102
|
-
echo "Next: cd $folder && devzone workspace shell (the pod)"
|
|
103
|
-
}
|
|
@@ -1,110 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env bash
|
|
2
|
-
# Creation of a devzone (devzone <folder>): asks for the GitOps repository,
|
|
3
|
-
# copies the package, writes .argocd.conf and the manifest, then starts the
|
|
4
|
-
# workspace in the cluster. Sourced by manage/devzone,
|
|
5
|
-
# which defines PAQUET, PACKAGE_ITEMS and version(); devzone-manifest.sh must
|
|
6
|
-
# be sourced first.
|
|
7
|
-
# shellcheck disable=SC2154 # PAQUET, PACKAGE_ITEMS: set by manage/devzone
|
|
8
|
-
|
|
9
|
-
# GitOps repository of Argo CD for the creation (#539): github, an existing
|
|
10
|
-
# URL, or none. Asked in a terminal (default: github when gh is connected),
|
|
11
|
-
# or none with a notice without one (the --gitops option names the choice).
|
|
12
|
-
ask_gitops() {
|
|
13
|
-
local answer default=""
|
|
14
|
-
if gh auth status >/dev/null 2>&1; then
|
|
15
|
-
default="github"
|
|
16
|
-
fi
|
|
17
|
-
printf 'GitOps repository for Argo CD? [G]itHub (created under your gh account at first start) / a URL / [n]one : ' >&2
|
|
18
|
-
read -r answer || answer=""
|
|
19
|
-
answer="${answer:-$default}"
|
|
20
|
-
case "$answer" in
|
|
21
|
-
G | g | GitHub | github | y | Y | yes) echo "github" ;;
|
|
22
|
-
n | N | none | None) echo "none" ;;
|
|
23
|
-
*) echo "$answer" ;;
|
|
24
|
-
esac
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
create_workstation() {
|
|
28
|
-
local target="$1" gitops="" expect="" option="" arg value login name instance
|
|
29
|
-
shift
|
|
30
|
-
for arg in "$@"; do
|
|
31
|
-
if [ "$expect" = gitops ]; then gitops="$arg"; expect=""; continue; fi
|
|
32
|
-
case "$arg" in
|
|
33
|
-
--gitops) expect=gitops ;;
|
|
34
|
-
--gitops=*) gitops="${arg#--gitops=}" ;;
|
|
35
|
-
--kubernetes) option=kubernetes ;;
|
|
36
|
-
*) echo "✖ unknown option: $arg (devzone <folder> [--gitops github|none|<url>] [--kubernetes])" >&2; exit 1 ;;
|
|
37
|
-
esac
|
|
38
|
-
done
|
|
39
|
-
if [ -n "$expect" ]; then
|
|
40
|
-
echo "✖ --gitops expects a value (github, none or a URL)" >&2
|
|
41
|
-
exit 1
|
|
42
|
-
fi
|
|
43
|
-
|
|
44
|
-
if [ -e "$target" ] && [ -n "$(ls -A "$target" 2>/dev/null)" ]; then
|
|
45
|
-
echo "✖ $target exists and is not empty: nothing is overwritten. Choose another folder." >&2
|
|
46
|
-
exit 1
|
|
47
|
-
fi
|
|
48
|
-
|
|
49
|
-
# Mode before any copy: --kubernetes without a cluster creates nothing (#497)
|
|
50
|
-
# shellcheck source=SCRIPTDIR/create-mode.sh
|
|
51
|
-
. "$PAQUET/manage/scripts/create-mode.sh"
|
|
52
|
-
create_mode_choose "$option" || exit 1
|
|
53
|
-
|
|
54
|
-
if [ -z "$gitops" ]; then
|
|
55
|
-
if [ -t 0 ]; then
|
|
56
|
-
gitops="$(ask_gitops)"
|
|
57
|
-
else
|
|
58
|
-
echo "⚠ no GitOps repository for Argo CD: pass --gitops <github|none|https://github.com/<login>/<name>.git> to create a devzone without a terminal; using none" >&2
|
|
59
|
-
gitops="none"
|
|
60
|
-
fi
|
|
61
|
-
fi
|
|
62
|
-
mkdir -p "$target/workspace" "$target/manage"
|
|
63
|
-
cp -R "${PACKAGE_ITEMS[@]/#/$PAQUET/}" "$target/"
|
|
64
|
-
cp -R "$PAQUET/manage/scripts" "$target/manage/"
|
|
65
|
-
touch "$target/workspace/.gitkeep"
|
|
66
|
-
# npm never includes .gitignore: written here
|
|
67
|
-
: >"$target/.gitignore"
|
|
68
|
-
complete_gitignore "$target"
|
|
69
|
-
chmod +x "$target/manage/scripts/uninstall.sh"
|
|
70
|
-
create_mode_write "$target" "$CREATE_MODE"
|
|
71
|
-
# The GitOps repository of the new devzone (#539): github, an existing URL,
|
|
72
|
-
# or none, written in the .argocd.conf of the new devzone (conf.sh writes
|
|
73
|
-
# the header of the file when absent)
|
|
74
|
-
. "$PAQUET/.devcontainer/argocd/conf.sh"
|
|
75
|
-
# shellcheck disable=SC2034 # read by conf.sh
|
|
76
|
-
ARGOCD_CONF="$target/.argocd.conf"
|
|
77
|
-
if [ "$gitops" = github ]; then
|
|
78
|
-
if ! gh auth status >/dev/null 2>&1; then
|
|
79
|
-
echo "⚠ GitHub not connected (gh auth login): no GitOps repository, the Applications are applied directly; pass --gitops none" >&2
|
|
80
|
-
value="none"
|
|
81
|
-
else
|
|
82
|
-
login="$(gh api user --jq .login 2>/dev/null)" || login=""
|
|
83
|
-
if [ -z "$login" ]; then
|
|
84
|
-
echo "⚠ GitHub login unreadable (gh api user): no GitOps repository, the Applications are applied directly; pass --gitops none" >&2
|
|
85
|
-
value="none"
|
|
86
|
-
else
|
|
87
|
-
name="${DEVZONE_GITOPS_REPO_NAME:-devzone-argocd}"
|
|
88
|
-
instance="${DEVZONE_VOLUMES:-devzone}"
|
|
89
|
-
if [ "$instance" != "devzone" ]; then
|
|
90
|
-
name="$name-$instance"
|
|
91
|
-
fi
|
|
92
|
-
value="https://github.com/$login/$name.git"
|
|
93
|
-
fi
|
|
94
|
-
fi
|
|
95
|
-
elif [ "$gitops" = none ]; then
|
|
96
|
-
value="none"
|
|
97
|
-
else
|
|
98
|
-
value="$gitops"
|
|
99
|
-
fi
|
|
100
|
-
conf_set argocd "repo=$value"
|
|
101
|
-
case "$value" in
|
|
102
|
-
none) echo "✔ no GitOps repository: the Applications are applied directly (devzone workspace argocd init to change)" ;;
|
|
103
|
-
*) echo "✔ GitOps repository: $value ($target/.argocd.conf)" ;;
|
|
104
|
-
esac
|
|
105
|
-
target="$(cd "$target" && pwd)"
|
|
106
|
-
write_manifest "$target"
|
|
107
|
-
echo "✔ devzone $(version) created in $target"
|
|
108
|
-
# The workspace goes to the cluster (kube check done by create_mode_choose)
|
|
109
|
-
create_mode_start "$target" "$PAQUET/manage/workspace.sh"
|
|
110
|
-
}
|
|
@@ -1,75 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env bash
|
|
2
|
-
# Shared check of the Kubernetes cluster (#497, #565), sourced by create-mode.sh,
|
|
3
|
-
# create-mode.sh (creation) and workspace.sh (workspace start). Sourced only:
|
|
4
|
-
# no code at file level. Compatible with bash 3.2 (macOS) and Linux.
|
|
5
|
-
|
|
6
|
-
# Returns 0 when kubectl and helm are present and the cluster answers within 5 s
|
|
7
|
-
# (context devzone if declared, otherwise the current context). Otherwise
|
|
8
|
-
# prints one short line on stdout (kubectl missing, helm missing, or
|
|
9
|
-
# cluster <context> unreachable (<server>)) and returns 1. With --hint, prints
|
|
10
|
-
# the message for the user instead (#565, see kube_unreachable_hint).
|
|
11
|
-
kube_ready_reason() {
|
|
12
|
-
local context server hint=no
|
|
13
|
-
[ "${1:-}" = --hint ] && hint=yes
|
|
14
|
-
command -v kubectl >/dev/null 2>&1 || {
|
|
15
|
-
kube_say "kubectl missing" "$hint"
|
|
16
|
-
return 1
|
|
17
|
-
}
|
|
18
|
-
command -v helm >/dev/null 2>&1 || {
|
|
19
|
-
kube_say "helm missing" "$hint"
|
|
20
|
-
return 1
|
|
21
|
-
}
|
|
22
|
-
if kubectl config get-contexts -o name 2>/dev/null | grep -qx 'devzone'; then
|
|
23
|
-
kubectl cluster-info --request-timeout=5s --context devzone >/dev/null 2>&1 && return 0
|
|
24
|
-
context=devzone
|
|
25
|
-
server="$(kubectl config view --minify --context devzone -o 'jsonpath={.clusters[0].cluster.server}' 2>/dev/null || true)"
|
|
26
|
-
else
|
|
27
|
-
kubectl cluster-info --request-timeout=5s >/dev/null 2>&1 && return 0
|
|
28
|
-
context="$(kubectl config current-context 2>/dev/null || true)"
|
|
29
|
-
server="$(kubectl config view --minify -o 'jsonpath={.clusters[0].cluster.server}' 2>/dev/null || true)"
|
|
30
|
-
fi
|
|
31
|
-
if [ "$hint" = yes ]; then
|
|
32
|
-
kube_unreachable_hint "${context:-none}" "${server:-unknown server}"
|
|
33
|
-
else
|
|
34
|
-
echo "cluster ${context:-none} unreachable (${server:-unknown server})"
|
|
35
|
-
fi
|
|
36
|
-
return 1
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
# One reason line: as is, or as a ✖ line for the user (--hint).
|
|
40
|
-
kube_say() {
|
|
41
|
-
if [ "$2" = yes ]; then
|
|
42
|
-
echo "✖ $1"
|
|
43
|
-
else
|
|
44
|
-
echo "$1"
|
|
45
|
-
fi
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
# Cluster name of a context (empty when unknown).
|
|
49
|
-
kube_context_cluster() {
|
|
50
|
-
kubectl config view --minify --context "$1" -o 'jsonpath={.clusters[0].name}' 2>/dev/null || true
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
# Message of an unreachable cluster <context> at <server> (#565). The cluster of
|
|
54
|
-
# Docker Desktop (context docker-desktop, or a local server 127.0.0.1 or
|
|
55
|
-
# localhost of a cluster named docker-desktop) runs inside Docker Desktop: when
|
|
56
|
-
# docker info fails, the cause is Docker Desktop stopped; when Docker answers,
|
|
57
|
-
# Kubernetes is disabled in it. Any other context gets the generic message.
|
|
58
|
-
kube_unreachable_hint() {
|
|
59
|
-
local context="$1" server="$2" cluster host
|
|
60
|
-
cluster="$(kube_context_cluster "$context")"
|
|
61
|
-
host="${server#*://}"
|
|
62
|
-
host="${host%%[:/]*}"
|
|
63
|
-
if [ "$context" = docker-desktop ] ||
|
|
64
|
-
{ [ "$cluster" = docker-desktop ] && { [ "$host" = 127.0.0.1 ] || [ "$host" = localhost ]; }; }; then
|
|
65
|
-
if ! docker info >/dev/null 2>&1; then
|
|
66
|
-
echo "✖ Docker Desktop is stopped: the Kubernetes cluster of this machine runs inside it. Start Docker Desktop, then: devzone workspace start"
|
|
67
|
-
echo " Tip: Settings → General → Start Docker Desktop when you sign in"
|
|
68
|
-
else
|
|
69
|
-
echo "✖ Kubernetes cluster $context unreachable ($server): enable Kubernetes in Docker Desktop (Settings → Kubernetes) or check kubectl config get-contexts"
|
|
70
|
-
fi
|
|
71
|
-
return 0
|
|
72
|
-
fi
|
|
73
|
-
echo "✖ Kubernetes cluster $context unreachable ($server)"
|
|
74
|
-
echo " Check the contexts: kubectl config get-contexts"
|
|
75
|
-
}
|