underpost 2.89.37 → 2.89.45

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.
Files changed (42) hide show
  1. package/README.md +3 -2
  2. package/bin/deploy.js +22 -15
  3. package/cli.md +89 -61
  4. package/manifests/deployment/dd-default-development/deployment.yaml +2 -2
  5. package/manifests/deployment/dd-test-development/deployment.yaml +6 -2
  6. package/manifests/deployment/dd-test-development/proxy.yaml +2 -0
  7. package/manifests/deployment/kafka/deployment.yaml +0 -2
  8. package/manifests/deployment/spark/spark-pi-py.yaml +0 -1
  9. package/manifests/deployment/tensorflow/tf-gpu-test.yaml +0 -2
  10. package/manifests/envoy-service-nodeport.yaml +0 -1
  11. package/manifests/kubeadm-calico-config.yaml +10 -115
  12. package/manifests/letsencrypt-prod.yaml +0 -1
  13. package/manifests/mariadb/statefulset.yaml +1 -1
  14. package/manifests/mongodb/statefulset.yaml +11 -11
  15. package/manifests/mongodb-4.4/service-deployment.yaml +1 -3
  16. package/manifests/mysql/pv-pvc.yaml +1 -1
  17. package/manifests/mysql/statefulset.yaml +1 -1
  18. package/manifests/valkey/service.yaml +0 -1
  19. package/manifests/valkey/statefulset.yaml +2 -3
  20. package/package.json +1 -1
  21. package/scripts/device-scan.sh +43 -21
  22. package/scripts/rpmfusion-ffmpeg-setup.sh +1 -0
  23. package/src/cli/cluster.js +58 -57
  24. package/src/cli/deploy.js +51 -89
  25. package/src/cli/index.js +30 -3
  26. package/src/cli/monitor.js +12 -6
  27. package/src/cli/repository.js +1 -1
  28. package/src/cli/run.js +32 -19
  29. package/src/client/components/core/Logger.js +1 -1
  30. package/src/client/components/core/Modal.js +5 -0
  31. package/src/client/components/core/ObjectLayerEngineModal.js +334 -71
  32. package/src/client/components/core/ObjectLayerEngineViewer.js +170 -403
  33. package/src/client/components/core/Router.js +10 -1
  34. package/src/client/services/default/default.management.js +25 -5
  35. package/src/index.js +1 -1
  36. package/src/server/client-build.js +5 -4
  37. package/src/server/conf.js +1 -1
  38. package/manifests/kubelet-config.yaml +0 -65
  39. package/manifests/mongodb/backup-access.yaml +0 -16
  40. package/manifests/mongodb/backup-cronjob.yaml +0 -42
  41. package/manifests/mongodb/backup-pv-pvc.yaml +0 -22
  42. package/manifests/mongodb/configmap.yaml +0 -26
@@ -3,7 +3,7 @@ kind: StatefulSet
3
3
  metadata:
4
4
  name: mongodb # Specifies the name of the statefulset
5
5
  spec:
6
- serviceName: "mongodb-service" # Specifies the service to use
6
+ serviceName: 'mongodb-service' # Specifies the service to use
7
7
  replicas: 2
8
8
  selector:
9
9
  matchLabels:
@@ -18,8 +18,8 @@ spec:
18
18
  image: docker.io/library/mongo:latest
19
19
  command:
20
20
  - mongod
21
- - "--replSet"
22
- - "rs0"
21
+ - '--replSet'
22
+ - 'rs0'
23
23
  # - '--config'
24
24
  # - '-f'
25
25
  # - '/etc/mongod.conf'
@@ -35,9 +35,9 @@ spec:
35
35
  # - '--setParameter'
36
36
  # - 'authenticationMechanisms=SCRAM-SHA-1'
37
37
  # - '--fork'
38
- - "--logpath"
39
- - "/var/log/mongodb/mongod.log"
40
- - "--bind_ip_all"
38
+ - '--logpath'
39
+ - '/var/log/mongodb/mongod.log'
40
+ - '--bind_ip_all'
41
41
  # command: ['sh', '-c']
42
42
  # args:
43
43
  # - |
@@ -99,11 +99,11 @@ spec:
99
99
  key: password
100
100
  resources:
101
101
  requests:
102
- cpu: "100m"
103
- memory: "256Mi"
102
+ cpu: '100m'
103
+ memory: '256Mi'
104
104
  limits:
