devzone 0.36.4 → 0.36.6

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.
@@ -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
@@ -62,14 +62,23 @@ voulu() {
62
62
  [ "$v" = on ] && echo on || echo off
63
63
  }
64
64
 
65
- # Application présente dans le cluster : namespace étiqueté et StatefulSet du
66
- # nom de l'application ; sans cluster choisi ou absente : rien. Lecture des
67
- # namespaces réservée à l'administrateur (#430).
65
+ # Application present in the cluster. In the Kubernetes workspace pod: its
66
+ # service resolves in the cluster DNS (no RBAC needed, #515). Elsewhere: labelled
67
+ # namespace and StatefulSet of the app name; reading the namespaces is reserved
68
+ # to the administrator (#430). Nothing without a chosen cluster or when absent.
68
69
  presente() {
69
70
  local ctx ns
71
+ ns="$(app_ns "$1")"
72
+ if [ "${DEVZONE_WORKSPACE:-}" = kubernetes ]; then
73
+ # In the pod there is no kubeconfig and the limited service account
74
+ # cannot list StatefulSets (#430): presence is the cluster DNS
75
+ # resolving the service, no RBAC needed, the pod service account
76
+ # stays limited
77
+ getent hosts "$(app_lire "$1" nom).${ns}.svc" >/dev/null 2>&1
78
+ return
79
+ fi
70
80
  ctx="$(cluster_lu)"
71
81
  [ -n "$ctx" ] || return 1
72
- ns="$(app_ns "$1")"
73
82
  compte_admin "$ctx" get namespace "$ns" >/dev/null 2>&1 &&
74
83
  kubectl --context devzone -n "$ns" get statefulset "$1" >/dev/null 2>&1
75
84
  }
@@ -142,6 +151,10 @@ catalogue_lister() {
142
151
  # Relais de l application installee : etat de son script, sinon pid du relais
143
152
  app_relais_arrete() {
144
153
  local app="$1" script etat
154
+ if [ "${DEVZONE_WORKSPACE:-}" = kubernetes ]; then
155
+ # In the pod, no relay: the access goes through the workspace ports
156
+ return 1
157
+ fi
145
158
  script="$ICI/catalogue/$app/$app.sh"
146
159
  if [ -f "$script" ]; then
147
160
  etat="$(bash "$script" etat 2>/dev/null || true)"
@@ -181,8 +194,12 @@ catalogue_resume() {
181
194
  if app_relais_arrete "$app"; then
182
195
  printf ' ⚠ application %-12s installée, relais arrêté : devzone reparer\n' "$app"
183
196
  else
184
- printf ' ✔ application %-12s installée : 127.0.0.1:%s\n' \
185
- "$app" "$(app_lire "$app" port)"
197
+ if [ "${DEVZONE_WORKSPACE:-}" = kubernetes ]; then
198
+ printf ' ✔ application %-12s installée : local access: devzone workspace ports\n' "$app"
199
+ else
200
+ printf ' ✔ application %-12s installée : 127.0.0.1:%s\n' \
201
+ "$app" "$(app_lire "$app" port)"
202
+ fi
186
203
  fi ;;
187
204
  attendue) printf ' ⚠ application %-12s attendue : devzone appliquer\n' "$app" ;;
188
205
  *) printf ' ✖ application %s en échec : %s : devzone appliquer\n' \
@@ -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é
@@ -1202,13 +1203,19 @@ etat() {
1202
1203
  # Socket Docker de l'hôte (#432) : l'avertissement montre l'état réel,
1203
1204
  # le socket monté (même variable que docker-relais.sh), pas l'option :
1204
1205
  # le montage ne change qu'au make rebuild (faux rassurant en attendant)
1205
- relais_source="${DEVZONE_RELAIS_SOURCE:-/var/run/docker-host.sock}"
1206
- if [ -e "$relais_source" ] && [ "$(valeur docker-hote)" = on ]; then
1207
- printf ' ⚠ socket Docker de l hôte partagé (agents compris)\n'
1208
- elif [ -e "$relais_source" ]; then
1209
- printf ' ⚠ socket Docker de l hôte encore partagé : make rebuild sur le poste\n'
1210
- elif [ "$(valeur docker-hote)" = on ]; then
1211
- printf ' ⚠ socket Docker de l hôte absent : make rebuild sur le poste\n'
1206
+ # In the Kubernetes workspace (DEVZONE_WORKSPACE=kubernetes), the pod has
1207
+ # no Docker host socket: no alert, the service account is the cluster access
1208
+ if [ "${DEVZONE_WORKSPACE:-}" = kubernetes ]; then
1209
+ printf ' ✔ workspace Kubernetes pod, service account access only (no Docker socket)\n'
1210
+ else
1211
+ relais_source="${DEVZONE_RELAIS_SOURCE:-/var/run/docker-host.sock}"
1212
+ if [ -e "$relais_source" ] && [ "$(valeur docker-hote)" = on ]; then
1213
+ printf ' ⚠ socket Docker de l hôte partagé (agents compris)\n'
1214
+ elif [ -e "$relais_source" ]; then
1215
+ printf ' ⚠ socket Docker de l hôte encore partagé : make rebuild sur le poste\n'
1216
+ elif [ "$(valeur docker-hote)" = on ]; then
1217
+ printf ' ⚠ socket Docker de l hôte absent : make rebuild sur le poste\n'
1218
+ fi
1212
1219
  fi
1213
1220
  # Applications du catalogue (#414)
1214
1221
  if [ -d "$ICI/catalogue" ]; then
@@ -1343,6 +1350,9 @@ case "${1:-}" in
1343
1350
  agent)
1344
1351
  bash "$ICI/agent.sh" "${@:2}"
1345
1352
  ;;
1353
+ build)
1354
+ bash "$ICI/workspace-build.sh" "${@:2}"
1355
+ ;;
1346
1356
  reparer) reparer ;;
