This is an automated email from the ASF dual-hosted git repository.
msciabarra pushed a commit to branch embedded-devcontainer
in repository https://gitbox.apache.org/repos/asf/openserverless-task.git
The following commit(s) were added to refs/heads/embedded-devcontainer by this
push:
new cc2ed39 devcontainer
cc2ed39 is described below
commit cc2ed39105bc0d5033235ff4741b1652b83601d6
Author: Michele Sciabarra <[email protected]>
AuthorDate: Sat Oct 18 10:43:46 2025 +0100
devcontainer
---
setup/nuvolaris/devcontainer/deployment.yaml | 60 ++++++++++++++++++++++++----
setup/nuvolaris/devcontainer/opsfile.yml | 9 +++--
2 files changed, 58 insertions(+), 11 deletions(-)
diff --git a/setup/nuvolaris/devcontainer/deployment.yaml
b/setup/nuvolaris/devcontainer/deployment.yaml
index 77fdfd5..80b5ff1 100644
--- a/setup/nuvolaris/devcontainer/deployment.yaml
+++ b/setup/nuvolaris/devcontainer/deployment.yaml
@@ -16,14 +16,13 @@ spec:
app: ssh-devcontainer
spec:
hostname: ssh-devcontainer
- securityContext:
- fsGroup: 1000
- runAsUser: 1000
- runAsGroup: 1000
volumes:
- name: workspace
- hostPath:
+ hostPath:
path: /workspace
+ - name: nginx-config
+ configMap:
+ name: nginx-proxy-config
containers:
- name: devcontainer
image: $IMAGE
@@ -31,6 +30,9 @@ spec:
- containerPort: 2222
name: ssh
protocol: TCP
+ securityContext:
+ runAsUser: 1000
+ runAsGroup: 1000
volumeMounts:
- name: workspace
mountPath: /workspace
@@ -42,6 +44,11 @@ spec:
secretKeyRef:
name: ssh-secret
key: authorized_keys
+ - name: DEVEL_PASSWORD
+ valueFrom:
+ secretKeyRef:
+ name: devel-secret
+ key: password
command:
- /bin/bash
- -c
@@ -55,9 +62,48 @@ spec:
chmod 600 ~/.ssh/authorized_keys ;
echo "$$SSH_KEY" > ~/.ssh/authorized_keys ;
ln -sf /workspace ~/workspace ;
- ops -update ;
- sudo chown -R 1000:1000 /workspace ;
+ echo "ops -update ; env OPS_PASSWORD='$$DEVEL_PASSWORD' ops ide
login devel http://miniops.me" >>~/.bashrc ;
+ sudo chown -R 1000:1000 /workspace ;
sudo /usr/sbin/sshd -p 2222 -D
+ - name: reverse-proxy
+ image: nginx:alpine
+ ports:
+ - containerPort: 80
+ name: http
+ protocol: TCP
+ command: ["nginx", "-g", "daemon off;"]
+ volumeMounts:
+ - name: nginx-config
+ mountPath: /etc/nginx/nginx.conf
+ subPath: nginx.conf
+ readOnly: true
+---
+apiVersion: v1
+kind: ConfigMap
+metadata:
+ name: nginx-proxy-config
+ namespace: nuvolaris
+data:
+ nginx.conf: |
+ events {
+ worker_connections 1024;
+ }
+ http {
+ client_max_body_size 1g;
+
+ server {
+ listen 80;
+ server_name miniops.me *.miniops.me;
+
+ location / {
+ proxy_pass
http://ingress-nginx-controller.ingress-nginx.svc.cluster.local;
+ proxy_set_header Host $$host;
+ proxy_set_header X-Real-IP $$remote_addr;
+ proxy_set_header X-Forwarded-For $$proxy_add_x_forwarded_for;
+ proxy_set_header X-Forwarded-Proto http;
+ }
+ }
+ }
---
apiVersion: v1
kind: Service
diff --git a/setup/nuvolaris/devcontainer/opsfile.yml
b/setup/nuvolaris/devcontainer/opsfile.yml
index 9060c7d..ed21ede 100644
--- a/setup/nuvolaris/devcontainer/opsfile.yml
+++ b/setup/nuvolaris/devcontainer/opsfile.yml
@@ -20,7 +20,7 @@ tasks:
- test -e ~/.ssh/id_rsa.pub || die "please generate an ssh key with
ssh-keygen in ~/.ssh/id_rsa.pub"
- >
kubectl -n nuvolaris create secret generic ssh-secret
- --from-literal=authorized_keys="$(cat ~/.ssh/id_rsa.pub)"
+ --from-literal=authorized_keys="$(cat ~/.ssh/id_rsa.pub)"
2>/dev/null || die "devcontainer already exists"
- >
kubectl -n nuvolaris create secret generic devel-secret
--from-literal=password="$(cat ~/.ops/devel.password)"
@@ -34,9 +34,10 @@ tasks:
if ! rg "Host miniops" ~/.ssh/config >/dev/null
then echo -e "\nHost miniops\n Hostname localhost\n Port 2222\n
User node\n StrictHostKeyChecking no\n UserKnownHostsFile=/dev/null\n" >>
~/.ssh/config
fi
- - echo waiting the devcontainer to be ready...
- - retry -t 20 -m 120 ssh miniops exit 2>/dev/null
- - echo you can now connect to the devcontainer with 'ssh miniops'
+ - >
+ retry -t 100 -m 600 ssh miniops exit 2>&1
+ | awk '{s=""; for(i=1;i<=NR;i++) s=s"#"; printf "\rwaiting for ssh:
[%s]", s; fflush()}'
+ - echo -e "\nyou can now connect to the devcontainer with 'ssh miniops'"
undeploy:
silent: true