105
- cpu: "500m"
106
- memory: "512Mi"
105
+ cpu: '500m'
106
+ memory: '512Mi'
107
107
  volumes:
108
108
  - name: keyfile
109
109
  secret:
@@ -119,7 +119,7 @@ spec:
119
119
  - metadata:
120
120
  name: mongodb-storage
121
121
  spec:
122
- accessModes: ["ReadWriteOnce"]
122
+ accessModes: ['ReadWriteOnce']
123
123
  storageClassName: mongodb-storage-class
124
124
  resources:
125
125
  requests:
@@ -2,7 +2,6 @@ apiVersion: apps/v1
2
2
  kind: Deployment
3
3
  metadata:
4
4
  name: mongodb-deployment
5
- namespace: default
6
5
  spec:
7
6
  selector:
8
7
  matchLabels:
@@ -17,7 +16,7 @@ spec:
17
16
  containers:
18
17
  - name: mongodb
19
18
  image: mongo:4.4
20
- command: ["mongod", "--replSet", "rs0", "--bind_ip_all"]
19
+ command: ['mongod', '--replSet', 'rs0', '--bind_ip_all']
21
20
  # -- bash
22
21
  # mongo
23
22
  # use admin
@@ -43,7 +42,6 @@ apiVersion: v1
43
42
  kind: Service
44
43
  metadata:
45
44
  name: mongodb-service
46
- namespace: default
47
45
  spec:
48
46
  clusterIP: None
49
47
  selector:
@@ -12,7 +12,7 @@ spec:
12
12
  accessModes:
13
13
  - ReadWriteOnce
14
14
  hostPath:
15
- path: "/mnt/data"
15
+ path: '/mnt/data'
16
16
  ---
17
17
  apiVersion: v1
18
18
  kind: PersistentVolumeClaim
@@ -17,7 +17,7 @@ kind: StatefulSet
17
17
  metadata:
18
18
  name: mysql
19
19
  spec:
20
- serviceName: "mysql"
20
+ serviceName: 'mysql'
21
21
  selector:
22
22
  matchLabels:
23
23
  app: mysql
@@ -2,7 +2,6 @@ apiVersion: v1
2
2
  kind: Service
3
3
  metadata:
4
4
  name: valkey-service
5
- namespace: default
6
5
  spec:
7
6
  selector:
8
7
  app: valkey-service
@@ -2,7 +2,6 @@ apiVersion: apps/v1
2
2
  kind: StatefulSet
3
3
  metadata:
4
4
  name: valkey-service
5
- namespace: default
6
5
  spec:
7
6
  serviceName: valkey-service
8
7
  replicas: 1
@@ -19,8 +18,8 @@ spec:
19
18
  - name: valkey-service
20
19
  image: docker.io/valkey/valkey:latest
21
20
  imagePullPolicy: IfNotPresent
22
- command: ["valkey-server"]
23
- args: ["--port", "6379"]
21
+ command: ['valkey-server']
22
+ args: ['--port', '6379']
24
23
  ports:
25
24
  - containerPort: 6379
26
25
  startupProbe:
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "type": "module",
3
3
  "main": "src/index.js",
4
4
  "name": "underpost",
5
- "version": "2.89.37",
5
+ "version": "2.89.45",
6
6
  "description": "pwa api rest template",
