devzone 0.49.0 → 0.50.1
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/agent.sh +2 -2
- package/.devcontainer/devzone +1 -1
- package/.devcontainer/opencode.jsonc +1 -1
- package/README.md +2 -0
- package/charts/devzone-workspace/templates/egress-proxy.yaml +6 -0
- package/charts/devzone-workspace/values.yaml +3 -0
- package/manage/scripts/argocd-services.sh +2 -0
- package/manage/scripts/workspace-egress.sh +184 -0
- package/manage/workspace.sh +10 -10
- package/package.json +1 -1
package/.devcontainer/agent.sh
CHANGED
|
@@ -26,8 +26,8 @@ RACINE="${DEVZONE_RACINE:-$(dirname "$ICI")}"
|
|
|
26
26
|
. "$ICI/agent-workspace.sh"
|
|
27
27
|
# shellcheck source=agent-local.sh disable=SC1091
|
|
28
28
|
. "$ICI/agent-local.sh"
|
|
29
|
-
FREE_MODELS=(big-pickle deepseek-v4.1-flash-free
|
|
30
|
-
nemotron-3.5-lightning-free mimo-v2.6-flash-free beam-free flint-40b-free
|
|
29
|
+
FREE_MODELS=(big-pickle deepseek-v4.1-flash-free hy4-flash-free nemotron-3.5-super-vl-free
|
|
30
|
+
nemotron-3.5-lightning-free mimo-v2.6-flash-free beam-free flint-40b-free longcat-2.5-free)
|
|
31
31
|
# Session pod ephemere (#222)
|
|
32
32
|
# shellcheck source=agent-pod.sh disable=SC1091
|
|
33
33
|
. "$ICI/agent-pod.sh"
|
package/.devcontainer/devzone
CHANGED
|
@@ -52,7 +52,7 @@ fi
|
|
|
52
52
|
# change pas : deux montées simultanées (workflow versions) se fusionnent sans
|
|
53
53
|
# conflit, git n'en signalant qu'entre lignes voisines modifiées.
|
|
54
54
|
# Claude Code
|
|
55
|
-
IA_CLAUDE=@anthropic-ai/claude-code@2.1.
|
|
55
|
+
IA_CLAUDE=@anthropic-ai/claude-code@2.1.327
|
|
56
56
|
# opencode
|
|
57
57
|
IA_OPENCODE=opencode-ai@1.19.6
|
|
58
58
|
IA_PAQUETS=("$IA_CLAUDE" "$IA_OPENCODE")
|
|
@@ -122,7 +122,7 @@
|
|
|
122
122
|
},
|
|
123
123
|
"agent": {
|
|
124
124
|
"build": { "model": "opencode/big-pickle" },
|
|
125
|
-
"plan": { "model": "opencode/
|
|
125
|
+
"plan": { "model": "opencode/hy4-flash-free" },
|
|
126
126
|
"general": { "model": "opencode/deepseek-v4.1-flash-free" },
|
|
127
127
|
"explore": { "model": "opencode/nemotron-3.5-lightning-free" },
|
|
128
128
|
"title": { "model": "opencode/mimo-v2.6-flash-free" },
|
package/README.md
CHANGED
|
@@ -454,3 +454,5 @@ Limite le réseau sortant des sessions lancées avec `devzone agent --pod` via u
|
|
|
454
454
|
- **Lire les contacts** : `kubectl logs deploy/devzone-workspace-egress-proxy -c access-log -n <namespace>`.
|
|
455
455
|
- **Garde (strict)** : une fenêtre de 1 à 2 s existe au démarrage avant que la restriction soit programmée ; un conteneur d’initialisation attend que l’accès direct soit fermé (20 essais, 1 s) et refuse la session si la restriction ne devient jamais effective.
|
|
456
456
|
- **Limites** : le workspace lui-même reste ouvert ; seules les sessions `devzone agent --pod` sont filtrées ; les outils qui ignorent `HTTPS_PROXY` sont bloqués en mode strict.
|
|
457
|
+
- **Commandes** (#633) : `devzone workspace egress observation|strict|off`, `egress status` (domaines contactés et leur état), `egress allow|deny <domaine>`. Le réglage est gardé dans `.devzone.modules` et rejoué à chaque `workspace start` et `workspace update` ; le pod n'est pas recréé.
|
|
458
|
+
- **Parcours** : `devzone workspace egress observation`, puis `egress status` pour voir les domaines contactés, `egress allow <domaine>` pour ceux qui manquent, et enfin `devzone workspace egress strict`.
|
|
@@ -19,6 +19,12 @@ data:
|
|
|
19
19
|
{{- if eq .Values.egressProxy.mode "strict" }}
|
|
20
20
|
{{- range .Values.egressProxy.allowedDomains }}
|
|
21
21
|
acl allowed dstdomain {{ . }}
|
|
22
|
+
{{- end }}
|
|
23
|
+
{{- range splitList "," (default "" .Values.egressProxy.extraDomains) }}
|
|
24
|
+
{{- $domain := trim . }}
|
|
25
|
+
{{- if $domain }}
|
|
26
|
+
acl allowed dstdomain {{ $domain }}
|
|
27
|
+
{{- end }}
|
|
22
28
|
{{- end }}
|
|
23
29
|
acl SSL_ports port 443
|
|
24
30
|
acl CONNECT method CONNECT
|
|
@@ -105,6 +105,9 @@ egressProxy:
|
|
|
105
105
|
- .opencode.ai
|
|
106
106
|
- .npmjs.org
|
|
107
107
|
- .github.com
|
|
108
|
+
# Domains added to the strict list (comma-separated, no space), set by
|
|
109
|
+
# devzone workspace egress allow (#633); empty by default
|
|
110
|
+
extraDomains: ""
|
|
108
111
|
image: ubuntu/squid@sha256:6a097f68bae708cedbabd6188d68c7e2e7a38cedd05a176e1cc0ba29e3bbe029
|
|
109
112
|
resources:
|
|
110
113
|
requests:
|
|
@@ -109,6 +109,8 @@ workspace_deploy() {
|
|
|
109
109
|
params="image.tag=$tag"
|
|
110
110
|
[ -z "$with_image" ] || params="$params image.repository=$repository"
|
|
111
111
|
[ "$tag" != latest ] || params="$params image.pullPolicy=Always"
|
|
112
|
+
# egress proxy settings of .devzone.modules (#633): replayed at each start and update
|
|
113
|
+
params="$params $(egress_params)"
|
|
112
114
|
chart_require workspace || return $?
|
|
113
115
|
# GitOps repository created or designated first, with its root Application
|
|
114
116
|
gitops_init || return 1
|
|
@@ -0,0 +1,184 @@
|
|
|
1
|
+
#!/usr/bin/env bash
|
|
2
|
+
# devzone workspace egress observation|strict|off|status|allow <domain>|deny <domain>
|
|
3
|
+
# (#633), sourced by manage/workspace.sh after workspace-update.sh.
|
|
4
|
+
# egress_workspace <subcommand> [domain] dispatch of the command above
|
|
5
|
+
# egress_params key=value parameters of the chart, replayed
|
|
6
|
+
# by workspace_deploy at each start and update
|
|
7
|
+
# The mode and the added domains are kept in .devzone.modules (egress=,
|
|
8
|
+
# egress_domains=, state_read and state_note of argocd-workspace.sh). Each
|
|
9
|
+
# change redeploys the workspace at the image it runs: same image tag, same
|
|
10
|
+
# Argo CD revision, the pod is not recreated. Only the devzone agent sessions
|
|
11
|
+
# started with --pod go through the proxy in strict mode. bash 3.2 (macOS).
|
|
12
|
+
|
|
13
|
+
# Base list of the chart (egressProxy.allowedDomains in values.yaml): not
|
|
14
|
+
# editable with allow or deny, changed in the chart
|
|
15
|
+
EGRESS_BASE=".opencode.ai .npmjs.org .github.com"
|
|
16
|
+
|
|
17
|
+
# Domain: lowercase letters, digits, hyphens and dots, at least one dot, an
|
|
18
|
+
# optional leading dot (subdomains); no space, comma, * or /
|
|
19
|
+
egress_domain_ok() {
|
|
20
|
+
printf '%s\n' "$1" | grep -Eq '^\.?[a-z0-9-]+(\.[a-z0-9-]+)+$'
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
# Chart parameters of the proxy from .devzone.modules: nothing when off (or
|
|
24
|
+
# unset), else enabled, mode and the added domains (comma-separated)
|
|
25
|
+
egress_params() {
|
|
26
|
+
local mode domains
|
|
27
|
+
mode="$(state_read egress)"
|
|
28
|
+
case "$mode" in
|
|
29
|
+
observation | strict) ;;
|
|
30
|
+
*) return 0 ;;
|
|
31
|
+
esac
|
|
32
|
+
printf 'egressProxy.enabled=true egressProxy.mode=%s' "$mode"
|
|
33
|
+
domains="$(state_read egress_domains)"
|
|
34
|
+
if [ -n "$domains" ]; then printf ' egressProxy.extraDomains=%s' "$domains"; fi
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
# Waits for the proxy after the redeploy. Argo CD creates its Deployment a few
|
|
38
|
+
# seconds to a minute after the sync: the Deployment is looked up every
|
|
39
|
+
# DEVZONE_EGRESS_PAS s (3 by default) up to DEVZONE_EGRESS_WAIT s (90 by
|
|
40
|
+
# default); then its rollout is awaited for DEVZONE_EGRESS_ROLLOUT s (120 by
|
|
41
|
+
# default). Returns 1 when either is not reached.
|
|
42
|
+
egress_wait_proxy() {
|
|
43
|
+
local limit="${DEVZONE_EGRESS_WAIT:-90}" rollout="${DEVZONE_EGRESS_ROLLOUT:-120}" pas="${DEVZONE_EGRESS_PAS:-3}" attendu=0
|
|
44
|
+
until ak -n "$NAMESPACE" get deployment devzone-workspace-egress-proxy >/dev/null 2>&1; do
|
|
45
|
+
if [ "$attendu" -ge "$limit" ]; then
|
|
46
|
+
echo "⚠ the egress proxy was not created by Argo CD after $limit s: the setting is kept, check devzone workspace argocd status" >&2
|
|
47
|
+
return 1
|
|
48
|
+
fi
|
|
49
|
+
if [ $((limit - attendu)) -lt "$pas" ]; then pas=$((limit - attendu)); fi
|
|
50
|
+
sleep "$pas"
|
|
51
|
+
attendu=$((attendu + pas))
|
|
52
|
+
done
|
|
53
|
+
if ! ak -n "$NAMESPACE" rollout status deployment/devzone-workspace-egress-proxy --timeout="${rollout}s"; then
|
|
54
|
+
echo "⚠ egress proxy not ready after $rollout s: the setting is kept, see devzone workspace egress status" >&2
|
|
55
|
+
return 1
|
|
56
|
+
fi
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
# Redeploys the workspace at the image of the current Argo CD Application
|
|
60
|
+
# (targetRevision and image.tag, as update_current); then waits for the proxy
|
|
61
|
+
# when it is on. Without Application (helm direct), the setting is only kept:
|
|
62
|
+
# devzone workspace start applies it.
|
|
63
|
+
egress_redeploy() {
|
|
64
|
+
local rev tag
|
|
65
|
+
read -r rev tag <<<"$(update_current)" || true
|
|
66
|
+
if [ -z "$rev" ] || [ -z "$tag" ]; then
|
|
67
|
+
echo "ℹ no Argo CD Application: the setting is kept, devzone workspace start applies it"
|
|
68
|
+
return 0
|
|
69
|
+
fi
|
|
70
|
+
export DEVZONE_ARGOCD_REVISION="$rev"
|
|
71
|
+
workspace_deploy "$IMAGE_REPO" "$tag" "" || return 1
|
|
72
|
+
if [ -n "$(egress_params)" ]; then
|
|
73
|
+
echo "▶ waiting for the egress proxy…"
|
|
74
|
+
egress_wait_proxy || return 1
|
|
75
|
+
fi
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
# observation | strict | off: memorised, then the workspace is redeployed
|
|
79
|
+
egress_set_mode() {
|
|
80
|
+
kube_ready_reason --hint >&2 || return 1
|
|
81
|
+
state_note egress "$1"
|
|
82
|
+
egress_redeploy || return 1
|
|
83
|
+
echo "✔ egress $1"
|
|
84
|
+
if [ "$1" = strict ]; then
|
|
85
|
+
echo "ℹ strict: only the devzone agent sessions started with --pod are filtered; the workspace stays open"
|
|
86
|
+
fi
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
# allow | deny <domain>: the list of added domains has no duplicate; deny only
|
|
90
|
+
# removes what was added, never the base list
|
|
91
|
+
egress_domain_edit() {
|
|
92
|
+
local action="$1" domain="$2" list new base=no present=no
|
|
93
|
+
if ! egress_domain_ok "$domain"; then
|
|
94
|
+
echo "✖ domain not valid: $domain (lowercase letters, digits, hyphens and dots, at least one dot, optional leading dot; no space, comma, * or /)" >&2
|
|
95
|
+
return 1
|
|
96
|
+
fi
|
|
97
|
+
case " $EGRESS_BASE " in *" $domain "*) base=yes ;; esac
|
|
98
|
+
list="$(state_read egress_domains)"
|
|
99
|
+
case ",$list," in *",$domain,"*) present=yes ;; esac
|
|
100
|
+
if [ "$action" = allow ]; then
|
|
101
|
+
if [ "$base" = yes ]; then
|
|
102
|
+
echo "ℹ $domain is in the base list (egressProxy.allowedDomains): already allowed"
|
|
103
|
+
return 0
|
|
104
|
+
fi
|
|
105
|
+
if [ "$present" = yes ]; then
|
|
106
|
+
echo "ℹ already allowed: $domain"
|
|
107
|
+
return 0
|
|
108
|
+
fi
|
|
109
|
+
new="${list:+$list,}$domain"
|
|
110
|
+
else
|
|
111
|
+
if [ "$base" = yes ]; then
|
|
112
|
+
echo "✖ $domain is in the base list: change it in egressProxy.allowedDomains of the chart (nothing changed)" >&2
|
|
113
|
+
return 1
|
|
114
|
+
fi
|
|
115
|
+
if [ "$present" = no ]; then
|
|
116
|
+
echo "✖ $domain was not added with allow: nothing changed" >&2
|
|
117
|
+
return 1
|
|
118
|
+
fi
|
|
119
|
+
new="$(printf '%s' "$list" | tr ',' '\n' | grep -vxF -- "$domain" | paste -sd, -)" || new=""
|
|
120
|
+
fi
|
|
121
|
+
kube_ready_reason --hint >&2 || return 1
|
|
122
|
+
state_note egress_domains "$new"
|
|
123
|
+
echo "✔ $action $domain"
|
|
124
|
+
egress_redeploy
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
# Mode of the proxy (label of its Service, off when none), readiness, number of
|
|
128
|
+
# allowed domains (ACL lines of the ConfigMap), then the domains contacted in
|
|
129
|
+
# the last 2000 lines of the access log: count and state (allowed, refused, or
|
|
130
|
+
# observed in observation mode). Columns of the squid native log: 4 result, 6
|
|
131
|
+
# method, 7 host:port.
|
|
132
|
+
egress_status() {
|
|
133
|
+
local mode ready count table
|
|
134
|
+
kube_ready_reason --hint >&2 || return 1
|
|
135
|
+
mode="$(ak -n "$NAMESPACE" get service egress-proxy -o 'jsonpath={.metadata.labels.devzone\.io/egress-mode}' 2>/dev/null)" || mode=""
|
|
136
|
+
if [ -z "$mode" ]; then
|
|
137
|
+
echo "egress off"
|
|
138
|
+
return 0
|
|
139
|
+
fi
|
|
140
|
+
ready="$(ak -n "$NAMESPACE" get deployment devzone-workspace-egress-proxy -o 'jsonpath={.status.readyReplicas}' 2>/dev/null || true)"
|
|
141
|
+
if [ "${ready:-0}" -ge 1 ] 2>/dev/null; then ready="ready"; else ready="not ready"; fi
|
|
142
|
+
count="$(ak -n "$NAMESPACE" get configmap devzone-workspace-egress-proxy -o 'jsonpath={.data.squid\.conf}' 2>/dev/null |
|
|
143
|
+
grep -c 'acl allowed dstdomain ' || true)"
|
|
144
|
+
echo "egress $mode, proxy $ready, allowed domains: ${count:-0}"
|
|
145
|
+
table="$(ak -n "$NAMESPACE" logs deployment/devzone-workspace-egress-proxy -c access-log --tail=2000 2>/dev/null |
|
|
146
|
+
awk -v mode="$mode" '
|
|
147
|
+
$6 == "CONNECT" {
|
|
148
|
+
host = $7
|
|
149
|
+
sub(/:[0-9]+$/, "", host)
|
|
150
|
+
hits[host]++
|
|
151
|
+
if ($4 ~ /DENIED/) refused[host] = 1
|
|
152
|
+
}
|
|
153
|
+
END {
|
|
154
|
+
for (h in hits) {
|
|
155
|
+
state = refused[h] ? "refused" : (mode == "observation" ? "observed" : "allowed")
|
|
156
|
+
printf " %-40s %6d %s\n", h, hits[h], state
|
|
157
|
+
}
|
|
158
|
+
}' | sort)" || table=""
|
|
159
|
+
if [ -z "$table" ]; then
|
|
160
|
+
echo " no domain contacted in the recent log"
|
|
161
|
+
else
|
|
162
|
+
printf ' %-40s %6s %s\n' domain accesses state
|
|
163
|
+
echo "$table"
|
|
164
|
+
fi
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
# Dispatch of devzone workspace egress
|
|
168
|
+
egress_workspace() {
|
|
169
|
+
case "${1:-}" in
|
|
170
|
+
observation | strict | off) egress_set_mode "$1" ;;
|
|
171
|
+
status) egress_status ;;
|
|
172
|
+
allow | deny)
|
|
173
|
+
if [ "$#" -ne 2 ]; then
|
|
174
|
+
echo "✖ egress $1 takes one domain: devzone workspace egress $1 <domain>" >&2
|
|
175
|
+
return 1
|
|
176
|
+
fi
|
|
177
|
+
egress_domain_edit "$1" "$2"
|
|
178
|
+
;;
|
|
179
|
+
*)
|
|
180
|
+
echo "✖ unknown egress argument: ${1:-none} (devzone workspace egress observation|strict|off|status|allow <domain>|deny <domain>)" >&2
|
|
181
|
+
return 1
|
|
182
|
+
;;
|
|
183
|
+
esac
|
|
184
|
+
}
|
package/manage/workspace.sh
CHANGED
|
@@ -28,9 +28,7 @@ kubectl_flag() {
|
|
|
28
28
|
}
|
|
29
29
|
|
|
30
30
|
# Chart path in the repository (or installed package).
|
|
31
|
-
chart_path() {
|
|
32
|
-
printf '%s/charts/devzone-workspace' "$ROOT"
|
|
33
|
-
}
|
|
31
|
+
chart_path() { printf '%s/charts/devzone-workspace' "$ROOT"; }
|
|
34
32
|
|
|
35
33
|
# Repository of the image published at each devzone release.
|
|
36
34
|
IMAGE_REPO="ghcr.io/simbienvenuehoulboumi/devzone-workspace"
|
|
@@ -99,9 +97,9 @@ workspace_helm_deploy() {
|
|
|
99
97
|
args+=(--set "image.tag=$tag")
|
|
100
98
|
# latest moves at every release: an image already on the node would stay
|
|
101
99
|
# the old one with IfNotPresent (#515)
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
100
|
+
[ "$tag" != latest ] || args+=(--set "image.pullPolicy=Always")
|
|
101
|
+
# egress proxy settings (#633), replayed at each start: commas escaped for helm
|
|
102
|
+
for p in $(egress_params | sed 's/,/\\,/g'); do args+=(--set "$p"); done
|
|
105
103
|
# shellcheck disable=SC2046
|
|
106
104
|
helm $(helm_flag) upgrade --install devzone-workspace "$(chart_path)" "${args[@]}"
|
|
107
105
|
}
|
|
@@ -191,6 +189,8 @@ copy_from() {
|
|
|
191
189
|
. "$HERE/scripts/argocd-services.sh"
|
|
192
190
|
# shellcheck source=manage/scripts/workspace-update.sh
|
|
193
191
|
. "$HERE/scripts/workspace-update.sh"
|
|
192
|
+
# shellcheck source=manage/scripts/workspace-egress.sh
|
|
193
|
+
. "$HERE/scripts/workspace-egress.sh"
|
|
194
194
|
|
|
195
195
|
# English command names are accepted, French ones unchanged and warned (#502,
|
|
196
196
|
# #532). A copied devzone may miss the aliases file: then no normalization.
|
|
@@ -206,9 +206,7 @@ if [ -f "$ROOT/.devcontainer/command-aliases.sh" ]; then
|
|
|
206
206
|
fi
|
|
207
207
|
fi
|
|
208
208
|
|
|
209
|
-
if [ "$#" -gt 0 ]; then
|
|
210
|
-
set -- "$(workspace_command "$1")" "${@:2}"
|
|
211
|
-
fi
|
|
209
|
+
if [ "$#" -gt 0 ]; then set -- "$(workspace_command "$1")" "${@:2}"; fi
|
|
212
210
|
if [ "${1:-}" = "ports" ] && [ "$#" -gt 1 ]; then
|
|
213
211
|
set -- "$1" "$(workspace_ports_command "$2")" "${@:3}"
|
|
214
212
|
fi
|
|
@@ -229,8 +227,9 @@ case "${1:-}" in
|
|
|
229
227
|
clean-docker) clean_docker "${@:2}" ;;
|
|
230
228
|
services) services "${@:2}" ;;
|
|
231
229
|
argocd) argocd_cmd "${@:2}" ;;
|
|
230
|
+
egress) egress_workspace "${@:2}" ;;
|
|
232
231
|
'' | -h | --help | aide)
|
|
233
|
-
echo "devzone workspace start|stop|status|shell|vscode|copy-to|copy-from|clone|ports|services|argocd|migrate|revert|clean-docker|update"
|
|
232
|
+
echo "devzone workspace start|stop|status|shell|vscode|copy-to|copy-from|clone|ports|services|argocd|migrate|revert|clean-docker|update|egress"
|
|
234
233
|
echo " start [--image repository:tag] install workspace (image for devzone version by default)"
|
|
235
234
|
echo " update [--version X.Y.Z] [--yes] move to the latest stable release (or X.Y.Z); the pod is recreated"
|
|
236
235
|
echo " clone <url> [<name>] git clone into the pod projects folder (gh credentials, identity, repowarden hooks)"
|
|
@@ -242,6 +241,7 @@ case "${1:-}" in
|
|
|
242
241
|
echo " migrate [--yes] copy Docker workstation to Kubernetes workspace (nothing is deleted)"
|
|
243
242
|
echo " revert [--bring-back] back to Docker workstation; --bring-back: copy pod projects first"
|
|
244
243
|
echo " clean-docker remove devzone-* Docker volumes, after confirmation [y/N] (--yes)"
|
|
244
|
+
echo " egress observation|strict|off|status|allow <domain>|deny <domain> egress proxy of the agent sessions (--pod)"
|
|
245
245
|
;;
|
|
246
246
|
*)
|
|
247
247
|
echo "✖ unknown subcommand: $1 (devzone workspace start|stop|status|shell|vscode|copy-to|copy-from|clone|ports|services|argocd|migrate|revert|clean-docker|update)" >&2
|