devzone 0.36.6 → 0.37.0
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/argocd/application.sh +69 -0
- package/.devcontainer/argocd/apps.sh +262 -0
- package/.devcontainer/argocd/argocd.sh +46 -1
- package/.devcontainer/argocd/conf.sh +141 -0
- package/.devcontainer/argocd/gitops.sh +214 -0
- package/.devcontainer/argocd/values.yaml +4 -0
- package/.devcontainer/devzone +75 -4
- package/.devcontainer/etat-json.sh +13 -1
- package/.devcontainer/services-admin.sh +105 -0
- package/README.md +30 -30
- package/charts/devzone-postgres/Chart.yaml +6 -0
- package/charts/devzone-postgres/templates/service.yaml +15 -0
- package/charts/devzone-postgres/templates/statefulset.yaml +56 -0
- package/charts/devzone-postgres/values.yaml +11 -0
- package/manage/devzone +11 -6
- package/manage/scripts/argocd-services.sh +243 -0
- package/manage/scripts/argocd-workspace.sh +219 -0
- package/manage/scripts/ports-workspace.sh +17 -10
- package/manage/scripts/services-workspace.sh +162 -0
- package/manage/scripts/workspace-wait.sh +2 -2
- package/manage/workspace.sh +28 -7
- package/package.json +1 -1
|
@@ -0,0 +1,214 @@
|
|
|
1
|
+
#!/usr/bin/env bash
|
|
2
|
+
# GitOps repository of the user for the Argo CD of devzone (#516):
|
|
3
|
+
# <login>/devzone-argocd on GitHub, private, written through the GitHub API
|
|
4
|
+
# (gh: no clone, no local commit). A root Application "devzone" follows its
|
|
5
|
+
# apps/ folder: every Application devzone declares (workspace, services,
|
|
6
|
+
# projects) is a file apps/<name>.yaml there, so the cluster is rebuilt from
|
|
7
|
+
# Git. Without a repository (gh not logged in, or argocd_repo=none in the
|
|
8
|
+
# state), the Applications are applied directly, as before.
|
|
9
|
+
# gitops_init [--repo <url>] [--none] creates or designates the repository
|
|
10
|
+
# gitops_enabled a repository is designated
|
|
11
|
+
# gitops_root repository Secret and root Application
|
|
12
|
+
# gitops_apply_application <generator args> file in Git (or direct apply)
|
|
13
|
+
# gitops_delete_application <name> [keep] file removed and Application deleted
|
|
14
|
+
# gitops_direct_delete_application <name> [keep] cluster only, the file stays
|
|
15
|
+
# The includer defines argocd_kubectl, APPS_GENERATOR, GITOPS_CMD (how init
|
|
16
|
+
# is spelled there) and ARGOCD_CONF (conf.sh): the repository is the key repo
|
|
17
|
+
# of the section [argocd] of .argocd.conf.
|
|
18
|
+
# Argo CD reads the repository with the gh token of the user
|
|
19
|
+
# (DEVZONE_GITOPS_TOKEN for another one). GitLab as the GitOps repository:
|
|
20
|
+
# lot B. bash 3.2 (macOS).
|
|
21
|
+
|
|
22
|
+
GITOPS_NS="devzone-argocd"
|
|
23
|
+
GITOPS_ROOT_APP="devzone"
|
|
24
|
+
GITOPS_REPO_NAME="${DEVZONE_GITOPS_REPO_NAME:-devzone-argocd}"
|
|
25
|
+
: "${GITOPS_CMD:=devzone argocd init}"
|
|
26
|
+
|
|
27
|
+
gitops_repo() { conf_get argocd repo; }
|
|
28
|
+
gitops_repo_note() { conf_set argocd "repo=$1"; }
|
|
29
|
+
|
|
30
|
+
gitops_enabled() {
|
|
31
|
+
local r
|
|
32
|
+
r="$(gitops_repo)"
|
|
33
|
+
[ -n "$r" ] && [ "$r" != none ]
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
# owner/name of the GitHub repository
|
|
37
|
+
gitops_slug() {
|
|
38
|
+
local r
|
|
39
|
+
r="$(gitops_repo)"
|
|
40
|
+
r="${r#https://github.com/}"
|
|
41
|
+
printf '%s' "${r%.git}"
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
# Creates <login>/devzone-argocd when missing (private) and notes its URL;
|
|
45
|
+
# --repo: an existing GitHub repository; --none: no GitOps repository,
|
|
46
|
+
# Applications applied directly. Without gh logged in: a notice, state kept
|
|
47
|
+
gitops_init() {
|
|
48
|
+
local repo="" expect="" arg login slug
|
|
49
|
+
for arg in "$@"; do
|
|
50
|
+
if [ "$expect" = repo ]; then repo="$arg"; expect=""; continue; fi
|
|
51
|
+
case "$arg" in
|
|
52
|
+
--none)
|
|
53
|
+
gitops_repo_note none
|
|
54
|
+
echo "✔ no GitOps repository: the Applications are applied directly ($GITOPS_CMD to change)"
|
|
55
|
+
return 0
|
|
56
|
+
;;
|
|
57
|
+
--repo) expect=repo ;;
|
|
58
|
+
*) echo "✖ $GITOPS_CMD [--repo https://github.com/<owner>/<name>.git] [--none]" >&2; return 2 ;;
|
|
59
|
+
esac
|
|
60
|
+
done
|
|
61
|
+
if [ -n "$expect" ]; then
|
|
62
|
+
echo "✖ --repo needs a URL" >&2
|
|
63
|
+
return 2
|
|
64
|
+
fi
|
|
65
|
+
if [ -n "$repo" ]; then
|
|
66
|
+
case "$repo" in
|
|
67
|
+
https://github.com/*/*) ;;
|
|
68
|
+
*) echo "✖ GitHub repository URL expected (https://github.com/<owner>/<name>.git): $repo" >&2; return 2 ;;
|
|
69
|
+
esac
|
|
70
|
+
gitops_repo_note "$repo"
|
|
71
|
+
echo "✔ GitOps repository: $repo ($ARGOCD_CONF)"
|
|
72
|
+
return 0
|
|
73
|
+
fi
|
|
74
|
+
if gitops_enabled; then
|
|
75
|
+
return 0
|
|
76
|
+
fi
|
|
77
|
+
if ! gh auth status >/dev/null 2>&1; then
|
|
78
|
+
echo "ℹ GitHub not connected (gh auth login): no GitOps repository, the Applications are applied directly; $GITOPS_CMD --none to stop this notice"
|
|
79
|
+
return 0
|
|
80
|
+
fi
|
|
81
|
+
login="$(gh api user --jq .login 2>/dev/null)" || login=""
|
|
82
|
+
if [ -z "$login" ]; then
|
|
83
|
+
echo "⚠ GitHub login unreadable (gh api user): Applications applied directly" >&2
|
|
84
|
+
return 0
|
|
85
|
+
fi
|
|
86
|
+
slug="$login/$GITOPS_REPO_NAME"
|
|
87
|
+
if ! gh repo view "$slug" --json name >/dev/null 2>&1; then
|
|
88
|
+
if ! gh repo create "$slug" --private --description "GitOps repository of devzone: the Applications Argo CD holds (workspace, services, projects)" >/dev/null; then
|
|
89
|
+
echo "✖ cannot create the GitOps repository $slug" >&2
|
|
90
|
+
return 1
|
|
91
|
+
fi
|
|
92
|
+
echo "✔ GitOps repository created: https://github.com/$slug (private)"
|
|
93
|
+
fi
|
|
94
|
+
gitops_repo_note "https://github.com/$slug.git"
|
|
95
|
+
gitops_put_text README.md "# devzone-argocd
|
|
96
|
+
|
|
97
|
+
GitOps repository of devzone, written by the devzone commands (never by hand): the Argo CD of devzone follows the apps/ folder, one Application per file (the workspace, the services, the projects added with argocd app add). Removing a file removes the Application and its resources.
|
|
98
|
+
" "devzone: GitOps repository"
|
|
99
|
+
gitops_put_text apps/.gitkeep "" "devzone: apps folder"
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
# Blob sha of a file (git), to skip a write that changes nothing
|
|
103
|
+
gitops_blob() { git hash-object "$1" 2>/dev/null || true; }
|
|
104
|
+
|
|
105
|
+
gitops_sha() {
|
|
106
|
+
gh api "repos/$(gitops_slug)/contents/$1" --jq .sha 2>/dev/null || true
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
# Writes <file> at <path> of the repository (create or update), <message>
|
|
110
|
+
gitops_put() {
|
|
111
|
+
local path="$1" file="$2" message="$3" slug sha content
|
|
112
|
+
slug="$(gitops_slug)"
|
|
113
|
+
sha="$(gitops_sha "$path")"
|
|
114
|
+
if [ -n "$sha" ] && [ "$sha" = "$(gitops_blob "$file")" ]; then
|
|
115
|
+
return 0
|
|
116
|
+
fi
|
|
117
|
+
content="$(base64 <"$file" | tr -d '\n')"
|
|
118
|
+
if [ -n "$sha" ]; then
|
|
119
|
+
gh api -X PUT "repos/$slug/contents/$path" -f message="$message" -f content="$content" -f sha="$sha" >/dev/null
|
|
120
|
+
else
|
|
121
|
+
gh api -X PUT "repos/$slug/contents/$path" -f message="$message" -f content="$content" >/dev/null
|
|
122
|
+
fi
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
gitops_put_text() {
|
|
126
|
+
local tmp
|
|
127
|
+
tmp="$(mktemp)"
|
|
128
|
+
printf '%s' "$2" >"$tmp"
|
|
129
|
+
gitops_put "$1" "$tmp" "$3"
|
|
130
|
+
rm -f "$tmp"
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
gitops_delete() {
|
|
134
|
+
local path="$1" message="$2" sha
|
|
135
|
+
sha="$(gitops_sha "$path")"
|
|
136
|
+
[ -n "$sha" ] || return 0
|
|
137
|
+
gh api -X DELETE "repos/$(gitops_slug)/contents/$path" -f message="$message" -f sha="$sha" >/dev/null
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
# Repository Secret (token of gh) and root Application "devzone" on apps/
|
|
141
|
+
gitops_root() {
|
|
142
|
+
local url token
|
|
143
|
+
gitops_enabled || return 0
|
|
144
|
+
url="$(gitops_repo)"
|
|
145
|
+
token="${DEVZONE_GITOPS_TOKEN:-$(gh auth token 2>/dev/null || true)}"
|
|
146
|
+
if [ -n "$token" ]; then
|
|
147
|
+
argocd_kubectl -n "$GITOPS_NS" apply -f - >/dev/null <<EOF
|
|
148
|
+
apiVersion: v1
|
|
149
|
+
kind: Secret
|
|
150
|
+
metadata:
|
|
151
|
+
name: repo-$GITOPS_REPO_NAME
|
|
152
|
+
namespace: $GITOPS_NS
|
|
153
|
+
labels:
|
|
154
|
+
argocd.argoproj.io/secret-type: repository
|
|
155
|
+
app.kubernetes.io/managed-by: devzone
|
|
156
|
+
type: Opaque
|
|
157
|
+
stringData:
|
|
158
|
+
type: git
|
|
159
|
+
url: $url
|
|
160
|
+
username: devzone
|
|
161
|
+
password: $token
|
|
162
|
+
EOF
|
|
163
|
+
else
|
|
164
|
+
echo "⚠ no GitHub token for Argo CD (gh auth token): a private repository will not sync; DEVZONE_GITOPS_TOKEN=<token>" >&2
|
|
165
|
+
fi
|
|
166
|
+
bash "$APPS_GENERATOR" "$GITOPS_ROOT_APP" root "$GITOPS_NS" "$url" HEAD apps |
|
|
167
|
+
argocd_kubectl apply -f - >/dev/null
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
# Argo CD reads Git every 3 min: a refresh of the root Application right away
|
|
171
|
+
gitops_refresh() {
|
|
172
|
+
argocd_kubectl -n "$GITOPS_NS" annotate application.argoproj.io "$GITOPS_ROOT_APP" \
|
|
173
|
+
argocd.argoproj.io/refresh=normal --overwrite >/dev/null 2>&1 || true
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
gitops_apply_application() {
|
|
177
|
+
local name="$1" tmp
|
|
178
|
+
if ! gitops_enabled; then
|
|
179
|
+
bash "$APPS_GENERATOR" "$@" | argocd_kubectl apply -f - >/dev/null
|
|
180
|
+
return
|
|
181
|
+
fi
|
|
182
|
+
tmp="$(mktemp)"
|
|
183
|
+
if ! bash "$APPS_GENERATOR" "$@" >"$tmp"; then
|
|
184
|
+
rm -f "$tmp"
|
|
185
|
+
return 1
|
|
186
|
+
fi
|
|
187
|
+
if ! gitops_put "apps/$name.yaml" "$tmp" "devzone: application $name"; then
|
|
188
|
+
rm -f "$tmp"
|
|
189
|
+
return 1
|
|
190
|
+
fi
|
|
191
|
+
rm -f "$tmp"
|
|
192
|
+
gitops_refresh
|
|
193
|
+
}
|
|
194
|
+
|
|
195
|
+
# keep: finalizer dropped first, the resources stay
|
|
196
|
+
gitops_direct_delete_application() {
|
|
197
|
+
local name="$1" mode="${2:-cascade}"
|
|
198
|
+
if [ "$mode" = keep ]; then
|
|
199
|
+
argocd_kubectl -n "$GITOPS_NS" patch application.argoproj.io "$name" --type merge \
|
|
200
|
+
-p '{"metadata":{"finalizers":null}}' >/dev/null 2>&1 || true
|
|
201
|
+
fi
|
|
202
|
+
argocd_kubectl -n "$GITOPS_NS" delete application.argoproj.io "$name" --ignore-not-found --wait=true >/dev/null
|
|
203
|
+
}
|
|
204
|
+
|
|
205
|
+
# The file leaves Git first (so that the root Application never recreates
|
|
206
|
+
# the child), then the Application is deleted right away
|
|
207
|
+
gitops_delete_application() {
|
|
208
|
+
local name="$1" mode="${2:-cascade}"
|
|
209
|
+
if gitops_enabled; then
|
|
210
|
+
gitops_delete "apps/$name.yaml" "devzone: application $name removed" || return 1
|
|
211
|
+
gitops_refresh
|
|
212
|
+
fi
|
|
213
|
+
gitops_direct_delete_application "$name" "$mode"
|
|
214
|
+
}
|
|
@@ -3,6 +3,10 @@
|
|
|
3
3
|
# L'accès passe par le relais kubectl port-forward du conteneur (8443:443).
|
|
4
4
|
global:
|
|
5
5
|
domain: ""
|
|
6
|
+
# Aggregate ClusterRoles (#516): the Application resources join the edit role,
|
|
7
|
+
# so the limited devzone account (#430) manages the Applications of the
|
|
8
|
+
# projects in devzone-argocd (devzone argocd app …)
|
|
9
|
+
createAggregateRoles: true
|
|
6
10
|
dex:
|
|
7
11
|
enabled: false
|
|
8
12
|
notifications:
|
package/.devcontainer/devzone
CHANGED
|
@@ -23,6 +23,7 @@
|
|
|
23
23
|
# devzone gitlab nouveau-mdp [root|dev] mot de passe aléatoire (root ou dev) régénéré
|
|
24
24
|
# devzone activer argocd Argo CD dans le cluster des services, accès https://127.0.0.1:8443
|
|
25
25
|
# devzone argocd etat|relais-lancer|relais-arreter Argo CD (module argocd)
|
|
26
|
+
# devzone argocd app add <repo url> [path]|list|remove <N> projets déployés par Argo CD (#516)
|
|
26
27
|
# devzone cluster [CTX] [--oui] [--confirmer CTX] cluster des services de devzone, ou en changer
|
|
27
28
|
# devzone port [<n>|--fermer <n>] relais d'un port du conteneur vers le poste
|
|
28
29
|
# devzone mots-de-passe régénère .password et affiche son chemin
|
|
@@ -317,6 +318,60 @@ fichier_echec() {
|
|
|
317
318
|
echo "$ETAT-echec-$1"
|
|
318
319
|
}
|
|
319
320
|
|
|
321
|
+
# Services in the Kubernetes workspace pod (#528): gitlab, postgres and argocd
|
|
322
|
+
# live in the cluster and are installed from the workstation (devzone
|
|
323
|
+
# workspace services). The pod has no kubeconfig and its service account is
|
|
324
|
+
# limited (#430): their presence is the cluster DNS resolving the service,
|
|
325
|
+
# like the catalogue (#515), never the failure marker of an installer.
|
|
326
|
+
dans_pod() {
|
|
327
|
+
[ "${DEVZONE_WORKSPACE:-}" = kubernetes ]
|
|
328
|
+
}
|
|
329
|
+
|
|
330
|
+
service_module() {
|
|
331
|
+
case "$1" in
|
|
332
|
+
gitlab | postgres | argocd) return 0 ;;
|
|
333
|
+
esac
|
|
334
|
+
return 1
|
|
335
|
+
}
|
|
336
|
+
|
|
337
|
+
# DNS name of the service of a module: <service>.<namespace>.svc
|
|
338
|
+
service_dns() {
|
|
339
|
+
case "$1" in
|
|
340
|
+
gitlab) echo "gitlab-webservice-default.devzone-gitlab${INSTANCE_SUFFIX}.svc" ;;
|
|
341
|
+
postgres) echo "postgres.devzone-postgres.svc" ;;
|
|
342
|
+
argocd) echo "argocd-server.devzone-argocd.svc" ;;
|
|
343
|
+
esac
|
|
344
|
+
}
|
|
345
|
+
|
|
346
|
+
service_present() {
|
|
347
|
+
getent hosts "$(service_dns "$1")" >/dev/null 2>&1
|
|
348
|
+
}
|
|
349
|
+
|
|
350
|
+
# Status line of a service module in the pod: present → active; absent → the
|
|
351
|
+
# workstation command that installs it
|
|
352
|
+
service_ligne_pod() {
|
|
353
|
+
local m="$1"
|
|
354
|
+
if service_present "$m"; then
|
|
355
|
+
printf ' ✔ module %-10s active: %s (%s)\n' "$m" "$(description "$m")" "$(service_dns "$m")"
|
|
356
|
+
elif [ "$(valeur "$m")" = on ]; then
|
|
357
|
+
printf ' ⚠ module %-10s not in the cluster: on the workstation, devzone workspace services enable %s\n' "$m" "$m"
|
|
358
|
+
else
|
|
359
|
+
printf ' ○ module %-10s optional, %s: on the workstation, devzone workspace services enable %s\n' "$m" "$(description "$m")" "$m"
|
|
360
|
+
fi
|
|
361
|
+
}
|
|
362
|
+
|
|
363
|
+
# devzone apply of a service module: in the Kubernetes workspace pod nothing
|
|
364
|
+
# is installed (the workstation does it, #528) and the failure marker of an
|
|
365
|
+
# earlier start is cleared; elsewhere, the installer of the module
|
|
366
|
+
appliquer_service() {
|
|
367
|
+
if dans_pod; then
|
|
368
|
+
rm -f "$(fichier_echec "$1")"
|
|
369
|
+
echo "devzone: $1 is installed from the workstation (devzone workspace services enable $1): nothing to do in the pod"
|
|
370
|
+
return 0
|
|
371
|
+
fi
|
|
372
|
+
"appliquer_$1" on
|
|
373
|
+
}
|
|
374
|
+
|
|
320
375
|
# Journal du dernier npm (son chemin est à donner en cas d'échec), ou son
|
|
321
376
|
# dossier ; noms horodatés : le dernier dans l'ordre du glob est le plus récent
|
|
322
377
|
dernier_journal_npm() {
|
|
@@ -1183,7 +1238,10 @@ etat() {
|
|
|
1183
1238
|
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)"
|
|
1184
1239
|
done < <(worktrees_absents)
|
|
1185
1240
|
for m in "${MODULES[@]}"; do
|
|
1186
|
-
if
|
|
1241
|
+
if dans_pod && service_module "$m"; then
|
|
1242
|
+
# Kubernetes workspace pod (#528): presence by the cluster DNS
|
|
1243
|
+
service_ligne_pod "$m"
|
|
1244
|
+
elif [ "$(valeur "$m")" = on ] && [ -f "$(fichier_echec "$m")" ]; then
|
|
1187
1245
|
printf ' ✖ module %-10s en échec : installation incomplète (%s) : devzone appliquer\n' "$m" "$(cat "$(fichier_echec "$m")")"
|
|
1188
1246
|
elif [ "$(valeur "$m")" = on ] && [ "$m" = gitlab ]; then
|
|
1189
1247
|
# GitLab actif : son état réel (prêt, runner, en échec)
|
|
@@ -1306,6 +1364,17 @@ changer() {
|
|
|
1306
1364
|
echo "devzone : module inconnu : $m ; modules : ${MODULES[*]}" >&2
|
|
1307
1365
|
exit 1
|
|
1308
1366
|
fi
|
|
1367
|
+
# In the Kubernetes workspace pod the services are installed from the
|
|
1368
|
+
# workstation (#528): the pod has no administrator access to the cluster.
|
|
1369
|
+
# DEVZONE_SERVICES_ADMIN=1: run by services-admin.sh with a temporary one.
|
|
1370
|
+
if dans_pod && service_module "$m" && [ -z "${DEVZONE_SERVICES_ADMIN:-}" ]; then
|
|
1371
|
+
if [ "$1" = on ]; then
|
|
1372
|
+
echo "devzone: in the workspace pod, $m is installed from the workstation: devzone workspace services enable $m" >&2
|
|
1373
|
+
else
|
|
1374
|
+
echo "devzone: in the workspace pod, $m is removed from the workstation: devzone workspace services disable $m" >&2
|
|
1375
|
+
fi
|
|
1376
|
+
return 2
|
|
1377
|
+
fi
|
|
1309
1378
|
if [ "$1" = off ] && { [ "$m" = postgres ] || [ "$m" = mysql ] || [ "$m" = gitlab ]; }; then
|
|
1310
1379
|
confirmer_suppression "$m" "${@:3}" || return 0
|
|
1311
1380
|
fi
|
|
@@ -1336,10 +1405,12 @@ case "${1:-}" in
|
|
|
1336
1405
|
etat_recouvrement_confirmer
|
|
1337
1406
|
appliquer_repowarden
|
|
1338
1407
|
[ "$(valeur ia)" = off ] || appliquer_ia on
|
|
1339
|
-
|
|
1340
|
-
|
|
1408
|
+
# gitlab, postgres, argocd: installed from the workstation in the
|
|
1409
|
+
# Kubernetes workspace pod (#528), by their installer elsewhere
|
|
1410
|
+
[ "$(valeur gitlab)" = off ] || appliquer_service gitlab
|
|
1411
|
+
[ "$(valeur postgres)" = off ] || appliquer_service postgres
|
|
1341
1412
|
[ "$(valeur mysql)" = off ] || appliquer_mysql on
|
|
1342
|
-
[ "$(valeur argocd)" = off ] ||
|
|
1413
|
+
[ "$(valeur argocd)" = off ] || appliquer_service argocd
|
|
1343
1414
|
;;
|
|
1344
1415
|
actif)
|
|
1345
1416
|
connu "${2:-}" || { echo "devzone : module inconnu : ${2:-(aucun)}" >&2; exit 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}"
|
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)). Argo CD y est installé d'office et tient les déploiements : interface sur https://localhost:8443 (mot de passe `admin` dans `.password`), dépôt GitOps `<login>/devzone-argocd` créé sur ton GitHub, projets déclarés dans `.argocd.conf` (`devzone workspace argocd app add <dépôt>`) ; voir [Argo CD dans le workspace Kubernetes](manage/docs/reference.md#argo-cd-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.
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
apiVersion: v1
|
|
2
|
+
kind: Service
|
|
3
|
+
metadata:
|
|
4
|
+
name: postgres
|
|
5
|
+
namespace: {{ .Release.Namespace }}
|
|
6
|
+
labels:
|
|
7
|
+
app: postgres
|
|
8
|
+
app.kubernetes.io/managed-by: devzone
|
|
9
|
+
spec:
|
|
10
|
+
selector:
|
|
11
|
+
app: postgres
|
|
12
|
+
ports:
|
|
13
|
+
- name: postgres
|
|
14
|
+
port: 5432
|
|
15
|
+
targetPort: 5432
|