7
7
  "scripts": {
8
8
  "start": "env-cmd -f .env.production node --max-old-space-size=8192 src/server",
@@ -1,26 +1,42 @@
1
1
  #!/usr/bin/env bash
2
+ set -u -o pipefail
2
3
 
3
4
  for iface_path in /sys/class/net/*; do
5
+ [ -e "$iface_path" ] || continue
4
6
  name=$(basename "$iface_path")
5
- mac=$(< "$iface_path/address")
6
- ip=$(ip -4 addr show dev "$name" \
7
- | grep -oP '(?<=inet\s)\d+(\.\d+){3}' || echo "—")
8
- operstate=$(< "$iface_path/operstate")
9
- mtu=$(< "$iface_path/mtu")
10
-
11
- # Driver
12
- if [ -L "$iface_path/device/driver" ]; then
7
+
8
+ # MAC address
9
+ if [ -r "$iface_path/address" ]; then
10
+ mac=$(< "$iface_path/address")
11
+ else
12
+ mac="—"
13
+ fi
14
+
15
+ # IPv4: collect all IPv4 CIDRs, strip masks, join with commas (or show —)
16
+ ip_info=$(ip -4 -o addr show dev "$name" 2>/dev/null | awk '{print $4}')
17
+ if [ -n "$ip_info" ]; then
18
+ # Use word-splitting intentionally to iterate lines from ip_info
19
+ ip=$(printf "%s\n" $ip_info | awk -F/ '{print $1}' | paste -sd, -)
20
+ else
21
+ ip="—"
22
+ fi
23
+
24
+ # operstate and mtu
25
+ operstate=$(< "$iface_path/operstate" 2>/dev/null || echo "—")
26
+ mtu=$(< "$iface_path/mtu" 2>/dev/null || echo "—")
27
+
28
+ # Driver (if available)
29
+ if [ -e "$iface_path/device/driver" ]; then
13
30
  driver=$(basename "$(readlink -f "$iface_path/device/driver")")
14
31
  else
15
32
  driver="—"
16
33
  fi
17
34
 
18
- # Vendor device ID PCI
35
+ # PCI vendor:device (if available)
19
36
  pci_dev="$iface_path/device"
20
- if [ -f "$pci_dev/vendor" ] && [ -f "$pci_dev/device" ]; then
37
+ if [ -r "$pci_dev/vendor" ] && [ -r "$pci_dev/device" ]; then
21
38
  vendor_id=$(< "$pci_dev/vendor")
22
39
  device_id=$(< "$pci_dev/device")
23
- # parse 0x8086 to 8086, etc.
24
40
  vendor_id=${vendor_id#0x}
25
41
  device_id=${device_id#0x}
26
42
  pci="${vendor_id}:${device_id}"
@@ -28,16 +44,22 @@ for iface_path in /sys/class/net/*; do
28
44
  pci="—"
29
45
  fi
30
46
 
31
- # Link Speed
47
+ # Link speed: only append unit if numeric
32
48
  speed=$(cat "$iface_path/speed" 2>/dev/null || echo "—")
49
+ if [[ "$speed" =~ ^[0-9]+$ ]]; then
50
+ speed_label="${speed} Mb/s"
51
+ else
52
+ speed_label="$speed"
53
+ fi
54
+
55
+ # Print formatted output
56
+ printf 'Interface: %s\n' "$name"
57
+ printf ' MAC: %s\n' "$mac"
58
+ printf ' IPv4: %s\n' "$ip"
59
+ printf ' State: %s\n' "$operstate"
60
+ printf ' MTU: %s\n' "$mtu"
61
+ printf ' Driver: %s\n' "$driver"
62
+ printf ' PCI Vendor:Device: %s\n' "$pci"
63
+ printf ' Link Speed: %s\n\n' "$speed_label"
33
64
 
34
- echo "Interface: $name"
35
- echo " MAC: $mac"
36
- echo " IPv4: $ip"
37
- echo " State: $operstate"
38
- echo " MTU: $mtu"
39
- echo " Driver: $driver"
40
- echo " PCI Vendor:Device ID: $pci"
41
- echo " Link Speed: ${speed}Mb/s"
42
- echo
43
65
  done
@@ -32,6 +32,7 @@ echo "6) Try to install audio helper packages that sometimes block ffmpeg (ladsp
32
32
  # These may be provided by CRB/EPEL or other compatible repos
33
33
  dnf -y install ladspa || echo "ladspa not available from enabled repos (will try later)"
34
34
  dnf -y install rubberband || echo "rubberband not available from enabled repos (will try later)"
35
+ dnf -y install libwebp-tools || echo "libwebp-tools not available from enabled repos (will try later)"
35
36
 
36
37
  echo "7) Try installing ffmpeg (several fallbacks tried)"
37
38
  if dnf -y install ffmpeg ffmpeg-devel --allowerasing; then
@@ -44,12 +44,15 @@ class UnderpostCluster {
44
44
  * @param {boolean} [options.listPods=false] - List Kubernetes pods.
45
45
  * @param {boolean} [options.reset=false] - Perform a comprehensive reset of Kubernetes and container environments.
46
46
  * @param {boolean} [options.dev=false] - Run in development mode (adjusts paths).
47
- * @param {string} [options.nsUse=''] - Set the current kubectl namespace.
47
+ * @param {string} [options.nsUse=''] - Set the current kubectl namespace (creates namespace if it doesn't exist).
48
+ * @param {string} [options.namespace='default'] - Kubernetes namespace for cluster operations.
48
49
  * @param {boolean} [options.infoCapacity=false] - Display resource capacity information for the cluster.
49
50
  * @param {boolean} [options.infoCapacityPod=false] - Display resource capacity information for pods.
50
51
  * @param {boolean} [options.pullImage=false] - Pull necessary Docker images before deployment.
51
52
  * @param {boolean} [options.dedicatedGpu=false] - Configure for dedicated GPU usage (e.g., NVIDIA GPU Operator).
52
53
  * @param {boolean} [options.kubeadm=false] - Initialize the cluster using Kubeadm.
54
+ * @param {string} [options.podNetworkCidr='192.168.0.0/16'] - Custom pod network CIDR for Kubeadm cluster initialization. Defaults to '192.168.0.0/16'.
55
+ * @param {string} [options.controlPlaneEndpoint=''] - Custom control plane endpoint for Kubeadm cluster initialization. Defaults to '${os.hostname()}:6443'.
53
56
  * @param {boolean} [options.k3s=false] - Initialize the cluster using K3s.
54
57
  * @param {boolean} [options.initHost=false] - Perform initial host setup (install Docker, Podman, Kind, Kubeadm, Helm).
55
58
  * @param {boolean} [options.grafana=false] - Initialize the cluster with a Grafana deployment.
@@ -79,11 +82,14 @@ class UnderpostCluster {
79
82
  reset: false,
80
83
  dev: false,
81
84
  nsUse: '',
85
+ namespace: 'default',
82
86
  infoCapacity: false,
83
87
  infoCapacityPod: false,
84
88
  pullImage: false,
85
89
  dedicatedGpu: false,
86
90
  kubeadm: false,
91
+ podNetworkCidr: '192.168.0.0/16',
92
+ controlPlaneEndpoint: '',
87
93
  k3s: false,
88
94
  initHost: false,
89
95
  grafana: false,
@@ -116,41 +122,26 @@ class UnderpostCluster {
116
122
  if (options.infoCapacity === true)
117
123
  return logger.info('', UnderpostCluster.API.getResourcesCapacity(options.kubeadm || options.k3s)); // Adjust for k3s
118
124
  if (options.listPods === true) return console.table(UnderpostDeploy.API.get(podName ?? undefined));
125
+ // Set default namespace if not specified
126
+ if (!options.namespace) options.namespace = 'default';
127
+
119
128
  if (options.nsUse && typeof options.nsUse === 'string') {
120
- shellExec(`kubectl config set-context --current --namespace=${options.nsUse}`);
121
- return;
122
- }
123
- if (options.info === true) {
124
- shellExec(`kubectl config get-contexts`);
125
- shellExec(`kubectl config get-clusters`);
126
- shellExec(`kubectl get nodes -o wide`);
127
- shellExec(`kubectl config view | grep namespace`);
128
- shellExec(`kubectl get ns -o wide`);
129
- shellExec(`kubectl get pvc --all-namespaces -o wide`);
130
- shellExec(`kubectl get pv --all-namespaces -o wide`);
131
- shellExec(`kubectl get cronjob --all-namespaces -o wide`);
132
- shellExec(`kubectl get svc --all-namespaces -o wide`);
133
- shellExec(`kubectl get statefulsets --all-namespaces -o wide`);
134
- shellExec(`kubectl get deployments --all-namespaces -o wide`);
135
- shellExec(`kubectl get configmap --all-namespaces -o wide`);
136
- shellExec(`kubectl get pods --all-namespaces -o wide`);
137
- shellExec(
138
- `kubectl get pod --all-namespaces -o="custom-columns=NAME:.metadata.name,INIT-CONTAINERS:.spec.initContainers[*].name,CONTAINERS:.spec.containers[*].name"`,
139
- );
140
- shellExec(
141
- `kubectl get pods --all-namespaces -o=jsonpath='{range .items[*]}{"\\n"}{.metadata.name}{":\\t"}{range .spec.containers[*]}{.image}{", "}{end}{end}'`,
142
- );
143
- shellExec(`sudo crictl images`);
144
- console.log();
145
- logger.info('contour -------------------------------------------------');
146
- for (const _k of ['Cluster', 'HTTPProxy', 'ClusterIssuer', 'Certificate']) {
147
- shellExec(`kubectl get ${_k} --all-namespaces -o wide`);
129
+ // Verify if namespace exists, create if not
130
+ const namespaceExists = shellExec(`kubectl get namespace ${options.nsUse} --ignore-not-found -o name`, {
131
+ stdout: true,
132
+ silent: true,
133
+ }).trim();
134
+
135
+ if (!namespaceExists) {
136
+ logger.info(`Namespace '${options.nsUse}' does not exist. Creating it...`);
137
+ shellExec(`kubectl create namespace ${options.nsUse}`);
138
+ logger.info(`Namespace '${options.nsUse}' created successfully.`);
139
+ } else {
140
+ logger.info(`Namespace '${options.nsUse}' already exists.`);
148
141
  }
149
- logger.info('----------------------------------------------------------------');
150
- shellExec(`kubectl get secrets --all-namespaces -o wide`);
151
- shellExec(`docker secret ls`);
152
- shellExec(`kubectl get crd --all-namespaces -o wide`);
153
- shellExec(`sudo kubectl api-resources`);
142
+
143
+ shellExec(`kubectl config set-context --current --namespace=${options.nsUse}`);
144
+ logger.info(`Context switched to namespace: ${options.nsUse}`);
154
145
  return;
155
146
  }
156
147
 
@@ -230,9 +221,13 @@ class UnderpostCluster {
230
221
  logger.info('K3s comes with local-path-provisioner by default. Skipping explicit installation.');
231
222
  } else if (options.kubeadm === true) {
232
223
  logger.info('Initializing Kubeadm control plane...');
224
+ // Set default values if not provided
225
+ const podNetworkCidr = options.podNetworkCidr || '192.168.0.0/16';
226
+ const controlPlaneEndpoint = options.controlPlaneEndpoint || `${os.hostname()}:6443`;
227
+
233
228
  // Initialize kubeadm control plane
234
229
  shellExec(
235
- `sudo kubeadm init --pod-network-cidr=192.168.0.0/16 --control-plane-endpoint="${os.hostname()}:6443"`,
230
+ `sudo kubeadm init --pod-network-cidr=${podNetworkCidr} --control-plane-endpoint="${controlPlaneEndpoint}"`,
236
231
  );
237
232
  // Configure kubectl for the current user
238
233
  UnderpostCluster.API.chown('kubeadm'); // Pass 'kubeadm' to chown
@@ -242,7 +237,11 @@ class UnderpostCluster {
242
237
  shellExec(
243
238
  `sudo kubectl create -f https://raw.githubusercontent.com/projectcalico/calico/v3.29.3/manifests/tigera-operator.yaml`,
244
239
  );
240
+ shellExec(
241
+ `kubectl create -f https://raw.githubusercontent.com/projectcalico/calico/v3.29.3/manifests/custom-resources.yaml`,
242
+ );
245
243
  shellExec(`sudo kubectl apply -f ${underpostRoot}/manifests/kubeadm-calico-config.yaml`);
244
+
246
245
  // Untaint control plane node to allow scheduling pods
247
246
  const nodeName = os.hostname();
248
247
  shellExec(`kubectl taint nodes ${nodeName} node-role.kubernetes.io/control-plane:NoSchedule-`);
@@ -286,13 +285,13 @@ class UnderpostCluster {
286
285
  }
287
286
 
288
287
  if (options.grafana === true) {
289
- shellExec(`kubectl delete deployment grafana --ignore-not-found`);
290
- shellExec(`kubectl apply -k ${underpostRoot}/manifests/grafana`);
288
+ shellExec(`kubectl delete deployment grafana -n ${options.namespace} --ignore-not-found`);
289
+ shellExec(`kubectl apply -k ${underpostRoot}/manifests/grafana -n ${options.namespace}`);
291
290
  const yaml = `${fs
292
291
  .readFileSync(`${underpostRoot}/manifests/grafana/deployment.yaml`, 'utf8')
293
292
  .replace('{{GF_SERVER_ROOT_URL}}', options.hosts.split(',')[0])}`;
294
293
  console.log(yaml);
295
- shellExec(`kubectl apply -f - <<EOF
294
+ shellExec(`kubectl apply -f - -n ${options.namespace} <<EOF
296
295
  ${yaml}
297
296
  EOF
298
297
  `);
@@ -311,7 +310,7 @@ EOF
311
310
  .join(',')}]`,
312
311
  )}`;
313
312
  console.log(yaml);
314
- shellExec(`kubectl apply -f - <<EOF
313
+ shellExec(`kubectl apply -f - -n ${options.namespace} <<EOF
315
314
  ${yaml}
316
315
  EOF
317
316
  `);
@@ -340,15 +339,15 @@ EOF
340
339
  // For kubeadm/k3s, ensure it's available for containerd
341
340
  shellExec(`sudo crictl pull valkey/valkey:latest`);
342
341
  }
343
- shellExec(`kubectl delete statefulset valkey-service --ignore-not-found`);
344
- shellExec(`kubectl apply -k ${underpostRoot}/manifests/valkey`);
342
+ shellExec(`kubectl delete statefulset valkey-service -n ${options.namespace} --ignore-not-found`);
343
+ shellExec(`kubectl apply -k ${underpostRoot}/manifests/valkey -n ${options.namespace}`);
345
344
  await UnderpostTest.API.statusMonitor('valkey-service', 'Running', 'pods', 1000, 60);
346
345
  }
347
346
  if (options.full === true || options.mariadb === true) {
348
347
  shellExec(
349
- `sudo kubectl create secret generic mariadb-secret --from-file=username=/home/dd/engine/engine-private/mariadb-username --from-file=password=/home/dd/engine/engine-private/mariadb-password --dry-run=client -o yaml | kubectl apply -f -`,
348
+ `sudo kubectl create secret generic mariadb-secret --from-file=username=/home/dd/engine/engine-private/mariadb-username --from-file=password=/home/dd/engine/engine-private/mariadb-password --dry-run=client -o yaml | kubectl apply -f - -n ${options.namespace}`,
350
349
  );
351
- shellExec(`kubectl delete statefulset mariadb-statefulset --ignore-not-found`);
350
+ shellExec(`kubectl delete statefulset mariadb-statefulset -n ${options.namespace} --ignore-not-found`);
352
351
 
353
352
  if (options.pullImage === true) {
354
353
  // shellExec(`sudo podman pull mariadb:latest`);
@@ -360,17 +359,17 @@ EOF
360
359
  // For kubeadm/k3s, ensure it's available for containerd
361
360
  shellExec(`sudo crictl pull mariadb:latest`);
362
361
  }
363
- shellExec(`kubectl apply -f ${underpostRoot}/manifests/mariadb/storage-class.yaml`);
364
- shellExec(`kubectl apply -k ${underpostRoot}/manifests/mariadb`);
362
+ shellExec(`kubectl apply -f ${underpostRoot}/manifests/mariadb/storage-class.yaml -n ${options.namespace}`);
363
+ shellExec(`kubectl apply -k ${underpostRoot}/manifests/mariadb -n ${options.namespace}`);
365
364
  }
366
365
  if (options.full === true || options.mysql === true) {
367
366
  shellExec(
368
- `sudo kubectl create secret generic mysql-secret --from-file=username=/home/dd/engine/engine-private/mysql-username --from-file=password=/home/dd/engine/engine-private/mysql-password --dry-run=client -o yaml | kubectl apply -f -`,
367
+ `sudo kubectl create secret generic mysql-secret --from-file=username=/home/dd/engine/engine-private/mysql-username --from-file=password=/home/dd/engine/engine-private/mysql-password --dry-run=client -o yaml | kubectl apply -f - -n ${options.namespace}`,
369
368
  );
370
369
  shellExec(`sudo mkdir -p /mnt/data`);
371
370
  shellExec(`sudo chmod 777 /mnt/data`);
372
371
  shellExec(`sudo chown -R root:root /mnt/data`);
373
- shellExec(`kubectl apply -k ${underpostRoot}/manifests/mysql`);
372
+ shellExec(`kubectl apply -k ${underpostRoot}/manifests/mysql -n ${options.namespace}`);
374
373
  }
375
374
  if (options.full === true || options.postgresql === true) {
376
375
  if (options.pullImage === true) {
@@ -383,9 +382,9 @@ EOF
383
382
  shellExec(`sudo crictl pull postgres:latest`);
384
383
  }
385
384
  shellExec(
386
- `sudo kubectl create secret generic postgres-secret --from-file=password=/home/dd/engine/engine-private/postgresql-password --dry-run=client -o yaml | kubectl apply -f -`,
385
+ `sudo kubectl create secret generic postgres-secret --from-file=password=/home/dd/engine/engine-private/postgresql-password --dry-run=client -o yaml | kubectl apply -f - -n ${options.namespace}`,
387
386
  );
388
- shellExec(`kubectl apply -k ${underpostRoot}/manifests/postgresql`);
387
+ shellExec(`kubectl apply -k ${underpostRoot}/manifests/postgresql -n ${options.namespace}`);
389
388
  }
390
389
  if (options.mongodb4 === true) {
391
390
  if (options.pullImage === true) {
@@ -397,7 +396,7 @@ EOF
397
396
  // For kubeadm/k3s, ensure it's available for containerd
398
397
  shellExec(`sudo crictl pull mongo:4.4`);
399
398
  }
400
- shellExec(`kubectl apply -k ${underpostRoot}/manifests/mongodb-4.4`);
399
+ shellExec(`kubectl apply -k ${underpostRoot}/manifests/mongodb-4.4 -n ${options.namespace}`);
401
400
 
402
401
  const deploymentName = 'mongodb-deployment';
403
402
 
@@ -428,14 +427,14 @@ EOF
428
427
  shellExec(`sudo crictl pull mongo:latest`);
429
428
  }
430
429
  shellExec(
431
- `sudo kubectl create secret generic mongodb-keyfile --from-file=/home/dd/engine/engine-private/mongodb-keyfile --dry-run=client -o yaml | kubectl apply -f -`,
430
+ `sudo kubectl create secret generic mongodb-keyfile --from-file=/home/dd/engine/engine-private/mongodb-keyfile --dry-run=client -o yaml | kubectl apply -f - -n ${options.namespace}`,
432
431
  );
433
432
  shellExec(
434
- `sudo kubectl create secret generic mongodb-secret --from-file=username=/home/dd/engine/engine-private/mongodb-username --from-file=password=/home/dd/engine/engine-private/mongodb-password --dry-run=client -o yaml | kubectl apply -f -`,
433
+ `sudo kubectl create secret generic mongodb-secret --from-file=username=/home/dd/engine/engine-private/mongodb-username --from-file=password=/home/dd/engine/engine-private/mongodb-password --dry-run=client -o yaml | kubectl apply -f - -n ${options.namespace}`,
435
434
  );
436
- shellExec(`kubectl delete statefulset mongodb --ignore-not-found`);
437
- shellExec(`kubectl apply -f ${underpostRoot}/manifests/mongodb/storage-class.yaml`);
438
- shellExec(`kubectl apply -k ${underpostRoot}/manifests/mongodb`);
435
+ shellExec(`kubectl delete statefulset mongodb -n ${options.namespace} --ignore-not-found`);
436
+ shellExec(`kubectl apply -f ${underpostRoot}/manifests/mongodb/storage-class.yaml -n ${options.namespace}`);
437
+ shellExec(`kubectl apply -k ${underpostRoot}/manifests/mongodb -n ${options.namespace}`);
439
438
 
440
439
  const successInstance = await UnderpostTest.API.statusMonitor('mongodb-0', 'Running', 'pods', 1000, 60 * 10);
441
440
 
@@ -459,7 +458,9 @@ EOF
459
458
  shellExec(`kubectl apply -f https://projectcontour.io/quickstart/contour.yaml`);
460
459
  if (options.kubeadm === true) {
461
460
  // Envoy service might need NodePort for kubeadm
462
- shellExec(`sudo kubectl apply -f ${underpostRoot}/manifests/envoy-service-nodeport.yaml`);
461
+ shellExec(
462
+ `sudo kubectl apply -f ${underpostRoot}/manifests/envoy-service-nodeport.yaml -n ${options.namespace}`,
463
+ );
463
464
  }
464
465
  // K3s has a built-in LoadBalancer (Klipper-lb) that can expose services,
465
466
  // so a specific NodePort service might not be needed or can be configured differently.
@@ -479,7 +480,7 @@ EOF
479
480
 
480
481
  const letsEncName = 'letsencrypt-prod';
481
482
  shellExec(`sudo kubectl delete ClusterIssuer ${letsEncName} --ignore-not-found`);
482
- shellExec(`sudo kubectl apply -f ${underpostRoot}/manifests/${letsEncName}.yaml`);
483
+ shellExec(`sudo kubectl apply -f ${underpostRoot}/manifests/${letsEncName}.yaml -n ${options.namespace}`);
483
484
  }
484
485
  },
485
486