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 54f578e devcontainer setup
54f578e is described below
commit 54f578e9c1dbfc9f73350d31507cb825195f8f57
Author: Michele Sciabarra <[email protected]>
AuthorDate: Thu Oct 2 15:09:36 2025 +0100
devcontainer setup
---
setup/docker/kind.yaml | 8 +--
setup/nuvolaris/devcontainer/deployment.yaml | 74 ++++++++++++++++++++++++++++
setup/nuvolaris/devcontainer/opsfile.yml | 72 +++++++++++++++++++++++++++
setup/nuvolaris/opsfile.yml | 7 +--
4 files changed, 154 insertions(+), 7 deletions(-)
diff --git a/setup/docker/kind.yaml b/setup/docker/kind.yaml
index ac2876c..779e4f4 100644
--- a/setup/docker/kind.yaml
+++ b/setup/docker/kind.yaml
@@ -27,7 +27,7 @@ containerdConfigPatches:
[plugins."io.containerd.grpc.v1.cri".registry.configs]
[plugins."io.containerd.grpc.v1.cri".registry.configs."127.0.0.1:32000".tls]
insecure_skip_verify = true
-
+
nodes:
- role: control-plane
kubeadmConfigPatches:
@@ -43,6 +43,9 @@ nodes:
- containerPort: 443
hostPort: 443
protocol: TCP
+ - containerPort: 30222
+ hostPort: 2222
+ protocol: TCP
- role: worker
extraMounts:
- hostPath: $DATADIR/data
@@ -66,9 +69,6 @@ nodes:
- hostPath: $DATADIR/kafka
containerPath: /kafka
extraPortMappings:
- - containerPort: 30022
- hostPort: 22
- protocol: TCP
- containerPort: 30232
hostPort: 3232
protocol: TCP
diff --git a/setup/nuvolaris/devcontainer/deployment.yaml
b/setup/nuvolaris/devcontainer/deployment.yaml
new file mode 100644
index 0000000..5d59cb0
--- /dev/null
+++ b/setup/nuvolaris/devcontainer/deployment.yaml
@@ -0,0 +1,74 @@
+apiVersion: apps/v1
+kind: Deployment
+metadata:
+ name: ssh-devcontainer
+ namespace: nuvolaris
+ labels:
+ app: ssh-devcontainer
+spec:
+ replicas: 1
+ selector:
+ matchLabels:
+ app: ssh-devcontainer
+ template:
+ metadata:
+ labels:
+ app: ssh-devcontainer
+ spec:
+ hostname: ssh-devcontainer
+ containers:
+ - name: devcontainer
+ image: $IMAGE
+ ports:
+ - containerPort: 2222
+ name: ssh
+ protocol: TCP
+ env:
+ - name: DEBIAN_FRONTEND
+ value: noninteractive
+ - name: SSH_KEY
+ valueFrom:
+ secretKeyRef:
+ name: ssh-secret
+ key: authorized_keys
+ - name: OPS_PASSWORD
+ valueFrom:
+ secretKeyRef:
+ name: devel-secret
+ key: password
+ - name: OPS_USERNAME
+ value: devel
+ - name: OPS_APIHOST
+ value: http://controller:3233
+ command:
+ - /bin/bash
+ - -c
+ - >
+ sudo apt-get update ;
+ sudo apt-get install -y openssh-server ;
+ sudo mkdir -p /run/sshd ;
+ sudo ssh-keygen -A ;
+ mkdir -p ~/.ssh ;
+ chmod 600 ~/.ssh/authorized_keys ;
+ echo "$$SSH_KEY" > ~/.ssh/authorized_keys ;
+ echo -e "export OPS_PASSWORD='$$OPS_PASSWORD'\nexport
OPS_USERNAME='$$OPS_USERNAME'\nexport OPS_APIHOST='$$OPS_APIHOST'" >>.bashrc ;
+ ops -update ;
+ sudo /usr/sbin/sshd -p 2222 -D
+---
+apiVersion: v1
+kind: Service
+metadata:
+ name: ssh-devcontainer
+ namespace: nuvolaris
+ labels:
+ app: ssh-devcontainer
+spec:
+ type: NodePort
+ selector:
+ app: ssh-devcontainer
+ ports:
+ - port: 2222
+ targetPort: 2222
+ nodePort: 30222
+ protocol: TCP
+ name: ssh
diff --git a/setup/nuvolaris/devcontainer/opsfile.yml
b/setup/nuvolaris/devcontainer/opsfile.yml
new file mode 100644
index 0000000..cce9128
--- /dev/null
+++ b/setup/nuvolaris/devcontainer/opsfile.yml
@@ -0,0 +1,72 @@
+version: "3"
+
+vars:
+ IMAGE: ghcr.io/mastrogpt/agent41-starter:2506201530
+
+env:
+ KUBECONFIG:
+ sh: |-
+ if test -e "$OPS_TMP/kubeconfig"
+ then echo "$OPS_TMP/kubeconfig"
+ else echo ~/.kube/config
+ fi
+
+tasks:
+
+ deploy:
+ silent: true
+ desc: deploy the devcontainer
+ cmds:
+ - 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)"
+ - >
+ kubectl -n nuvolaris create secret generic devel-secret
+ --from-literal=password="$(cat ~/.ops/devel.password)"
+ - |
+ export IMAGE="{{.IMAGE}}"
+ envsubst < deployment.yaml >_deployment.yaml
+ kubectl apply -f _deployment.yaml
+ - ops setup kubernetes wait-pod SELECTOR="-l app=ssh-devcontainer"
COND=false FILE=_devcontainer
+ - |
+ touch ~/.ssh/config
+ 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
+
+ undeploy:
+ silent: true
+ desc: undeploy the devcontainer
+ cmds:
+ - kubectl -n nuvolaris delete deploy/ssh-devcontainer secret/ssh-secret
secret/devel-secret
+ - echo Please remove the Host miniops entry from your ~/.ssh/config file
if present
+
+ docker-deploy:
+ desc: deploy the ssh-devcontainer with docker
+ silent: true
+ cmds:
+ - >
+ docker run
+ --name ssh-devcontainer --rm
+ -e SSH_KEY="$(cat ~/.ssh/id_rsa.pub)"
+ --entrypoint /bin/bash
+ -p 2222:2222
+ {{.IMAGE}}
+ -c '
+ mkdir -p ~/.ssh ;
+ echo "$SSH_KEY" > ~/.ssh/authorized_keys ;
+ chmod 600 ~/.ssh/authorized_keys ;
+ sudo apt-get update ;
+ sudo apt-get install -y openssh-server ;
+ sudo mkdir -p /run/sshd ;
+ sudo ssh-keygen -A ;
+ echo starting sshd... ;
+ sudo /usr/sbin/sshd -p 2222 -D
+ '
+
+ docker-undeploy:
+ desc: deploy the ssh-devcontainer with docker
+ silent: true
+ cmds:
+ - docker rm -f ssh-devcontainer || echo "no docker container
ssh-devcontainer running"
diff --git a/setup/nuvolaris/opsfile.yml b/setup/nuvolaris/opsfile.yml
index 24e5b68..df29d13 100644
--- a/setup/nuvolaris/opsfile.yml
+++ b/setup/nuvolaris/opsfile.yml
@@ -248,6 +248,9 @@ tasks:
system-api:
desc: manage the system api deployment
+ devcontainer:
+ desc: manage the devcontainer deployment
+
add-user:
silent: true
desc: create a new U=user (default 'devel') with P=password, (default a
random pw)
@@ -259,8 +262,6 @@ tasks:
then ops -random --str 8
else echo "{{.P}}"
fi
- FLAGS: '{{or .F "--all"}}'
-
env:
APIHOST:
sh: echo "$OPERATOR_CONFIG_HOSTPROTOCOL://$OPERATOR_CONFIG_APIHOST"
@@ -274,7 +275,7 @@ tasks:
fi
- echo "Creating user {{.USR}} in $APIHOST"
- |
- ops admin adduser "{{.USR}}" "{{.USR}}@example.com" '{{.PSW}}' {{.FLAGS}}
+ ops admin adduser "{{.USR}}" "{{.USR}}@example.com" '{{.PSW}}' --all
sleep 15
- |
export OPS_PASSWORD="{{.PSW}}"