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
commit 02ced485e69e74f09990ca3bf84169445308a81e Author: Michele Sciabarra <[email protected]> AuthorDate: Sat Oct 4 11:14:17 2025 +0100 updated deployment using a persistent workspace folder --- setup/docker/kind.yaml | 20 +++++++++++--------- setup/docker/opsfile.yml | 6 ++++-- setup/nuvolaris/devcontainer/deployment.yaml | 22 +++++++++++++++++++--- setup/nuvolaris/devcontainer/opsfile.yml | 3 +++ setup/nuvolaris/system-api/opsfile.yml | 13 ++++++------- 5 files changed, 43 insertions(+), 21 deletions(-) diff --git a/setup/docker/kind.yaml b/setup/docker/kind.yaml index 779e4f4..1234a98 100644 --- a/setup/docker/kind.yaml +++ b/setup/docker/kind.yaml @@ -48,26 +48,28 @@ nodes: protocol: TCP - role: worker extraMounts: - - hostPath: $DATADIR/data + - hostPath: "$DATADIR/data" containerPath: /data - - hostPath: $DATADIR/openwhisk/standalone + - hostPath: "$DATADIR/openwhisk/standalone" containerPath: /openwhisk/standalone - hostPath: $DATADIR/openwhisk/invoker containerPath: /openwhisk/invoker - - hostPath: $DATADIR/openwhisk/controller + - hostPath: "$DATADIR/openwhisk/controller" containerPath: /openwhisk/controller - - hostPath: $DATADIR/couchdb + - hostPath: "$DATADIR/couchdb" containerPath: /couchdb - - hostPath: $DATADIR/mongodb + - hostPath: "$DATADIR/mongodb" containerPath: /mongodb - - hostPath: $DATADIR/redis + - hostPath: "$DATADIR/redis" containerPath: /redis - - hostPath: $DATADIR/zookeper/data + - hostPath: "$DATADIR/zookeper/data" containerPath: /zookeeper/data - - hostPath: $DATADIR/zookeeper/log + - hostPath: "$DATADIR/zookeeper/log" containerPath: /zookeeper/log - - hostPath: $DATADIR/kafka + - hostPath: "$DATADIR/kafka" containerPath: /kafka + - hostPath: "$OPS_HOME/workspace" + containerPath: /workspace extraPortMappings: - containerPort: 30232 hostPort: 3232 diff --git a/setup/docker/opsfile.yml b/setup/docker/opsfile.yml index b40122c..7a37e63 100644 --- a/setup/docker/opsfile.yml +++ b/setup/docker/opsfile.yml @@ -21,7 +21,9 @@ vars: env: DATADIR: - sh: echo $OPS_TMP/kind + sh: echo "$OPS_TMP/kind" + WORKSPACE: + sh: echo "$OPS_HOME/workspace" KUBECONFIG: sh: |- if test -e "$OPS_TMP/kubeconfig" @@ -60,7 +62,7 @@ tasks: cluster: silent: true cmds: - - mkdir -p "$DATADIR" + - mkdir -p "$DATADIR" "$OPS_HOME/workspace" - envsubst -i kind.yaml -o _kind.yaml - > kind create cluster diff --git a/setup/nuvolaris/devcontainer/deployment.yaml b/setup/nuvolaris/devcontainer/deployment.yaml index 8438d6a..1cc8058 100644 --- a/setup/nuvolaris/devcontainer/deployment.yaml +++ b/setup/nuvolaris/devcontainer/deployment.yaml @@ -16,6 +16,21 @@ spec: app: ssh-devcontainer spec: hostname: ssh-devcontainer + securityContext: + fsGroup: 1000 + runAsUser: 1000 + runAsGroup: 1000 + volumes: + - name: workspace + hostPath: + path: /workspace + initContainers: + - name: fix-permissions + image: busybox + command: ['sh', '-c', 'chown -R 1000:1000 /workspace'] + volumeMounts: + - name: workspace + mountPath: /workspace containers: - name: devcontainer image: $IMAGE @@ -23,6 +38,9 @@ spec: - containerPort: 2222 name: ssh protocol: TCP + volumeMounts: + - name: workspace + mountPath: /workspace env: - name: DEBIAN_FRONTEND value: noninteractive @@ -40,8 +58,6 @@ spec: value: devel - name: OPS_APIHOST value: http://controller:3233 - - command: - /bin/bash - -c @@ -53,11 +69,11 @@ spec: mkdir -p ~/.ssh ; chmod 600 ~/.ssh/authorized_keys ; echo "$$SSH_KEY" > ~/.ssh/authorized_keys ; + ln -sf /workspace ~/workspace ; ops -update ; sudo /usr/sbin/sshd -p 2222 -D # RENOVED - BUGGY - shhould be before sshd -p 2222 # echo -e "export OPS_PASSWORD='$$OPS_PASSWORD'\nexport OPS_USERNAME='$$OPS_USERNAME'\nexport OPS_APIHOST='$$OPS_APIHOST'" >>.bashrc ; - --- apiVersion: v1 kind: Service diff --git a/setup/nuvolaris/devcontainer/opsfile.yml b/setup/nuvolaris/devcontainer/opsfile.yml index cce9128..9060c7d 100644 --- a/setup/nuvolaris/devcontainer/opsfile.yml +++ b/setup/nuvolaris/devcontainer/opsfile.yml @@ -34,6 +34,9 @@ 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' undeploy: silent: true diff --git a/setup/nuvolaris/system-api/opsfile.yml b/setup/nuvolaris/system-api/opsfile.yml index f217aac..3115d11 100644 --- a/setup/nuvolaris/system-api/opsfile.yml +++ b/setup/nuvolaris/system-api/opsfile.yml @@ -36,19 +36,19 @@ env: SYS_API_CDB_HOST: couchdb SYS_API_CDB_USER: - sh: kubectl -n nuvolaris get wsk/controller -o jsonpath='{.spec.couchdb.admin.user}' + sh: kubectl -n nuvolaris --kubeconfig "$OPS_TMP/kubeconfig" get wsk/controller -o jsonpath='{.spec.couchdb.admin.user}' SYS_API_CDB_PASSWORD: - sh: kubectl -n nuvolaris get wsk/controller -o jsonpath='{.spec.couchdb.admin.password}' + sh: kubectl -n nuvolaris --kubeconfig "$OPS_TMP/kubeconfig" get wsk/controller -o jsonpath='{.spec.couchdb.admin.password}' SYS_API_HOSTNAME: - sh: kubectl -n nuvolaris get ingress/apihost -o jsonpath='{.spec.rules[0].host}' + sh: kubectl -n nuvolaris --kubeconfig "$OPS_TMP/kubeconfig" get ingress/apihost -o jsonpath='{.spec.rules[0].host}' INGRESS_TYPE: sh: ops util ingress-type REGISTRY_PASS: - sh: kubectl -n nuvolaris get cm/config -o jsonpath='{.metadata.annotations.registry_password}' + sh: kubectl -n nuvolaris --kubeconfig "$OPS_TMP/kubeconfig" get cm/config -o jsonpath='{.metadata.annotations.registry_password}' tasks: install-toml: @@ -86,7 +86,6 @@ tasks: then kubectl -n nuvolaris delete secret registry-pull-secret-int fi - deploy: silent: true ignore_error: false @@ -96,9 +95,9 @@ tasks: - test -n "$IMAGES_SYSTEMAPI" || die "IMAGES_SYSTEMAPI is not set. Please set it to the desired image version." - envsubst -i api-template.yaml -o _api.yaml > /dev/null 2>&1 - envsubst -i ${INGRESS_TYPE}-template.yaml -o _ingress.yaml > /dev/null 2>&1 - - kubectl -n nuvolaris apply -f "$OPS_ROOT/setup/nuvolaris/system-api/_api.yaml" + - kubectl -n nuvolaris apply -f _api.yaml #- cat _ingress.yaml - - kubectl -n nuvolaris apply -f "$OPS_ROOT/setup/nuvolaris/system-api/_ingress.yaml" + - kubectl -n nuvolaris apply -f_ingress.yaml - task: install-toml - task: install-secret - |
