devzone 0.36.5 → 0.36.7
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/Dockerfile +24 -0
- package/.devcontainer/devzone +78 -4
- package/.devcontainer/etat-json.sh +13 -1
- package/.devcontainer/services-admin.sh +105 -0
- package/.devcontainer/versions.env +4 -0
- package/.devcontainer/workspace-build.sh +51 -0
- package/README.md +30 -30
- package/charts/devzone-workspace/Chart.yaml +1 -1
- package/charts/devzone-workspace/templates/networkpolicy.yaml +2 -2
- package/charts/devzone-workspace/templates/role.yaml +6 -6
- package/charts/devzone-workspace/templates/statefulset.yaml +56 -48
- package/charts/devzone-workspace/values.yaml +34 -27
- package/manage/devzone +10 -7
- package/manage/scripts/migrer.sh +1 -1
- package/manage/scripts/services-workspace.sh +150 -0
- package/manage/workspace.sh +7 -2
- package/package.json +1 -1
package/.devcontainer/Dockerfile
CHANGED
|
@@ -19,6 +19,12 @@ ARG RUFF_VERSION=0.17.0
|
|
|
19
19
|
ARG VULTURE_VERSION=2.16
|
|
20
20
|
# pytest : même version que la CI de repowarden (ci/requirements/e2e-python.in)
|
|
21
21
|
ARG PYTEST_VERSION=9.1.1
|
|
22
|
+
# BuildKit client (buildctl) for the Kubernetes workspace pod (#514). Pinned to
|
|
23
|
+
# the buildkitd sidecar version; checksums from the moby/buildkit v0.34.2 release
|
|
24
|
+
# assets (https://github.com/moby/buildkit/releases/tag/v0.34.2).
|
|
25
|
+
ARG BUILDKIT_VERSION=0.34.2
|
|
26
|
+
ARG BUILDKIT_SHA256_AMD64=b9f18b8e37eb450e9e5df03117045237cdd12d3c4a0034ffeeaa857852a15e13
|
|
27
|
+
ARG BUILDKIT_SHA256_ARM64=a4ad483a33b2f1544c5ccce1c5956c559e1a6e84b8bf6cedd847d695885237a3
|
|
22
28
|
|
|
23
29
|
SHELL ["/bin/bash", "-o", "pipefail", "-c"]
|
|
24
30
|
|
|
@@ -83,6 +89,24 @@ RUN set -eu; \
|
|
|
83
89
|
installer kubectx "$kctx_sha"; \
|
|
84
90
|
installer kubens "$kns_sha"
|
|
85
91
|
|
|
92
|
+
# BuildKit client: the workspace pod talks to the buildkitd sidecar over
|
|
93
|
+
# BUILDKIT_HOST but has no client in the image (#514). Install only buildctl,
|
|
94
|
+
# same version as the sidecar, from the official moby/buildkit release archive
|
|
95
|
+
# with SHA-256 verification (https://github.com/moby/buildkit/releases/tag/v0.34.2).
|
|
96
|
+
RUN set -eu; \
|
|
97
|
+
arch="$(dpkg --print-architecture)"; \
|
|
98
|
+
case "$arch" in \
|
|
99
|
+
arm64) bk_sha="${BUILDKIT_SHA256_ARM64}" ;; \
|
|
100
|
+
amd64) bk_sha="${BUILDKIT_SHA256_AMD64}" ;; \
|
|
101
|
+
*) echo "Architecture non prise en charge : $arch" >&2; exit 1 ;; \
|
|
102
|
+
esac; \
|
|
103
|
+
tmp="$(mktemp -d)"; \
|
|
104
|
+
curl -fsSL "https://github.com/moby/buildkit/releases/download/v${BUILDKIT_VERSION}/buildkit-v${BUILDKIT_VERSION}.linux-${arch}.tar.gz" -o "$tmp/buildkit.tar.gz"; \
|
|
105
|
+
echo "$bk_sha $tmp/buildkit.tar.gz" | sha256sum -c --quiet; \
|
|
106
|
+
tar -xzf "$tmp/buildkit.tar.gz" -C "$tmp" bin/buildctl; \
|
|
107
|
+
install -m 0755 "$tmp/bin/buildctl" /usr/local/bin/buildctl; \
|
|
108
|
+
rm -rf "$tmp"
|
|
109
|
+
|
|
86
110
|
# kind passe par une enveloppe (#291) : avec le Docker de l'hôte, un cluster
|
|
87
111
|
# créé à la main doit être rendu joignable depuis le conteneur (kube-joignable.sh)
|
|
88
112
|
COPY kube-joignable.sh /usr/local/lib/devzone/kube-joignable.sh
|
package/.devcontainer/devzone
CHANGED
|
@@ -16,6 +16,7 @@
|
|
|
16
16
|
# devzone test-bash32 lance les tests bats sous bash 3.2 (conteneur Docker)
|
|
17
17
|
# devzone test-gitlab essai de bout en bout du module et de la plateforme GitLab
|
|
18
18
|
# devzone agent <dossier> <fichier-consigne> dirige opencode sur une consigne
|
|
19
|
+
# devzone build <dossier> [--tag <nom>] construit une image dans le workspace Kubernetes (BuildKit)
|
|
19
20
|
# devzone activer postgres [--contexte CTX] [--confirmer CTX] PostgreSQL partagé, cluster au choix
|
|
20
21
|
# devzone postgres creer <projet> base et utilisateur d'un projet (aussi : liste, psql, supprimer)
|
|
21
22
|
# devzone gitlab migrer [--oui] GitLab dans le cluster des services, puis ancien cluster kind supprimé
|
|
@@ -316,6 +317,60 @@ fichier_echec() {
|
|
|
316
317
|
echo "$ETAT-echec-$1"
|
|
317
318
|
}
|
|
318
319
|
|
|
320
|
+
# Services in the Kubernetes workspace pod (#528): gitlab, postgres and argocd
|
|
321
|
+
# live in the cluster and are installed from the workstation (devzone
|
|
322
|
+
# workspace services). The pod has no kubeconfig and its service account is
|
|
323
|
+
# limited (#430): their presence is the cluster DNS resolving the service,
|
|
324
|
+
# like the catalogue (#515), never the failure marker of an installer.
|
|
325
|
+
dans_pod() {
|
|
326
|
+
[ "${DEVZONE_WORKSPACE:-}" = kubernetes ]
|
|
327
|
+
}
|
|
328
|
+
|
|
329
|
+
service_module() {
|
|
330
|
+
case "$1" in
|
|
331
|
+
gitlab | postgres | argocd) return 0 ;;
|
|
332
|
+
esac
|
|
333
|
+
return 1
|
|
334
|
+
}
|
|
335
|
+
|
|
336
|
+
# DNS name of the service of a module: <service>.<namespace>.svc
|
|
337
|
+
service_dns() {
|
|
338
|
+
case "$1" in
|
|
339
|
+
gitlab) echo "gitlab-webservice-default.devzone-gitlab${INSTANCE_SUFFIX}.svc" ;;
|
|
340
|
+
postgres) echo "postgres.devzone-postgres.svc" ;;
|
|
341
|
+
argocd) echo "argocd-server.devzone-argocd.svc" ;;
|
|
342
|
+
esac
|
|
343
|
+
}
|
|
344
|
+
|
|
345
|
+
service_present() {
|
|
346
|
+
getent hosts "$(service_dns "$1")" >/dev/null 2>&1
|
|
347
|
+
}
|
|
348
|
+
|
|
349
|
+
# Status line of a service module in the pod: present → active; absent → the
|
|
350
|
+
# workstation command that installs it
|
|
351
|
+
service_ligne_pod() {
|
|
352
|
+
local m="$1"
|
|
353
|
+
if service_present "$m"; then
|
|
354
|
+
printf ' ✔ module %-10s active: %s (%s)\n' "$m" "$(description "$m")" "$(service_dns "$m")"
|
|
355
|
+
elif [ "$(valeur "$m")" = on ]; then
|
|
356
|
+
printf ' ⚠ module %-10s not in the cluster: on the workstation, devzone workspace services enable %s\n' "$m" "$m"
|
|
357
|
+
else
|
|
358
|
+
printf ' ○ module %-10s optional, %s: on the workstation, devzone workspace services enable %s\n' "$m" "$(description "$m")" "$m"
|
|
359
|
+
fi
|
|
360
|
+
}
|
|
361
|
+
|
|
362
|
+
# devzone apply of a service module: in the Kubernetes workspace pod nothing
|
|
363
|
+
# is installed (the workstation does it, #528) and the failure marker of an
|
|
364
|
+
# earlier start is cleared; elsewhere, the installer of the module
|
|
365
|
+
appliquer_service() {
|
|
366
|
+
if dans_pod; then
|
|
367
|
+
rm -f "$(fichier_echec "$1")"
|
|
368
|
+
echo "devzone: $1 is installed from the workstation (devzone workspace services enable $1): nothing to do in the pod"
|
|
369
|
+
return 0
|
|
370
|
+
fi
|
|
371
|
+
"appliquer_$1" on
|
|
372
|
+
}
|
|
373
|
+
|
|
319
374
|
# Journal du dernier npm (son chemin est à donner en cas d'échec), ou son
|
|
320
375
|
# dossier ; noms horodatés : le dernier dans l'ordre du glob est le plus récent
|
|
321
376
|
dernier_journal_npm() {
|
|
@@ -1182,7 +1237,10 @@ etat() {
|
|
|
1182
1237
|
echo " ⚠ worktree $chemin absent ici (créé hors du conteneur ?) : le gérer de ce côté-là, jamais git worktree prune ici (manage/docs/reference.md, Worktrees git)"
|
|
1183
1238
|
done < <(worktrees_absents)
|
|
1184
1239
|
for m in "${MODULES[@]}"; do
|
|
1185
|
-
if
|
|
1240
|
+
if dans_pod && service_module "$m"; then
|
|
1241
|
+
# Kubernetes workspace pod (#528): presence by the cluster DNS
|
|
1242
|
+
service_ligne_pod "$m"
|
|
1243
|
+
elif [ "$(valeur "$m")" = on ] && [ -f "$(fichier_echec "$m")" ]; then
|
|
1186
1244
|
printf ' ✖ module %-10s en échec : installation incomplète (%s) : devzone appliquer\n' "$m" "$(cat "$(fichier_echec "$m")")"
|
|
1187
1245
|
elif [ "$(valeur "$m")" = on ] && [ "$m" = gitlab ]; then
|
|
1188
1246
|
# GitLab actif : son état réel (prêt, runner, en échec)
|
|
@@ -1305,6 +1363,17 @@ changer() {
|
|
|
1305
1363
|
echo "devzone : module inconnu : $m ; modules : ${MODULES[*]}" >&2
|
|
1306
1364
|
exit 1
|
|
1307
1365
|
fi
|
|
1366
|
+
# In the Kubernetes workspace pod the services are installed from the
|
|
1367
|
+
# workstation (#528): the pod has no administrator access to the cluster.
|
|
1368
|
+
# DEVZONE_SERVICES_ADMIN=1: run by services-admin.sh with a temporary one.
|
|
1369
|
+
if dans_pod && service_module "$m" && [ -z "${DEVZONE_SERVICES_ADMIN:-}" ]; then
|
|
1370
|
+
if [ "$1" = on ]; then
|
|
1371
|
+
echo "devzone: in the workspace pod, $m is installed from the workstation: devzone workspace services enable $m" >&2
|
|
1372
|
+
else
|
|
1373
|
+
echo "devzone: in the workspace pod, $m is removed from the workstation: devzone workspace services disable $m" >&2
|
|
1374
|
+
fi
|
|
1375
|
+
return 2
|
|
1376
|
+
fi
|
|
1308
1377
|
if [ "$1" = off ] && { [ "$m" = postgres ] || [ "$m" = mysql ] || [ "$m" = gitlab ]; }; then
|
|
1309
1378
|
confirmer_suppression "$m" "${@:3}" || return 0
|
|
1310
1379
|
fi
|
|
@@ -1335,10 +1404,12 @@ case "${1:-}" in
|
|
|
1335
1404
|
etat_recouvrement_confirmer
|
|
1336
1405
|
appliquer_repowarden
|
|
1337
1406
|
[ "$(valeur ia)" = off ] || appliquer_ia on
|
|
1338
|
-
|
|
1339
|
-
|
|
1407
|
+
# gitlab, postgres, argocd: installed from the workstation in the
|
|
1408
|
+
# Kubernetes workspace pod (#528), by their installer elsewhere
|
|
1409
|
+
[ "$(valeur gitlab)" = off ] || appliquer_service gitlab
|
|
1410
|
+
[ "$(valeur postgres)" = off ] || appliquer_service postgres
|
|
1340
1411
|
[ "$(valeur mysql)" = off ] || appliquer_mysql on
|
|
1341
|
-
[ "$(valeur argocd)" = off ] ||
|
|
1412
|
+
[ "$(valeur argocd)" = off ] || appliquer_service argocd
|
|
1342
1413
|
;;
|
|
1343
1414
|
actif)
|
|
1344
1415
|
connu "${2:-}" || { echo "devzone : module inconnu : ${2:-(aucun)}" >&2; exit 2; }
|
|
@@ -1349,6 +1420,9 @@ case "${1:-}" in
|
|
|
1349
1420
|
agent)
|
|
1350
1421
|
bash "$ICI/agent.sh" "${@:2}"
|
|
1351
1422
|
;;
|
|
1423
|
+
build)
|
|
1424
|
+
bash "$ICI/workspace-build.sh" "${@:2}"
|
|
1425
|
+
;;
|
|
1352
1426
|
reparer) reparer ;;
|
|
1353
1427
|
demarrer) bash "$ICI/demarrage.sh" ;;
|
|
1354
1428
|
metrics) bash "$ICI/metrics-server.sh" "${@:2}" ;;
|
|
@@ -106,7 +106,19 @@ etat_json() {
|
|
|
106
106
|
echec_val=""
|
|
107
107
|
etat_val=""
|
|
108
108
|
commande_val=""
|
|
109
|
-
if
|
|
109
|
+
if dans_pod && service_module "$m"; then
|
|
110
|
+
# Kubernetes workspace pod (#528): presence by the cluster DNS,
|
|
111
|
+
# installation from the workstation; no failure marker read here
|
|
112
|
+
if service_present "$m"; then
|
|
113
|
+
etat_val="active: $(service_dns "$m")"
|
|
114
|
+
elif [ "$actif" = true ]; then
|
|
115
|
+
etat_val="not in the cluster"
|
|
116
|
+
commande_val="devzone workspace services enable $m"
|
|
117
|
+
else
|
|
118
|
+
etat_val="facultatif"
|
|
119
|
+
commande_val="devzone workspace services enable $m"
|
|
120
|
+
fi
|
|
121
|
+
elif [ "$actif" = true ]; then
|
|
110
122
|
ef="$(fichier_echec "$m")"
|
|
111
123
|
if [ -f "$ef" ]; then
|
|
112
124
|
content="$(cat "$ef" 2>/dev/null || true)"
|
|
@@ -0,0 +1,105 @@
|
|
|
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
|
+
# Run by the workstation (manage/scripts/services-workspace.sh) through
|
|
6
|
+
# kubectl exec -i: the token comes on stdin, is never printed and lives only
|
|
7
|
+
# in a temporary kubeconfig removed at the end.
|
|
8
|
+
# Why: the pod has no kubeconfig and its service account is limited (#430),
|
|
9
|
+
# while the installers need an administrator. The temporary kubeconfig holds
|
|
10
|
+
# two contexts on the cluster of the pod (API server kubernetes.default.svc,
|
|
11
|
+
# CA of the pod): devzone-admin, the administrator the installers use through
|
|
12
|
+
# the line cluster=devzone-admin of the state, and devzone, the context the
|
|
13
|
+
# module scripts use (compte_jeton may replace it by the limited account).
|
|
14
|
+
# The cluster line of the state is put back afterwards, and the relays
|
|
15
|
+
# started by the installer are stopped: in the pod the services are reached
|
|
16
|
+
# by the cluster DNS, and a relay would keep the token in use.
|
|
17
|
+
set -euo pipefail
|
|
18
|
+
|
|
19
|
+
HERE="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
|
20
|
+
RACINE="${DEVZONE_RACINE:-$(dirname "$HERE")}"
|
|
21
|
+
ETAT="${DEVZONE_ETAT:-$RACINE/.devzone.modules}"
|
|
22
|
+
SA_DIR="${DEVZONE_SA_DIR:-/var/run/secrets/kubernetes.io/serviceaccount}"
|
|
23
|
+
API_SERVER="${DEVZONE_API_SERVER:-https://kubernetes.default.svc}"
|
|
24
|
+
ADMIN_CONTEXT=devzone-admin
|
|
25
|
+
ADMIN_USER=devzone-services-admin
|
|
26
|
+
ADMIN_CLUSTER=devzone-pod
|
|
27
|
+
|
|
28
|
+
refuse() {
|
|
29
|
+
echo "devzone services: $*" >&2
|
|
30
|
+
exit 2
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
# shellcheck source=SCRIPTDIR/etat.sh
|
|
34
|
+
# shellcheck disable=SC1091
|
|
35
|
+
. "$HERE/etat.sh"
|
|
36
|
+
|
|
37
|
+
action="${1:-}"
|
|
38
|
+
service="${2:-}"
|
|
39
|
+
case "$action" in
|
|
40
|
+
enable | activer) action=enable ;;
|
|
41
|
+
disable | desactiver) action=disable ;;
|
|
42
|
+
*) refuse "usage: services-admin.sh enable|disable gitlab|postgres|argocd [options]" ;;
|
|
43
|
+
esac
|
|
44
|
+
case "$service" in
|
|
45
|
+
gitlab | postgres | argocd) ;;
|
|
46
|
+
*) refuse "unknown service: ${service:-(none)} (gitlab, postgres, argocd)" ;;
|
|
47
|
+
esac
|
|
48
|
+
[ "${DEVZONE_WORKSPACE:-}" = kubernetes ] || refuse "only in the Kubernetes workspace pod"
|
|
49
|
+
[ -f "$SA_DIR/ca.crt" ] || refuse "cluster CA not found: $SA_DIR/ca.crt"
|
|
50
|
+
if [ -t 0 ]; then
|
|
51
|
+
refuse "the token is read on stdin (run by devzone workspace services)"
|
|
52
|
+
fi
|
|
53
|
+
token="$(cat)"
|
|
54
|
+
token="${token//[$'\r\n']/}"
|
|
55
|
+
[ -n "$token" ] || refuse "empty token on stdin"
|
|
56
|
+
|
|
57
|
+
kubeconfig="$(mktemp "${TMPDIR:-/tmp}/devzone-services-admin.XXXXXX")"
|
|
58
|
+
chmod 600 "$kubeconfig"
|
|
59
|
+
cluster_before="$(grep -E '^cluster=' "$ETAT" 2>/dev/null | tail -1 | cut -d= -f2- || true)"
|
|
60
|
+
|
|
61
|
+
# Always at the end, even on failure: kubeconfig removed, relays stopped,
|
|
62
|
+
# cluster line of the state as before
|
|
63
|
+
cleanup() {
|
|
64
|
+
rm -f "$kubeconfig"
|
|
65
|
+
devzone "$service" relais-arreter >/dev/null 2>&1 || true
|
|
66
|
+
if [ -n "$cluster_before" ]; then
|
|
67
|
+
etat_ecrire cluster "$cluster_before" || true
|
|
68
|
+
else
|
|
69
|
+
etat_retirer cluster || true
|
|
70
|
+
fi
|
|
71
|
+
}
|
|
72
|
+
trap cleanup EXIT
|
|
73
|
+
|
|
74
|
+
ca_data="$(base64 <"$SA_DIR/ca.crt" | tr -d '\n')"
|
|
75
|
+
cat >"$kubeconfig" <<EOF
|
|
76
|
+
apiVersion: v1
|
|
77
|
+
kind: Config
|
|
78
|
+
clusters:
|
|
79
|
+
- name: $ADMIN_CLUSTER
|
|
80
|
+
cluster:
|
|
81
|
+
server: $API_SERVER
|
|
82
|
+
certificate-authority-data: $ca_data
|
|
83
|
+
users:
|
|
84
|
+
- name: $ADMIN_USER
|
|
85
|
+
user:
|
|
86
|
+
token: $token
|
|
87
|
+
contexts:
|
|
88
|
+
- name: $ADMIN_CONTEXT
|
|
89
|
+
context:
|
|
90
|
+
cluster: $ADMIN_CLUSTER
|
|
91
|
+
user: $ADMIN_USER
|
|
92
|
+
- name: devzone
|
|
93
|
+
context:
|
|
94
|
+
cluster: $ADMIN_CLUSTER
|
|
95
|
+
user: $ADMIN_USER
|
|
96
|
+
current-context: $ADMIN_CONTEXT
|
|
97
|
+
EOF
|
|
98
|
+
unset token ca_data
|
|
99
|
+
|
|
100
|
+
export KUBECONFIG="$kubeconfig"
|
|
101
|
+
export DEVZONE_KUBE_CONFIG="$kubeconfig"
|
|
102
|
+
export DEVZONE_SERVICES_ADMIN=1
|
|
103
|
+
etat_ecrire cluster "$ADMIN_CONTEXT" || refuse "cannot write the state: $ETAT"
|
|
104
|
+
echo "devzone services: $action $service in the cluster of the pod (temporary administrator)"
|
|
105
|
+
devzone "$action" "$service" "${@:3}"
|
|
@@ -1,2 +1,6 @@
|
|
|
1
1
|
# Single source for the repowarden version used by post-create.sh and workspace-init.sh.
|
|
2
2
|
REPOWARDEN_VERSION=4.17.1
|
|
3
|
+
|
|
4
|
+
# BuildKit client version installed in the workspace image (#514). Must match
|
|
5
|
+
# buildkit.image in charts/devzone-workspace/values.yaml.
|
|
6
|
+
BUILDKIT_VERSION=0.34.2
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
#!/usr/bin/env bash
|
|
2
|
+
# Build a container image in the Kubernetes workspace pod with the BuildKit
|
|
3
|
+
# sidecar (#514). Uses buildctl against $BUILDKIT_HOST (tcp://127.0.0.1:1234).
|
|
4
|
+
# On the Docker workstation, use docker build instead.
|
|
5
|
+
set -euo pipefail
|
|
6
|
+
|
|
7
|
+
refuse() {
|
|
8
|
+
echo "devzone build: $*" >&2
|
|
9
|
+
exit 1
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
if [ "${DEVZONE_WORKSPACE:-}" != "kubernetes" ]; then
|
|
13
|
+
refuse "use docker build on the Docker workstation"
|
|
14
|
+
fi
|
|
15
|
+
|
|
16
|
+
if [ "$#" -lt 1 ]; then
|
|
17
|
+
refuse "usage: devzone build <directory> [--tag <name>]"
|
|
18
|
+
fi
|
|
19
|
+
|
|
20
|
+
dir="$1"
|
|
21
|
+
shift
|
|
22
|
+
tag=""
|
|
23
|
+
|
|
24
|
+
while [ "$#" -gt 0 ]; do
|
|
25
|
+
case "$1" in
|
|
26
|
+
--tag)
|
|
27
|
+
[ "$#" -ge 2 ] || refuse "--tag requires a name"
|
|
28
|
+
tag="$2"
|
|
29
|
+
shift 2
|
|
30
|
+
;;
|
|
31
|
+
*)
|
|
32
|
+
refuse "unknown argument: $1"
|
|
33
|
+
;;
|
|
34
|
+
esac
|
|
35
|
+
done
|
|
36
|
+
|
|
37
|
+
[ -d "$dir" ] || refuse "directory not found: $dir"
|
|
38
|
+
[ -f "$dir/Dockerfile" ] || refuse "Dockerfile not found in: $dir"
|
|
39
|
+
|
|
40
|
+
if [ -n "$tag" ]; then
|
|
41
|
+
output="type=image,name=${tag},push=false"
|
|
42
|
+
else
|
|
43
|
+
output="type=cacheonly"
|
|
44
|
+
fi
|
|
45
|
+
|
|
46
|
+
addr="${BUILDKIT_HOST:-tcp://127.0.0.1:1234}"
|
|
47
|
+
exec buildctl --addr "$addr" build \
|
|
48
|
+
--frontend dockerfile.v0 \
|
|
49
|
+
--local "context=$dir" \
|
|
50
|
+
--local "dockerfile=$dir" \
|
|
51
|
+
--output "$output"
|
package/README.md
CHANGED
|
@@ -8,7 +8,7 @@ Ton poste de développement Linux, prêt en une commande, identique sur Mac, Win
|
|
|
8
8
|
- Les outils et services prêts : Java, Node, Python, Docker, Kubernetes, PostgreSQL, GitLab au besoin.
|
|
9
9
|
- Les agents IA encadrés par repowarden.
|
|
10
10
|
- Local et gratuit : rien n'est hébergé.
|
|
11
|
-
- Une mise à jour avec `devzone
|
|
11
|
+
- Une mise à jour avec `devzone update`, et des outils ajoutés qui survivent au rebuild (devzone packages).
|
|
12
12
|
|
|
13
13
|
## Pourquoi devzone ?
|
|
14
14
|
|
|
@@ -24,7 +24,7 @@ devzone les évite : le même environnement sur chaque poste, sur ta machine.
|
|
|
24
24
|
|
|
25
25
|
- Pas de systemd : les services fournis par devzone démarrent avec devzone, pas avec `systemctl`.
|
|
26
26
|
- Pas de bureau graphique : tout se passe en terminal ou dans VS Code.
|
|
27
|
-
- Le socket Docker de l'hôte est partagé par défaut : c'est un compromis de sécurité assumé, qui donne un accès administrateur au Docker de l'hôte, y compris aux agents IA ([#291](https://github.com/SimBienvenueHoulBoumi/devzone/issues/291)). Pour le retirer : `devzone
|
|
27
|
+
- Le socket Docker de l'hôte est partagé par défaut : c'est un compromis de sécurité assumé, qui donne un accès administrateur au Docker de l'hôte, y compris aux agents IA ([#291](https://github.com/SimBienvenueHoulBoumi/devzone/issues/291)). Pour le retirer : `devzone disable docker-hote`, puis `make rebuild` sur le poste. Sans ce socket, `docker` renvoie vers le workspace Kubernetes (`devzone workspace`, kubedock et BuildKit) ; les conteneurs et kind lancés sur le Docker du poste ne fonctionnent plus dans le conteneur, alors que la connexion au cluster Kubernetes de l'hôte et les modules restent utilisables. Pour le remettre : `devzone enable docker-hote`, puis `make rebuild`.
|
|
28
28
|
- Le terminal garde l'administrateur du cluster ; les agents n'ont que le compte limité aux namespaces `devzone-*` (rôle `edit`, jeton renouvelé toutes les 24 h). Les installeurs seuls agissent en administrateur ([#430](https://github.com/SimBienvenueHoulBoumi/devzone/issues/430)).
|
|
29
29
|
|
|
30
30
|
## Comment ça marche
|
|
@@ -36,7 +36,7 @@ devzone prépare un devcontainer Ubuntu lancé par Docker, avec des versions d'o
|
|
|
36
36
|
### Prérequis
|
|
37
37
|
|
|
38
38
|
- Docker Desktop (ou Docker Engine sous Linux). Pour Kubernetes (facultatif) : activer le cluster de Docker Desktop (*Settings → Kubernetes → Enable Kubernetes*).
|
|
39
|
-
- Pour le [workspace Kubernetes](manage/docs/reference.md#workspace-kubernetes) (facultatif, `devzone workspace
|
|
39
|
+
- Pour le [workspace Kubernetes](manage/docs/reference.md#workspace-kubernetes) (facultatif, `devzone workspace migrate` pour quitter le poste Docker, `revenir` pour y retourner) : un cluster Kubernetes 1.30 ou plus, `kubectl` et `helm` sur la machine, et Docker pour lire les volumes à migrer.
|
|
40
40
|
- Node et npm (pour `npx` ou l'installation globale).
|
|
41
41
|
- `make` (nécessaire pour `make shell` ; sous Windows sans `make`, voir le tableau « Au quotidien »).
|
|
42
42
|
|
|
@@ -80,8 +80,8 @@ devzone : état (devzone pour le réafficher)
|
|
|
80
80
|
✖ identité git nécessaire pour commiter : gh auth login -s workflow (automatique),
|
|
81
81
|
ou git config --file ~/.config/git/config user.name "<nom>" et user.email "<email>"
|
|
82
82
|
○ GitHub facultatif (push et PR, tickets repowarden) : gh auth login -s workflow
|
|
83
|
-
○ module ia facultatif, assistants IA : Claude Code, opencode : devzone
|
|
84
|
-
○ module kubernetes facultatif, connexion au cluster de l'hôte et metrics-server au démarrage : devzone
|
|
83
|
+
○ module ia facultatif, assistants IA : Claude Code, opencode : devzone enable ia
|
|
84
|
+
○ module kubernetes facultatif, connexion au cluster de l'hôte et metrics-server au démarrage : devzone enable kubernetes
|
|
85
85
|
```
|
|
86
86
|
|
|
87
87
|
Le premier lancement prend 4 à 5 min mesurées, plus le téléchargement des images de base sur une machine neuve.
|
|
@@ -119,26 +119,26 @@ Pour en savoir plus : [Mettre en route un projet](https://github.com/SimBienvenu
|
|
|
119
119
|
|---|---|
|
|
120
120
|
| Langages | Java 21 + Maven + Gradle, Node LTS + pnpm, Python 3.12 (apt) + uv |
|
|
121
121
|
| Conteneurs, Kubernetes | Docker de l'hôte (socket partagé), kubectl, helm, k9s, kind ; connexion au cluster de l'hôte (module `kubernetes`) ; Testcontainers (`TESTCONTAINERS_HOST_OVERRIDE`) ; montages (`$LOCAL_WORKSPACE_FOLDER`) |
|
|
122
|
-
| GitHub (ou GitLab), qualité | gh, ou glab connecté à une instance GitLab (`devzone
|
|
122
|
+
| GitHub (ou GitLab), qualité | gh, ou glab connecté à une instance GitLab (`devzone platform gitlab` dans le conteneur, [manage/docs/reference.md](manage/docs/reference.md#plateforme-github-ou-gitlab)) ; repowarden (hooks git globaux), shellcheck, bats, actionlint, gitleaks, ruff, vulture, pytest |
|
|
123
123
|
| Assistants IA | Claude Code, opencode (module `ia`, désactivé par défaut) |
|
|
124
124
|
|
|
125
125
|
## Installer un outil qui reste
|
|
126
126
|
|
|
127
|
-
Un outil mis a la main (sudo apt install tree) ne survit pas a un make rebuild : l'image est reconstruite de zero. Pour un outil qui doit rester, devzone
|
|
127
|
+
Un outil mis a la main (sudo apt install tree) ne survit pas a un make rebuild : l'image est reconstruite de zero. Pour un outil qui doit rester, devzone packages garde la liste des paquets a reinstaller :
|
|
128
128
|
|
|
129
129
|
```sh
|
|
130
|
-
devzone
|
|
131
|
-
devzone
|
|
132
|
-
devzone
|
|
133
|
-
devzone
|
|
130
|
+
devzone packages
|
|
131
|
+
devzone packages ajouter tree
|
|
132
|
+
devzone packages retirer tree
|
|
133
|
+
devzone packages appliquer
|
|
134
134
|
```
|
|
135
135
|
|
|
136
|
-
- devzone
|
|
137
|
-
- devzone
|
|
138
|
-
- devzone
|
|
139
|
-
- devzone
|
|
136
|
+
- devzone packages affiche la liste : ✔ paquets installes, ○ paquets a installer ;
|
|
137
|
+
- devzone packages ajouter <nom>… valide chaque paquet (apt-cache), installe puis l'ajoute a la liste ;
|
|
138
|
+
- devzone packages retirer <nom> retire la liste et desinstalle ;
|
|
139
|
+
- devzone packages appliquer installe les paquets manquants apres un rebuild.
|
|
140
140
|
|
|
141
|
-
La liste vit dans .devzone.paquets a la racine du dossier devzone, hors du depot. Un paquet en echec est signale dans le recap (⚠ paquets : …) ; devzone
|
|
141
|
+
La liste vit dans .devzone.paquets a la racine du dossier devzone, hors du depot. Un paquet en echec est signale dans le recap (⚠ paquets : …) ; devzone packages appliquer peut alors etre relance.
|
|
142
142
|
|
|
143
143
|
## Au quotidien
|
|
144
144
|
|
|
@@ -150,9 +150,9 @@ La liste vit dans .devzone.paquets a la racine du dossier devzone, hors du depot
|
|
|
150
150
|
| Supprimer le conteneur | — | `make down` | — |
|
|
151
151
|
| Reconstruire (après une modification de `.devcontainer/`) | *Dev Containers: Rebuild Container* | `make rebuild` | `npx @devcontainers/cli up --workspace-folder . --remove-existing-container` |
|
|
152
152
|
| État | — | `make status` | — |
|
|
153
|
-
| **Désinstaller** (tout ce que devzone a créé, après confirmation) | — | `make desinstaller` | `npx devzone
|
|
153
|
+
| **Désinstaller** (tout ce que devzone a créé, après confirmation) | — | `make desinstaller` | `npx devzone uninstall` |
|
|
154
154
|
|
|
155
|
-
Après `devzone workspace
|
|
155
|
+
Après `devzone workspace migrate`, `make up`, `make shell` et `make stop` pilotent le workspace Kubernetes ; `devzone workspace revert` rend le poste Docker. Les services GitLab, PostgreSQL et Argo CD s'y installent depuis le poste : `devzone workspace services enable postgres` (voir [la référence](manage/docs/reference.md#services-de-devzone-dans-le-workspace-kubernetes)).
|
|
156
156
|
|
|
157
157
|
### Mettre à jour devzone
|
|
158
158
|
|
|
@@ -160,7 +160,7 @@ Après `devzone workspace migrer`, `make up`, `make shell` et `make stop` pilote
|
|
|
160
160
|
|
|
161
161
|
```bash
|
|
162
162
|
cd mon-devzone
|
|
163
|
-
devzone
|
|
163
|
+
devzone update
|
|
164
164
|
```
|
|
165
165
|
|
|
166
166
|
Pour la dernière version publiée, sans installation globale :
|
|
@@ -174,21 +174,21 @@ La commande affiche la version du dossier et celle du paquet, et ne fait rien si
|
|
|
174
174
|
|
|
175
175
|
`workspace/`, `.devzone.modules`, `.devzone.paquets`, `.password`, `.app`, `.devzone.log` et les volumes Docker ne sont jamais touchés.
|
|
176
176
|
|
|
177
|
-
La mise à jour ne change jamais le mode du poste ; sur un poste Docker avec Kubernetes joignable, elle propose `devzone workspace
|
|
177
|
+
La mise à jour ne change jamais le mode du poste ; sur un poste Docker avec Kubernetes joignable, elle propose `devzone workspace migrate`.
|
|
178
178
|
|
|
179
179
|
Dans le conteneur, le récapitulatif `devzone` signale une version publiée plus récente (vérification npm au plus une fois par jour, sans bloquer hors ligne) : `○ devzone X.Y.Z disponible : sur le poste, devzone mettre-a-jour`.
|
|
180
180
|
|
|
181
181
|
## Options
|
|
182
182
|
|
|
183
|
-
**Module `ia`** : active Claude Code et opencode (versions figées), avec le garde-fou repowarden qui les arrête avant de modifier `main` ou `develop` ou de commiter sans `repowarden cc` (voir [manage/docs/reference.md](manage/docs/reference.md#garde-fou-des-assistants-ia)). Pour l'activer : `devzone
|
|
183
|
+
**Module `ia`** : active Claude Code et opencode (versions figées), avec le garde-fou repowarden qui les arrête avant de modifier `main` ou `develop` ou de commiter sans `repowarden cc` (voir [manage/docs/reference.md](manage/docs/reference.md#garde-fou-des-assistants-ia)). Pour l'activer : `devzone enable ia`. Ils sont désinstallés quand le module est désactivé, mais tes connexions restent dans leurs volumes.
|
|
184
184
|
|
|
185
|
-
**Module `kubernetes`** : active à chaque démarrage la connexion au cluster de l'hôte et l'installation de metrics-server sur les clusters locaux (pour voir le CPU et la RAM dans k9s). Pour l'activer : `devzone
|
|
185
|
+
**Module `kubernetes`** : active à chaque démarrage la connexion au cluster de l'hôte et l'installation de metrics-server sur les clusters locaux (pour voir le CPU et la RAM dans k9s). Pour l'activer : `devzone enable kubernetes`. Sans ce module, kubectl, helm, k9s et kind restent installés.
|
|
186
186
|
|
|
187
|
-
**Plateforme GitHub ou GitLab** : GitHub par défaut (nouvelle architecture). Pour servir une équipe sur GitLab : `devzone
|
|
187
|
+
**Plateforme GitHub ou GitLab** : GitHub par défaut (nouvelle architecture). Pour servir une équipe sur GitLab : `devzone platform gitlab --url URL` (ou sans `--url` quand le module `gitlab` est activé, pour l'instance de test) : glab est installé (version figée, somme vérifiée) et connecté à l'instance, et `devzone` l'affiche à la place des contrôles `gh`. `devzone platform github` revient en arrière (glab retiré). GitLab est accessible directement depuis le poste sans relais temporaire. Détails dans [manage/docs/reference.md](manage/docs/reference.md#plateforme-github-ou-gitlab).
|
|
188
188
|
|
|
189
|
-
**Module `postgres`** : un PostgreSQL partagé, une base par projet (voir [Accéder à PostgreSQL](#accéder-à-postgresql)). Pour l'activer : `devzone
|
|
189
|
+
**Module `postgres`** : un PostgreSQL partagé, une base par projet (voir [Accéder à PostgreSQL](#accéder-à-postgresql)). Pour l'activer : `devzone enable postgres`.
|
|
190
190
|
|
|
191
|
-
**Module `argocd`** : Argo CD sur le cluster de devzone, interface sur https://127.0.0.1:8443 dans le conteneur (voir [Argo CD](manage/docs/reference.md#argo-cd)). Pour l'activer : `devzone
|
|
191
|
+
**Module `argocd`** : Argo CD sur le cluster de devzone, interface sur https://127.0.0.1:8443 dans le conteneur (voir [Argo CD](manage/docs/reference.md#argo-cd)). Pour l'activer : `devzone enable argocd`.
|
|
192
192
|
|
|
193
193
|
Ces modules sont désactivés par défaut, activables à la demande depuis le conteneur (sans rebuild), et leur choix est conservé d'un démarrage à l'autre.
|
|
194
194
|
|
|
@@ -207,7 +207,7 @@ argocd https://127.0.0.1:8443 admin …
|
|
|
207
207
|
Le fichier est lisible par toi seul (600) et ignoré par git : ne le copie ni ne le commit jamais. Il est régénéré à chaque création, suppression ou changement de compte (modules `gitlab`, `postgres` et `argocd`, seed GitLab, démarrage) :
|
|
208
208
|
|
|
209
209
|
```sh
|
|
210
|
-
devzone
|
|
210
|
+
devzone passwords # régénère le fichier et affiche seulement son chemin
|
|
211
211
|
devzone postgres creer <projet> # création, ou nouveau mot de passe avec --nouveau-mdp
|
|
212
212
|
devzone postgres supprimer <projet> # suppression du compte et de sa ligne
|
|
213
213
|
devzone gitlab nouveau-mdp [root|dev] # mot de passe aléatoire (root ou dev) régénéré
|
|
@@ -222,7 +222,7 @@ Le secret Rails de GitLab est conservé dans `workspace/.gitlab/rails-secret.yam
|
|
|
222
222
|
Le module `postgres` installe un PostgreSQL 16 partagé sur le cluster de devzone : une base et un utilisateur par projet. Toutes les commandes se lancent dans le conteneur (`make shell`).
|
|
223
223
|
|
|
224
224
|
```sh
|
|
225
|
-
devzone
|
|
225
|
+
devzone enable postgres # la première fois : choix du cluster (kind dédié ou cluster de l'hôte)
|
|
226
226
|
devzone postgres creer monprojet # base et utilisateur « monprojet »
|
|
227
227
|
```
|
|
228
228
|
|
|
@@ -330,7 +330,7 @@ Cette commande supprime le conteneur, l'image `vsc-devzone-…`, les volumes `de
|
|
|
330
330
|
Avec la commande installée globalement (`npm install -g devzone`), tu peux aussi lancer, dans le dossier du devzone :
|
|
331
331
|
|
|
332
332
|
```bash
|
|
333
|
-
devzone
|
|
333
|
+
devzone uninstall
|
|
334
334
|
```
|
|
335
335
|
|
|
336
336
|
Même effet que `make desinstaller`. Ensuite seulement, pour retirer la commande de ta machine :
|
|
@@ -344,8 +344,8 @@ Même effet que `make desinstaller`.
|
|
|
344
344
|
|
|
345
345
|
```sh
|
|
346
346
|
devzone clusters # vue : contextes, type, etat, namespace
|
|
347
|
-
devzone
|
|
348
|
-
devzone
|
|
347
|
+
devzone use CTX [-n NS] # bascule le cluster de travail de kubectl
|
|
348
|
+
devzone use -n NS # change seulement le namespace du cluster courant
|
|
349
349
|
```
|
|
350
350
|
|
|
351
351
|
L invite du shell affiche `⎈ ctx/ns` (cyan si local, rouge gras avec distant sinon). Un rebuild repart sur le cluster de l hote : le choix de kubectl ecrit dans `~/.kube/config`, qui n est pas dans un volume.
|
|
@@ -8,13 +8,13 @@ spec:
|
|
|
8
8
|
podSelector: {}
|
|
9
9
|
policyTypes:
|
|
10
10
|
- Ingress
|
|
11
|
-
{{- if .Values.networkPolicy.
|
|
11
|
+
{{- if .Values.networkPolicy.restrictEgress }}
|
|
12
12
|
- Egress
|
|
13
13
|
{{- end }}
|
|
14
14
|
ingress:
|
|
15
15
|
- from:
|
|
16
16
|
- podSelector: {}
|
|
17
|
-
{{- if .Values.networkPolicy.
|
|
17
|
+
{{- if .Values.networkPolicy.restrictEgress }}
|
|
18
18
|
egress:
|
|
19
19
|
- to:
|
|
20
20
|
- podSelector: {}
|
|
@@ -3,12 +3,12 @@ kind: Role
|
|
|
3
3
|
metadata:
|
|
4
4
|
name: devzone-workspace
|
|
5
5
|
namespace: {{ .Release.Namespace }}
|
|
6
|
-
#
|
|
7
|
-
# pods (
|
|
8
|
-
# pods/log, pods/exec
|
|
9
|
-
# configmaps (
|
|
10
|
-
#
|
|
11
|
-
#
|
|
6
|
+
# Rights of kubedock (0.23.0, read in its sources), limited to the namespace:
|
|
7
|
+
# pods (create and delete the test containers, list and follow them),
|
|
8
|
+
# pods/log, pods/exec and pods/portforward (logs, commands, ports), services and
|
|
9
|
+
# configmaps (created and deleted with the pods). No right on secrets or
|
|
10
|
+
# deployments: kubedock 0.23.0 does not use them. The pod runs project code:
|
|
11
|
+
# no right on other namespaces, nor on the cluster.
|
|
12
12
|
rules:
|
|
13
13
|
- apiGroups: [""]
|
|
14
14
|
resources: ["pods"]
|
|
@@ -6,7 +6,7 @@ metadata:
|
|
|
6
6
|
spec:
|
|
7
7
|
serviceName: {{ include "devzone-workspace.fullname" . }}
|
|
8
8
|
replicas: {{ .Values.replicaCount }}
|
|
9
|
-
#
|
|
9
|
+
# The PVCs (projects, logins) are never deleted with the StatefulSet.
|
|
10
10
|
persistentVolumeClaimRetentionPolicy:
|
|
11
11
|
whenDeleted: Retain
|
|
12
12
|
whenScaled: Retain
|
|
@@ -19,28 +19,29 @@ spec:
|
|
|
19
19
|
app.kubernetes.io/name: {{ include "devzone-workspace.name" . }}
|
|
20
20
|
spec:
|
|
21
21
|
serviceAccountName: {{ include "devzone-workspace.serviceAccountName" . }}
|
|
22
|
-
# Pod
|
|
23
|
-
# /home/vscode,
|
|
24
|
-
#
|
|
22
|
+
# Pod as user vscode (UID 1000), never root: the HOME of the workspace is
|
|
23
|
+
# /home/vscode, where the logins are mounted. fsGroup 1000 makes the state
|
|
24
|
+
# volume writable by vscode. Settings in values.yaml (securityContext).
|
|
25
25
|
securityContext:
|
|
26
26
|
{{- toYaml .Values.securityContext | nindent 8 }}
|
|
27
|
-
#
|
|
28
|
-
#
|
|
29
|
-
#
|
|
30
|
-
#
|
|
27
|
+
# Native sidecars (restartPolicy: Always, Kubernetes 1.29+): they start
|
|
28
|
+
# before the workspace container, and their startupProbe holds that start
|
|
29
|
+
# until they answer. None gets extra rights and none declares a port: they only
|
|
30
|
+
# listen on 127.0.0.1 of the pod.
|
|
31
31
|
initContainers:
|
|
32
|
-
# etat-init
|
|
33
|
-
# caches).
|
|
34
|
-
#
|
|
35
|
-
#
|
|
32
|
+
# etat-init: creates the directories of the state volume (identities,
|
|
33
|
+
# logins, caches). It runs as vscode (UID 1000), with no extra rights. A
|
|
34
|
+
# symbolic link written here would not survive: the workspace container
|
|
35
|
+
# has its own file system. So the workspace mounts each directory
|
|
36
|
+
# (subPath) at its place. The names "etat" stay: existing volumes (#507).
|
|
36
37
|
- name: etat-init
|
|
37
38
|
image: "{{ .Values.image.repository }}:{{ .Values.image.tag | default .Chart.AppVersion }}"
|
|
38
39
|
{{- /*
|
|
39
|
-
|
|
40
|
-
|
|
40
|
+
Helm comment: not in the rendering. The $dirs list comes from
|
|
41
|
+
persistence.state.paths, like the mounts of the workspace.
|
|
41
42
|
*/}}
|
|
42
43
|
{{- $dirs := list }}
|
|
43
|
-
{{- range .Values.persistence.
|
|
44
|
+
{{- range .Values.persistence.state.paths }}
|
|
44
45
|
{{- $dirs = append $dirs (printf "/home/vscode/.devzone-etat/%s" .) }}
|
|
45
46
|
{{- end }}
|
|
46
47
|
command: ["sh", "-c", "mkdir -p {{ join " " $dirs }}"]
|
|
@@ -60,22 +61,29 @@ spec:
|
|
|
60
61
|
limits:
|
|
61
62
|
cpu: "100m"
|
|
62
63
|
memory: "64Mi"
|
|
63
|
-
# kubedock
|
|
64
|
-
# namespace,
|
|
64
|
+
# kubedock: Docker API of the pod. Test containers become pods of the
|
|
65
|
+
# namespace, created with the Role of the chart (limited to the namespace).
|
|
65
66
|
- name: kubedock
|
|
66
67
|
image: {{ .Values.kubedock.image }}
|
|
67
68
|
restartPolicy: Always
|
|
68
69
|
{{- /*
|
|
69
|
-
|
|
70
|
-
NAMESPACE
|
|
71
|
-
|
|
70
|
+
Settings from the lead's trial (#410): server --port-forward --reverse-proxy.
|
|
71
|
+
NAMESPACE comes from the pod, so that kubedock creates the pods in its
|
|
72
|
+
namespace. --reapmax/--prune-start clean up kubedock test resources (#514,
|
|
73
|
+
https://github.com/joyrex2001/kubedock/blob/master/config.md). Helm
|
|
74
|
+
comment: not in the rendering.
|
|
72
75
|
*/}}
|
|
73
76
|
args:
|
|
74
77
|
- server
|
|
75
78
|
- --port-forward
|
|
76
79
|
- --reverse-proxy
|
|
77
80
|
- --timeout
|
|
78
|
-
- {{ .Values.kubedock.
|
|
81
|
+
- {{ .Values.kubedock.timeout | quote }}
|
|
82
|
+
- --reapmax
|
|
83
|
+
- {{ .Values.kubedock.reapmax | quote }}
|
|
84
|
+
{{- if .Values.kubedock.pruneStart }}
|
|
85
|
+
- --prune-start
|
|
86
|
+
{{- end }}
|
|
79
87
|
env:
|
|
80
88
|
- name: NAMESPACE
|
|
81
89
|
valueFrom:
|
|
@@ -93,15 +101,15 @@ spec:
|
|
|
93
101
|
failureThreshold: 60
|
|
94
102
|
resources:
|
|
95
103
|
{{- toYaml .Values.kubedock.resources | nindent 12 }}
|
|
96
|
-
# BuildKit
|
|
97
|
-
#
|
|
104
|
+
# Rootless BuildKit: builds the images, with no extra rights or node socket.
|
|
105
|
+
# Rootless settings of the BuildKit docs for Kubernetes (examples/kubernetes).
|
|
98
106
|
- name: buildkitd
|
|
99
107
|
image: {{ .Values.buildkit.image }}
|
|
100
108
|
restartPolicy: Always
|
|
101
109
|
{{- /*
|
|
102
|
-
--oci-worker-no-process-sandbox
|
|
103
|
-
|
|
104
|
-
|
|
110
|
+
--oci-worker-no-process-sandbox: rootless has no process sandbox on
|
|
111
|
+
Kubernetes (BuildKit docs). UID 1000 is the one of the rootless image.
|
|
112
|
+
Helm comment: not in the rendering.
|
|
105
113
|
*/}}
|
|
106
114
|
args:
|
|
107
115
|
- --oci-worker-no-process-sandbox
|
|
@@ -127,37 +135,37 @@ spec:
|
|
|
127
135
|
- name: workspace
|
|
128
136
|
image: "{{ .Values.image.repository }}:{{ .Values.image.tag | default .Chart.AppVersion }}"
|
|
129
137
|
imagePullPolicy: {{ .Values.image.pullPolicy }}
|
|
130
|
-
#
|
|
138
|
+
# The projects live on the workspace PVC: the container starts there.
|
|
131
139
|
workingDir: /workspaces/projets
|
|
132
140
|
{{- /*
|
|
133
|
-
|
|
134
|
-
devcontainer),
|
|
135
|
-
|
|
136
|
-
devcontainer
|
|
137
|
-
|
|
141
|
+
Without command, the container runs the entrypoint of the image (bash
|
|
142
|
+
for a devcontainer), which ends at once without a terminal: the pod
|
|
143
|
+
loops on restarts. sleep infinity keeps it alive, like VS Code for a
|
|
144
|
+
devcontainer; the workstation then enters through kubectl exec. Helm
|
|
145
|
+
comment: not in the rendering.
|
|
138
146
|
*/}}
|
|
139
147
|
{{- with .Values.workspace.command }}
|
|
140
148
|
command: {{ toJson . }}
|
|
141
149
|
{{- end }}
|
|
142
150
|
env:
|
|
143
|
-
# HOME
|
|
144
|
-
#
|
|
151
|
+
# HOME of vscode: gh, claude, opencode... write their logins in the
|
|
152
|
+
# paths mounted from the state volume (not in the home of root).
|
|
145
153
|
- name: HOME
|
|
146
154
|
value: /home/vscode
|
|
147
|
-
#
|
|
155
|
+
# Marker of the Kubernetes workspace: devzone agent runs opencode here (#431)
|
|
148
156
|
- name: DEVZONE_WORKSPACE
|
|
149
157
|
value: kubernetes
|
|
150
158
|
# Root of the devzone projects in the Kubernetes workspace (#503)
|
|
151
159
|
- name: DEVZONE_RACINE
|
|
152
160
|
value: /workspaces/projets
|
|
153
|
-
# Global npm prefix, stored on the mounted
|
|
161
|
+
# Global npm prefix, stored on the mounted state volume (#503)
|
|
154
162
|
- name: NPM_CONFIG_PREFIX
|
|
155
163
|
value: /home/vscode/.local/npm
|
|
156
164
|
# Image PATH plus the npm global bin, installed at startup (#503)
|
|
157
165
|
- name: PATH
|
|
158
166
|
value: /home/vscode/.local/npm/bin:/usr/local/share/nvm/current/bin:/usr/local/sdkman/bin:/usr/local/sdkman/candidates/java/current/bin:/usr/local/sdkman/candidates/gradle/current/bin:/usr/local/sdkman/candidates/maven/current/bin:/usr/local/sdkman/candidates/ant/current/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
|
|
159
|
-
# Testcontainers
|
|
160
|
-
# Ryuk
|
|
167
|
+
# Testcontainers and docker talk to kubedock, and buildctl to BuildKit.
|
|
168
|
+
# Ryuk is off: kubedock cleans the test containers up itself.
|
|
161
169
|
- name: DOCKER_HOST
|
|
162
170
|
value: tcp://127.0.0.1:2475
|
|
163
171
|
- name: TESTCONTAINERS_RYUK_DISABLED
|
|
@@ -173,9 +181,9 @@ spec:
|
|
|
173
181
|
mountPath: /workspaces/projets
|
|
174
182
|
- name: etat
|
|
175
183
|
mountPath: /home/vscode/.devzone-etat
|
|
176
|
-
#
|
|
177
|
-
#
|
|
178
|
-
{{- range .Values.persistence.
|
|
184
|
+
# Identities and caches: each path of the state volume is mounted at
|
|
185
|
+
# its usual place (gh, git, Claude Code, opencode, devzone agent, caches).
|
|
186
|
+
{{- range .Values.persistence.state.paths }}
|
|
179
187
|
- name: etat
|
|
180
188
|
subPath: {{ . | quote }}
|
|
181
189
|
mountPath: {{ printf "/home/vscode/%s" . | quote }}
|
|
@@ -184,7 +192,7 @@ spec:
|
|
|
184
192
|
- metadata:
|
|
185
193
|
name: workspace
|
|
186
194
|
annotations:
|
|
187
|
-
#
|
|
195
|
+
# The projects are never deleted by helm uninstall (#399).
|
|
188
196
|
helm.sh/resource-policy: keep
|
|
189
197
|
spec:
|
|
190
198
|
accessModes: ["ReadWriteOnce"]
|
|
@@ -193,18 +201,18 @@ spec:
|
|
|
193
201
|
{{- end }}
|
|
194
202
|
resources:
|
|
195
203
|
requests:
|
|
196
|
-
storage: {{ .Values.workspace.
|
|
204
|
+
storage: {{ .Values.workspace.size }}
|
|
197
205
|
- metadata:
|
|
198
206
|
name: etat
|
|
199
207
|
annotations:
|
|
200
|
-
#
|
|
201
|
-
#
|
|
208
|
+
# The PVC survives the uninstall of the chart (logins kept). The real
|
|
209
|
+
# protection is persistentVolumeClaimRetentionPolicy above.
|
|
202
210
|
helm.sh/resource-policy: keep
|
|
203
211
|
spec:
|
|
204
212
|
accessModes: ["ReadWriteOnce"]
|
|
205
|
-
{{- if .Values.persistence.
|
|
206
|
-
storageClassName: {{ .Values.persistence.
|
|
213
|
+
{{- if .Values.persistence.state.storageClass }}
|
|
214
|
+
storageClassName: {{ .Values.persistence.state.storageClass }}
|
|
207
215
|
{{- end }}
|
|
208
216
|
resources:
|
|
209
217
|
requests:
|
|
210
|
-
storage: {{ .Values.persistence.
|
|
218
|
+
storage: {{ .Values.persistence.state.size }}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
replicaCount: 1
|
|
2
2
|
|
|
3
|
-
#
|
|
4
|
-
#
|
|
5
|
-
#
|
|
3
|
+
# Pod security: user vscode (UID 1000), never root. The sidecars inherit
|
|
4
|
+
# runAsUser (kubedock included, which declares none); buildkit declares it
|
|
5
|
+
# again, rootless as 1000.
|
|
6
6
|
securityContext:
|
|
7
7
|
runAsUser: 1000
|
|
8
8
|
runAsGroup: 1000
|
|
@@ -14,42 +14,48 @@ image:
|
|
|
14
14
|
tag: ""
|
|
15
15
|
pullPolicy: IfNotPresent
|
|
16
16
|
|
|
17
|
-
# Docker
|
|
18
|
-
#
|
|
17
|
+
# Docker with no extra rights. kubedock (Docker API): Testcontainers and docker
|
|
18
|
+
# start their containers as pods of the namespace; it listens on 127.0.0.1:2475
|
|
19
|
+
# of the pod.
|
|
19
20
|
kubedock:
|
|
20
21
|
image: joyrex2001/kubedock:0.23.0
|
|
21
|
-
#
|
|
22
|
-
#
|
|
23
|
-
#
|
|
24
|
-
#
|
|
25
|
-
|
|
22
|
+
# Time given to kubedock to start a test container (--timeout). By default
|
|
23
|
+
# kubedock waits one minute only: on the first run on a node, the test pod
|
|
24
|
+
# must pull its image, which often takes longer. Without this timeout,
|
|
25
|
+
# kubedock gives up ("timeout starting container").
|
|
26
|
+
timeout: 5m
|
|
27
|
+
# Cleanup of kubedock-managed test pods (#514). --reapmax reaps resources older
|
|
28
|
+
# than this age (0 disables reaping); --prune-start removes leftover kubedock
|
|
29
|
+
# resources before the API starts. https://github.com/joyrex2001/kubedock/blob/master/config.md
|
|
30
|
+
reapmax: 30m
|
|
31
|
+
pruneStart: true
|
|
26
32
|
resources:
|
|
27
33
|
limits:
|
|
28
34
|
cpu: "1"
|
|
29
35
|
memory: "1Gi"
|
|
30
36
|
|
|
31
|
-
# BuildKit
|
|
32
|
-
# 127.0.0.1:1234
|
|
37
|
+
# Rootless BuildKit: builds the images (buildctl, devzone build); listens on
|
|
38
|
+
# 127.0.0.1:1234 of the pod, with no extra rights.
|
|
33
39
|
buildkit:
|
|
34
40
|
image: moby/buildkit:v0.34.2-rootless
|
|
35
|
-
# seccomp
|
|
36
|
-
#
|
|
41
|
+
# seccomp and AppArmor Unconfined: BuildKit needs mount and unshare, which the
|
|
42
|
+
# default profiles block (BuildKit docs, rootless). AppArmor: Kubernetes 1.30+.
|
|
37
43
|
unconfined: true
|
|
38
44
|
resources:
|
|
39
45
|
limits:
|
|
40
46
|
cpu: "2"
|
|
41
47
|
memory: "4Gi"
|
|
42
48
|
|
|
43
|
-
#
|
|
44
|
-
#
|
|
49
|
+
# Workspace container and the volume of its projects (#399): the workspace PVC
|
|
50
|
+
# is mounted on /workspaces/projets, where the container starts (workingDir).
|
|
45
51
|
workspace:
|
|
46
52
|
# Command: run workspace-init.sh in the foreground first, then keep the pod
|
|
47
53
|
# alive with sleep infinity (like VS Code for a devcontainer) (#503). The init
|
|
48
54
|
# script runs before exec, its errors are ignored (|| true) and its journal is
|
|
49
55
|
# ~/.local/state/devzone/init.log. Empty = image default command.
|
|
50
56
|
command: ["bash", "-c", "mkdir -p \"$HOME/.local/state/devzone\"; bash /usr/local/share/devzone/.devcontainer/workspace-init.sh >>\"$HOME/.local/state/devzone/init.log\" 2>&1 || true; exec sleep infinity"]
|
|
51
|
-
#
|
|
52
|
-
|
|
57
|
+
# Size of the projects volume.
|
|
58
|
+
size: 20Gi
|
|
53
59
|
storageClass: ""
|
|
54
60
|
|
|
55
61
|
resources:
|
|
@@ -61,13 +67,14 @@ resources:
|
|
|
61
67
|
memory: "1Gi"
|
|
62
68
|
|
|
63
69
|
persistence:
|
|
64
|
-
#
|
|
65
|
-
#
|
|
66
|
-
#
|
|
67
|
-
etat
|
|
70
|
+
# Identities, logins and caches, kept from one restart to the next. Each path
|
|
71
|
+
# (relative to the home of vscode) is mounted from this volume at its usual
|
|
72
|
+
# place; the etat-init initContainer creates the directories first. The
|
|
73
|
+
# volume itself keeps its historical name "etat" (existing data, #507).
|
|
74
|
+
state:
|
|
68
75
|
size: 10Gi
|
|
69
76
|
storageClass: ""
|
|
70
|
-
|
|
77
|
+
paths:
|
|
71
78
|
- .config/gh
|
|
72
79
|
- .config/git
|
|
73
80
|
- .claude
|
|
@@ -86,7 +93,7 @@ serviceAccount:
|
|
|
86
93
|
|
|
87
94
|
networkPolicy:
|
|
88
95
|
enabled: true
|
|
89
|
-
#
|
|
90
|
-
#
|
|
91
|
-
#
|
|
92
|
-
|
|
96
|
+
# Ingress limited to the namespace. Egress open by default: a development
|
|
97
|
+
# workstation needs the Internet (Maven, npm, Docker images). true limits the
|
|
98
|
+
# egress to the namespace and to DNS (kube-system). The egress allow list is #220.
|
|
99
|
+
restrictEgress: false
|
package/manage/devzone
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
#!/usr/bin/env bash
|
|
2
2
|
# Commande devzone sur ta machine (paquet npm) :
|
|
3
3
|
# devzone <dossier> crée un devzone dans <dossier> puis le lance
|
|
4
|
-
# devzone
|
|
5
|
-
# devzone
|
|
4
|
+
# devzone update dans un dossier devzone : passe à la version du paquet
|
|
5
|
+
# devzone uninstall dans un dossier devzone : retire tout ce qu'il a créé
|
|
6
6
|
# devzone --version | --help
|
|
7
7
|
# Dans le conteneur, « devzone » est une autre commande : les modules
|
|
8
8
|
# (.devcontainer/devzone).
|
|
@@ -421,14 +421,17 @@ aide() {
|
|
|
421
421
|
devzone $(version) : environnement de développement conteneurisé
|
|
422
422
|
|
|
423
423
|
devzone <dossier> crée un devzone dans <dossier> puis le lance (make up)
|
|
424
|
-
devzone
|
|
424
|
+
devzone update [--oui] [--sans-reconstruire]
|
|
425
425
|
dans un dossier devzone : passe à la version du paquet
|
|
426
426
|
(sauvegarde les fichiers remplacés, propose make rebuild)
|
|
427
|
-
devzone
|
|
427
|
+
devzone uninstall dans un dossier devzone : retire conteneur, image, volumes
|
|
428
428
|
(à lancer avant npm uninstall -g devzone)
|
|
429
|
-
devzone workspace
|
|
430
|
-
devzone workspace vscode|
|
|
429
|
+
devzone workspace start|stop|status|shell
|
|
430
|
+
devzone workspace vscode|copy-to|copy-from|migrate|revert|clean-docker
|
|
431
431
|
poste Kubernetes : pilote le chart devzone-workspace
|
|
432
|
+
devzone workspace services enable|disable <service>|status
|
|
433
|
+
services (gitlab, postgres, argocd) du workspace Kubernetes
|
|
434
|
+
(anciens noms français acceptés : mettre-a-jour, desinstaller, demarrer…)
|
|
432
435
|
devzone --version
|
|
433
436
|
EOF
|
|
434
437
|
}
|
|
@@ -474,7 +477,7 @@ creer() {
|
|
|
474
477
|
# final de .devcontainer/devzone (test de cohérence dans manage/test/cli.bats)
|
|
475
478
|
commande_du_conteneur() {
|
|
476
479
|
case "$1" in
|
|
477
|
-
actif | activer | agent | appliquer | argocd | catalogue | cluster | clusters | \
|
|
480
|
+
actif | activer | agent | appliquer | argocd | build | catalogue | cluster | clusters | \
|
|
478
481
|
demarrer | desactiver | etat | gitlab | metrics | modules | mots-de-passe | \
|
|
479
482
|
mysql | paquets | plateforme | port | postgres | reparer | test-bash32 | \
|
|
480
483
|
test-gitlab | utiliser) return 0 ;;
|
package/manage/scripts/migrer.sh
CHANGED
|
@@ -39,7 +39,7 @@ lire_option() {
|
|
|
39
39
|
}
|
|
40
40
|
|
|
41
41
|
# Chemin du volume etat (relatif au home de vscode) d'un volume Docker devzone-<x> ;
|
|
42
|
-
# vide si le chart n'en monte aucun (persistence.
|
|
42
|
+
# vide si le chart n'en monte aucun (persistence.state.paths).
|
|
43
43
|
chemin_etat() {
|
|
44
44
|
case "$1" in
|
|
45
45
|
gh) echo .config/gh ;;
|
|
@@ -0,0 +1,150 @@
|
|
|
1
|
+
#!/usr/bin/env bash
|
|
2
|
+
# devzone workspace services (#528): installs or removes the devzone services
|
|
3
|
+
# (gitlab, postgres, argocd) of a Kubernetes workspace from the workstation.
|
|
4
|
+
# Sourced by manage/workspace.sh (drapeau_kubectl, POD, NAMESPACE).
|
|
5
|
+
# devzone workspace services enable <service> [options]
|
|
6
|
+
# devzone workspace services disable <service> [--oui]
|
|
7
|
+
# devzone workspace services status
|
|
8
|
+
# Why: the pod has no administrator access to the cluster (#430), while the
|
|
9
|
+
# installers need one. The workstation creates a ServiceAccount bound to
|
|
10
|
+
# cluster-admin for the time of the operation, asks a one-hour token for it
|
|
11
|
+
# and runs the installer inside the pod (kubectl exec, token on stdin, see
|
|
12
|
+
# .devcontainer/services-admin.sh). The account and its binding are removed
|
|
13
|
+
# at the end, even on failure; the token is never printed.
|
|
14
|
+
|
|
15
|
+
SERVICES_ADMIN_SA="devzone-services-admin"
|
|
16
|
+
# Script run in the pod; DEVZONE_SERVICES_ADMIN_SCRIPT: another copy (trial of
|
|
17
|
+
# a version the image of the pod does not hold yet)
|
|
18
|
+
SERVICES_ADMIN_SCRIPT="${DEVZONE_SERVICES_ADMIN_SCRIPT:-/usr/local/share/devzone/.devcontainer/services-admin.sh}"
|
|
19
|
+
SERVICES_TOKEN_DURATION="${DEVZONE_SERVICES_TOKEN_DURATION:-1h}"
|
|
20
|
+
|
|
21
|
+
services_usage() {
|
|
22
|
+
echo "devzone workspace services enable|disable <gitlab|postgres|argocd> [options] | status"
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
services_known() {
|
|
26
|
+
case "${1:-}" in
|
|
27
|
+
gitlab | postgres | argocd) return 0 ;;
|
|
28
|
+
esac
|
|
29
|
+
return 1
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
# Namespace of a service in the cluster (gitlab: default instance)
|
|
33
|
+
services_namespace() {
|
|
34
|
+
case "$1" in
|
|
35
|
+
gitlab) echo devzone-gitlab ;;
|
|
36
|
+
postgres) echo devzone-postgres ;;
|
|
37
|
+
argocd) echo devzone-argocd ;;
|
|
38
|
+
esac
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
# The workspace pod must be running: the installer runs inside it
|
|
42
|
+
services_pod_running() {
|
|
43
|
+
local phase
|
|
44
|
+
# shellcheck disable=SC2046
|
|
45
|
+
phase="$(kubectl $(drapeau_kubectl) get pod "$POD" --namespace "$NAMESPACE" \
|
|
46
|
+
-o jsonpath='{.status.phase}' 2>/dev/null)" || phase=""
|
|
47
|
+
[ "$phase" = Running ]
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
# Temporary administrator: ServiceAccount of the workspace namespace bound to
|
|
51
|
+
# cluster-admin (idempotent apply)
|
|
52
|
+
services_admin_create() {
|
|
53
|
+
# shellcheck disable=SC2046
|
|
54
|
+
kubectl $(drapeau_kubectl) apply -f - >/dev/null <<EOF
|
|
55
|
+
apiVersion: v1
|
|
56
|
+
kind: ServiceAccount
|
|
57
|
+
metadata:
|
|
58
|
+
name: $SERVICES_ADMIN_SA
|
|
59
|
+
namespace: $NAMESPACE
|
|
60
|
+
---
|
|
61
|
+
apiVersion: rbac.authorization.k8s.io/v1
|
|
62
|
+
kind: ClusterRoleBinding
|
|
63
|
+
metadata:
|
|
64
|
+
name: $SERVICES_ADMIN_SA
|
|
65
|
+
roleRef:
|
|
66
|
+
apiGroup: rbac.authorization.k8s.io
|
|
67
|
+
kind: ClusterRole
|
|
68
|
+
name: cluster-admin
|
|
69
|
+
subjects:
|
|
70
|
+
- kind: ServiceAccount
|
|
71
|
+
name: $SERVICES_ADMIN_SA
|
|
72
|
+
namespace: $NAMESPACE
|
|
73
|
+
EOF
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
services_admin_delete() {
|
|
77
|
+
# shellcheck disable=SC2046
|
|
78
|
+
kubectl $(drapeau_kubectl) delete clusterrolebinding "$SERVICES_ADMIN_SA" \
|
|
79
|
+
--ignore-not-found >/dev/null 2>&1 || true
|
|
80
|
+
# shellcheck disable=SC2046
|
|
81
|
+
kubectl $(drapeau_kubectl) delete serviceaccount "$SERVICES_ADMIN_SA" \
|
|
82
|
+
--namespace "$NAMESPACE" --ignore-not-found >/dev/null 2>&1 || true
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
# Runs the installer in the pod: temporary administrator created, token on
|
|
86
|
+
# stdin of kubectl exec, administrator removed whatever the outcome
|
|
87
|
+
services_run() {
|
|
88
|
+
local action="$1" service="$2" token code=0
|
|
89
|
+
shift 2
|
|
90
|
+
if ! services_known "$service"; then
|
|
91
|
+
echo "✖ unknown service: ${service:-(none)} ($(services_usage))" >&2
|
|
92
|
+
return 1
|
|
93
|
+
fi
|
|
94
|
+
if ! services_pod_running; then
|
|
95
|
+
echo "✖ workspace pod $POD not running: devzone workspace start" >&2
|
|
96
|
+
return 1
|
|
97
|
+
fi
|
|
98
|
+
echo "▶ temporary administrator $SERVICES_ADMIN_SA (removed at the end)…"
|
|
99
|
+
if ! services_admin_create; then
|
|
100
|
+
echo "✖ cannot create the temporary administrator: cluster-admin rights needed on the workstation" >&2
|
|
101
|
+
return 1
|
|
102
|
+
fi
|
|
103
|
+
trap services_admin_delete EXIT
|
|
104
|
+
# shellcheck disable=SC2046
|
|
105
|
+
if ! token="$(kubectl $(drapeau_kubectl) create token "$SERVICES_ADMIN_SA" \
|
|
106
|
+
--namespace "$NAMESPACE" --duration "$SERVICES_TOKEN_DURATION")" || [ -z "$token" ]; then
|
|
107
|
+
echo "✖ cannot get a token of the temporary administrator (kubectl 1.24 or more)" >&2
|
|
108
|
+
services_admin_delete
|
|
109
|
+
trap - EXIT
|
|
110
|
+
return 1
|
|
111
|
+
fi
|
|
112
|
+
echo "▶ $action $service in the pod $POD…"
|
|
113
|
+
# shellcheck disable=SC2046
|
|
114
|
+
printf '%s\n' "$token" | kubectl $(drapeau_kubectl) exec -i "$POD" --namespace "$NAMESPACE" \
|
|
115
|
+
-c workspace -- bash "$SERVICES_ADMIN_SCRIPT" "$action" "$service" "$@" || code=$?
|
|
116
|
+
services_admin_delete
|
|
117
|
+
trap - EXIT
|
|
118
|
+
if [ "$code" -ne 0 ]; then
|
|
119
|
+
echo "✖ $action $service failed (code $code); in the pod: devzone status" >&2
|
|
120
|
+
return "$code"
|
|
121
|
+
fi
|
|
122
|
+
echo "✔ $action $service done; in the pod: devzone status; local access: devzone workspace ports"
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
# One line per service: installed (namespace present) or not
|
|
126
|
+
services_status() {
|
|
127
|
+
local s ns
|
|
128
|
+
for s in gitlab postgres argocd; do
|
|
129
|
+
ns="$(services_namespace "$s")"
|
|
130
|
+
# shellcheck disable=SC2046
|
|
131
|
+
if kubectl $(drapeau_kubectl) get namespace "$ns" >/dev/null 2>&1; then
|
|
132
|
+
echo " ✔ $s installed (namespace $ns): devzone workspace services disable $s"
|
|
133
|
+
else
|
|
134
|
+
echo " ○ $s not installed: devzone workspace services enable $s"
|
|
135
|
+
fi
|
|
136
|
+
done
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
services() {
|
|
140
|
+
local sub="${1:-}"
|
|
141
|
+
case "$sub" in
|
|
142
|
+
enable | activer) services_run enable "${2:-}" "${@:3}" ;;
|
|
143
|
+
disable | desactiver) services_run disable "${2:-}" "${@:3}" ;;
|
|
144
|
+
status | etat | '') services_status ;;
|
|
145
|
+
*)
|
|
146
|
+
echo "✖ unknown subcommand: $sub ($(services_usage))" >&2
|
|
147
|
+
return 1
|
|
148
|
+
;;
|
|
149
|
+
esac
|
|
150
|
+
}
|
package/manage/workspace.sh
CHANGED
|
@@ -169,6 +169,8 @@ copier_depuis() {
|
|
|
169
169
|
. "$ICI/scripts/migrer-retour.sh"
|
|
170
170
|
# shellcheck source=scripts/ports-workspace.sh
|
|
171
171
|
. "$ICI/scripts/ports-workspace.sh"
|
|
172
|
+
# shellcheck source=scripts/services-workspace.sh
|
|
173
|
+
. "$ICI/scripts/services-workspace.sh"
|
|
172
174
|
|
|
173
175
|
# English command names are accepted, French ones unchanged (#502).
|
|
174
176
|
# A copied devzone may miss the aliases file: then no normalization.
|
|
@@ -193,16 +195,19 @@ case "${1:-}" in
|
|
|
193
195
|
migrer) migrer "${@:2}" ;;
|
|
194
196
|
revenir) revenir "${@:2}" ;;
|
|
195
197
|
nettoyer-docker) nettoyer_docker "${@:2}" ;;
|
|
198
|
+
services) services "${@:2}" ;;
|
|
196
199
|
'' | -h | --help | aide)
|
|
197
|
-
echo "devzone workspace demarrer|arreter|etat|shell|vscode|copier-vers|copier-depuis|ports|migrer|revenir|nettoyer-docker"
|
|
200
|
+
echo "devzone workspace demarrer|arreter|etat|shell|vscode|copier-vers|copier-depuis|ports|services|migrer|revenir|nettoyer-docker"
|
|
198
201
|
echo " demarrer [--image dépôt:tag] installe le workspace (image de la version de devzone par défaut)"
|
|
199
202
|
echo " ports [demarrer|arreter|etat] applications et services du pod sur localhost du poste"
|
|
203
|
+
echo " services enable|disable <service> [options] | status"
|
|
204
|
+
echo " devzone services (gitlab, postgres, argocd) of the cluster, installed from the workstation"
|
|
200
205
|
echo " migrer [--oui] copie le poste Docker vers le workspace Kubernetes (rien n'est supprimé)"
|
|
201
206
|
echo " revenir [--rapatrier] retour au poste Docker ; --rapatrier : projets du pod recopiés d'abord"
|
|
202
207
|
echo " nettoyer-docker supprime les volumes Docker devzone-*, après confirmation [o/N] (--oui)"
|
|
203
208
|
;;
|
|
204
209
|
*)
|
|
205
|
-
echo "✖ sous-commande inconnue : $1 (devzone workspace demarrer|arreter|etat|shell|vscode|copier-vers|copier-depuis|ports|migrer|revenir|nettoyer-docker)" >&2
|
|
210
|
+
echo "✖ sous-commande inconnue : $1 (devzone workspace demarrer|arreter|etat|shell|vscode|copier-vers|copier-depuis|ports|services|migrer|revenir|nettoyer-docker)" >&2
|
|
206
211
|
exit 1
|
|
207
212
|
;;
|
|
208
213
|
esac
|