1347
1357
  demarrer) bash "$ICI/demarrage.sh" ;;
1348
1358
  metrics) bash "$ICI/metrics-server.sh" "${@:2}" ;;
@@ -161,12 +161,19 @@ etat_json() {
161
161
 
162
162
  # Option docker-hote (#432) : absente = on ; socket réellement monté
163
163
  # (même source que docker-relais.sh), peut différer jusqu'au make rebuild
164
- if [ "$(valeur docker-hote)" = on ]; then
165
- docker_hote=true
166
- fi
167
- relais_source="${DEVZONE_RELAIS_SOURCE:-/var/run/docker-host.sock}"
168
- if [ -e "$relais_source" ]; then
169
- docker_hote_actif=true
164
+ # In the Kubernetes workspace (DEVZONE_WORKSPACE=kubernetes), the pod has
165
+ # no Docker host socket: the socket is absent (#515)
166
+ if [ "${DEVZONE_WORKSPACE:-}" = kubernetes ]; then
167
+ docker_hote=false
168
+ docker_hote_actif=false
169
+ else
170
+ if [ "$(valeur docker-hote)" = on ]; then
171
+ docker_hote=true
172
+ fi
173
+ relais_source="${DEVZONE_RELAIS_SOURCE:-/var/run/docker-host.sock}"
174
+ if [ -e "$relais_source" ]; then
175
+ docker_hote_actif=true
176
+ fi
170
177
  fi
171
178
 
172
179
  services_cluster="$(cluster_lu)"
@@ -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"
@@ -1,6 +1,6 @@
1
1
  apiVersion: v2
2
2
  name: devzone-workspace
3
- description: Poste de developpement devzone dans Kubernetes.
3
+ description: devzone development workstation in Kubernetes.
4
4
  type: application
5
5
  version: 0.1.0
6
6
  appVersion: "0.1.0"
@@ -8,13 +8,13 @@ spec:
8
8
  podSelector: {}
9
9
  policyTypes:
10
10
  - Ingress
11
- {{- if .Values.networkPolicy.sortieRestreinte }}
11
+ {{- if .Values.networkPolicy.restrictEgress }}
12
12
  - Egress
13
13
  {{- end }}
14
14
  ingress:
15
15
  - from:
16
16
  - podSelector: {}
17
- {{- if .Values.networkPolicy.sortieRestreinte }}
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
- # Droits de kubedock (0.23.0, lus dans ses sources), limites au namespace :
7
- # pods (creer et supprimer les conteneurs de test, les lister et les suivre),
8
- # pods/log, pods/exec et pods/portforward (logs, commandes, ports), services et
9
- # configmaps (crees et supprimes avec les pods). Aucun droit sur les secrets ni
10
- # les deployments : kubedock 0.23.0 ne les utilise pas. Le pod execute du code de
11
- # projet : pas de droit sur les autres namespaces, ni sur le cluster.
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
- # Les PVC (projets, connexions) ne sont jamais supprimes avec le StatefulSet.
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 en utilisateur vscode (UID 1000), jamais root : le HOME du workspace est
23
- # /home/vscode, ou sont montees les connexions. fsGroup 1000 rend le volume etat
24
- # ecrit par vscode. Reglages dans values.yaml (securityContext).
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
- # Sidecars natifs (restartPolicy: Always, Kubernetes 1.29+) : ils demarrent
28
- # avant le conteneur workspace, et leur startupProbe bloque ce demarrage tant
29
- # qu'ils ne repondent pas. Aucun n'est privilegie, et aucun ne declare de port :
30
- # ils n'ecoutent que sur 127.0.0.1 du pod.
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 : cree les dossiers du volume etat (identites, connexions,
33
- # caches). Il tourne en vscode (UID 1000), sans privilege. Un lien symbolique
34
- # ecrit ici ne survivrait pas : le conteneur workspace a son propre systeme
35
- # de fichiers. Le workspace monte donc chaque dossier (subPath) a sa place.
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
- Commentaire Helm : il ne figure pas dans le rendu. La liste $dirs vient
40
- de persistence.etat.chemins, comme les montages du workspace.
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.etat.chemins }}
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 : API Docker du pod. Les conteneurs de test deviennent des pods du
64
- # namespace, crees avec le Role du chart (limite au 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
- Reglages de l'essai du lead (#410) : server --port-forward --reverse-proxy.
70
- NAMESPACE vient du pod, pour que kubedock cree les pods dans son namespace.
71
- Commentaire Helm : il ne figure pas dans le rendu.
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.delai | quote }}
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 rootless : construit les images, sans privilege ni socket du noeud.
97
- # Reglages rootless de la doc BuildKit pour Kubernetes (examples/kubernetes).
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 : rootless n'a pas de sandbox de processus
103
- sur Kubernetes (doc BuildKit). L'UID 1000 est celui de l'image rootless.
104
- Commentaire Helm : il ne figure pas dans le rendu.
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
- # Les projets vivent sur le PVC workspace : le conteneur y demarre.
138
+ # The projects live on the workspace PVC: the container starts there.
131
139
  workingDir: /workspaces/projets
132
140
  {{- /*
133
- Sans command, le conteneur lance l'entrypoint de l'image (bash pour un
134
- devcontainer), qui se termine aussitot faute de terminal : le pod boucle
135
- en redemarrages. sleep infinity le garde en vie, comme VS Code pour un
136
- devcontainer ; le poste entre ensuite par kubectl exec. Commentaire Helm :
137
- il ne figure pas dans le rendu.
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 de vscode : gh, claude, opencode... ecrivent leurs connexions dans
144
- # les chemins montes depuis le volume etat (et non dans le home de root).
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
- # Repère du workspace Kubernetes : devzone agent lance opencode ici (#431)
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 etat volume (#503)
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 et docker parlent a kubedock, et buildctl a BuildKit.
160
- # Ryuk est coupe : kubedock nettoie les conteneurs de test lui-meme.
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
- # Identites et caches : chaque chemin du volume etat est monte a son
177
- # emplacement habituel (gh, git, Claude Code, opencode, devzone agent, caches).
178
- {{- range .Values.persistence.etat.chemins }}
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
- # Les projets ne sont jamais supprimes par helm uninstall (#399).
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.taille }}
204
+ storage: {{ .Values.workspace.size }}
197
205
  - metadata:
198
206
  name: etat
199
207
  annotations:
200
- # Le PVC survit a la desinstallation du chart (connexions gardees). La
201
- # vraie protection est persistentVolumeClaimRetentionPolicy ci-dessous.
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.etat.storageClass }}
206
- storageClassName: {{ .Values.persistence.etat.storageClass }}
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.etat.size }}
218
+ storage: {{ .Values.persistence.state.size }}
@@ -1,8 +1,8 @@
1
1
  replicaCount: 1
2
2
 
3
- # Securite du pod : utilisateur vscode (UID 1000), jamais root. Les sidecars
4
- # heritent de runAsUser (kubedock inclus, qui n'en declare pas) ; buildkit le
5
- # redeclare, rootless en 1000.
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 sans privilege. kubedock (API Docker) : Testcontainers et docker lancent
18
- # leurs conteneurs comme des pods du namespace, ecoute sur 127.0.0.1:2475 du pod.
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
- # Delai accorde a kubedock pour demarrer un conteneur de test (--timeout). Par
22
- # defaut, kubedock n'attend qu'une minute : au premier lancement sur un noeud, le
23
- # pod de test doit tirer son image, et ce tirage depasse souvent cette minute.
24
- # Sans ce delai, kubedock abandonne (« timeout starting container »).
25
- delai: 5m
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 rootless : construit les images (buildctl, BUILDKIT_HOST), ecoute sur
32
- # 127.0.0.1:1234 du pod. Jamais privilegie.
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 et AppArmor Unconfined : BuildKit a besoin de mount et unshare, que les
36
- # profils par defaut bloquent (docs BuildKit, rootless). AppArmor : Kubernetes 1.30+.
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
- # Conteneur workspace et volume de ses projets (#399) : le PVC workspace est
44
- # monte sur /workspaces/projets, ou le conteneur demarre (workingDir).
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
- # Taille du volume des projets.
52
- taille: 20Gi
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
- # Identités, connexions et caches, gardés d'un redémarrage à l'autre. Chaque
65
- # chemin (relatif au home de vscode) est monté depuis ce volume à son
66
- # emplacement habituel ; l'initContainer etat-init crée les dossiers d'abord.
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
- chemins:
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
- # Entree limitee au namespace. Sortie libre par defaut : un poste de dev a
90
- # besoin d'Internet (Maven, npm, images Docker). Mettre true limite la sortie
91
- # au namespace et au DNS (kube-system). La liste blanche de sortie est #220.
92
- sortieRestreinte: false
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
@@ -474,7 +474,7 @@ creer() {
474
474
  # final de .devcontainer/devzone (test de cohérence dans manage/test/cli.bats)
475
475
  commande_du_conteneur() {
476
476
  case "$1" in
477
- actif | activer | agent | appliquer | argocd | catalogue | cluster | clusters | \
477
+ actif | activer | agent | appliquer | argocd | build | catalogue | cluster | clusters | \
478
478
  demarrer | desactiver | etat | gitlab | metrics | modules | mots-de-passe | \
479
479
  mysql | paquets | plateforme | port | postgres | reparer | test-bash32 | \
480
480
  test-gitlab | utiliser) return 0 ;;
@@ -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.etat.chemins).
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,53 @@
1
+ #!/usr/bin/env bash
2
+ # Waits for the workspace pod after helm upgrade (#486, #494, #512), sourced by
3
+ # manage/workspace.sh: moved here to keep workspace.sh under 250 lines (#515).
4
+ # Uses drapeau_kubectl and drapeau_helm from workspace.sh.
5
+
6
+ # Attend le pod du workspace ; image introuvable ou pod lent sont dits clairement.
7
+ attendre_pod() {
8
+ local image="$1" attente pas debut etat evenements arch target_revision pod_revision
9
+ attente="${DEVZONE_WORKSPACE_ATTENTE:-120}"
10
+ pas="${DEVZONE_WORKSPACE_PAS:-2}"
11
+ debut="$SECONDS"
12
+ while [ $((SECONDS - debut)) -lt "$attente" ]; do
13
+ # Why: after helm upgrade the pod is still the old one; judge only the revision the StatefulSet is updating to, within the same wait bound.
14
+ # shellcheck disable=SC2046
15
+ target_revision="$(kubectl $(drapeau_kubectl) get statefulset devzone-workspace --namespace devzone-workspace -o jsonpath='{.status.updateRevision}' 2>/dev/null)" || true
16
+ # shellcheck disable=SC2046
17
+ pod_revision="$(kubectl $(drapeau_kubectl) get pod devzone-workspace-0 --namespace devzone-workspace -o jsonpath='{.metadata.labels.controller-revision-hash}' 2>/dev/null)" || true
18
+ if [ -z "$target_revision" ] || [ -z "$pod_revision" ] || [ "$target_revision" != "$pod_revision" ]; then sleep "$pas"; continue; fi
19
+ # shellcheck disable=SC2046
20
+ etat="$(kubectl $(drapeau_kubectl) get pod devzone-workspace-0 --namespace devzone-workspace \
21
+ -o jsonpath='{.status.phase} {.status.initContainerStatuses[*].state.waiting.reason} {.status.containerStatuses[*].state.waiting.reason}' 2>/dev/null)" || true
22
+ case "$etat" in
23
+ *ErrImagePull* | *ImagePullBackOff*)
24
+ # shellcheck disable=SC2046
25
+ evenements="$(kubectl $(drapeau_kubectl) get events --namespace devzone-workspace \
26
+ --field-selector involvedObject.name=devzone-workspace-0 \
27
+ -o jsonpath='{.items[*].message}' 2>/dev/null)" || true
28
+ case "$evenements" in
29
+ *"no match for platform"*)
30
+ # shellcheck disable=SC2046
31
+ arch="$(kubectl $(drapeau_kubectl) get nodes \
32
+ -o jsonpath='{.items[0].status.nodeInfo.architecture}' 2>/dev/null)" || true
33
+ echo "✖ image $image sans version pour $arch : les livraisons de devzone la publient pour amd64 et arm64." >&2
34
+ ;;
35
+ *)
36
+ echo "✖ image $image introuvable : elle est publiée à chaque livraison de devzone." >&2
37
+ ;;
38
+ esac
39
+ echo " Pour une image construite à la main : devzone workspace demarrer --image <repository:tag>" >&2
40
+ # shellcheck disable=SC2046
41
+ helm $(drapeau_helm) uninstall devzone-workspace --namespace devzone-workspace >/dev/null 2>&1 || true
42
+ return 1
43
+ ;;
44
+ Running*)
45
+ echo "✔ workspace démarré ($image)"
46
+ return 0
47
+ ;;
48
+ esac
49
+ sleep "$pas"
50
+ done
51
+ echo "⚠ pod pas encore prêt après $attente s : devzone workspace etat" >&2
52
+ return 0
53
+ }
@@ -45,55 +45,6 @@ image_par_defaut() {
45
45
  fi
46
46
  }
47
47
 
48
- # Attend le pod du workspace ; image introuvable ou pod lent sont dits clairement.
49
- attendre_pod() {
50
- local image="$1" attente pas debut etat evenements arch target_revision pod_revision
51
- attente="${DEVZONE_WORKSPACE_ATTENTE:-120}"
52
- pas="${DEVZONE_WORKSPACE_PAS:-2}"
53
- debut="$SECONDS"
54
- while [ $((SECONDS - debut)) -lt "$attente" ]; do
55
- # Why: after helm upgrade the pod is still the old one; judge only the revision the StatefulSet is updating to, within the same wait bound.
56
- # shellcheck disable=SC2046
57
- target_revision="$(kubectl $(drapeau_kubectl) get statefulset devzone-workspace --namespace devzone-workspace -o jsonpath='{.status.updateRevision}' 2>/dev/null)" || true
58
- # shellcheck disable=SC2046
59
- pod_revision="$(kubectl $(drapeau_kubectl) get pod devzone-workspace-0 --namespace devzone-workspace -o jsonpath='{.metadata.labels.controller-revision-hash}' 2>/dev/null)" || true
60
- if [ -z "$target_revision" ] || [ -z "$pod_revision" ] || [ "$target_revision" != "$pod_revision" ]; then sleep "$pas"; continue; fi
61
- # shellcheck disable=SC2046
62
- etat="$(kubectl $(drapeau_kubectl) get pod devzone-workspace-0 --namespace devzone-workspace \
63
- -o jsonpath='{.status.phase} {.status.initContainerStatuses[*].state.waiting.reason} {.status.containerStatuses[*].state.waiting.reason}' 2>/dev/null)" || true
64
- case "$etat" in
65
- *ErrImagePull* | *ImagePullBackOff*)
66
- # shellcheck disable=SC2046
67
- evenements="$(kubectl $(drapeau_kubectl) get events --namespace devzone-workspace \
68
- --field-selector involvedObject.name=devzone-workspace-0 \
69
- -o jsonpath='{.items[*].message}' 2>/dev/null)" || true
70
- case "$evenements" in
71
- *"no match for platform"*)
72
- # shellcheck disable=SC2046
73
- arch="$(kubectl $(drapeau_kubectl) get nodes \
74
- -o jsonpath='{.items[0].status.nodeInfo.architecture}' 2>/dev/null)" || true
75
- echo "✖ image $image sans version pour $arch : les livraisons de devzone la publient pour amd64 et arm64." >&2
76
- ;;
77
- *)
78
- echo "✖ image $image introuvable : elle est publiée à chaque livraison de devzone." >&2
79
- ;;
80
- esac
81
- echo " Pour une image construite à la main : devzone workspace demarrer --image <repository:tag>" >&2
82
- # shellcheck disable=SC2046
83
- helm $(drapeau_helm) uninstall devzone-workspace --namespace devzone-workspace >/dev/null 2>&1 || true
84
- return 1
85
- ;;
86
- Running*)
87
- echo "✔ workspace démarré ($image)"
88
- return 0
89
- ;;
90
- esac
91
- sleep "$pas"
92
- done
93
- echo "⚠ pod pas encore prêt après $attente s : devzone workspace etat" >&2
94
- return 0
95
- }
96
-
97
48
  # Installe ou met à jour le workspace dans le cluster.
98
49
  demarrer() {
99
50
  local depot tag image avec_image="" args=()
@@ -132,6 +83,11 @@ demarrer() {
132
83
  else
133
84
  args+=(--set "image.tag=$tag")
134
85
  fi
86
+ # latest moves at every release: an image already on the node would stay
87
+ # the old one with IfNotPresent (#515)
88
+ if [ "$tag" = latest ]; then
89
+ args+=(--set "image.pullPolicy=Always")
90
+ fi
135
91
  # shellcheck disable=SC2046
136
92
  helm $(drapeau_helm) upgrade --install devzone-workspace "$(chemin_chart)" "${args[@]}"
137
93
  attendre_pod "$image" || return 1
@@ -205,6 +161,8 @@ copier_depuis() {
205
161
  --namespace "$NAMESPACE" -c workspace
206
162
  }
207
163
 
164
+ # shellcheck source=scripts/workspace-wait.sh
165
+ . "$ICI/scripts/workspace-wait.sh"
208
166
  # shellcheck source=scripts/migrer.sh
209
167
  . "$ICI/scripts/migrer.sh"
210
168
  # shellcheck source=scripts/migrer-retour.sh
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "devzone",
3
- "version": "0.36.4",
3
+ "version": "0.36.6",
4
4
  "description": "Ton poste de développement Linux, prêt en une commande, identique sur Mac, Windows et Linux.",
5
5
  "license": "GPL-3.0-only",
6
6
  "repository": {