Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix Multi Cluster Deployment in Devspace. #8610

Merged
merged 16 commits into from
May 8, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
1 change: 0 additions & 1 deletion packages/grid/backend/grid/start.sh
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ if [[ ${DEV_MODE} == "True" ]];
then
echo "DEV_MODE Enabled"
RELOAD="--reload"
pip install --user -e "$APPDIR/syft[telemetry,data_science]"
fi

# only set by kubernetes to avoid conflict with docker tests
Expand Down
84 changes: 72 additions & 12 deletions packages/grid/devspace.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -59,14 +59,6 @@ images:
context: ./seaweedfs
tags:
- dev-${DEVSPACE_TIMESTAMP}
attestation:
image: "${CONTAINER_REGISTRY}/${DOCKER_IMAGE_ENCLAVE_ATTESTATION}"
buildKit:
args: ["--platform", "linux/amd64"]
dockerfile: ./enclave/attestation/attestation.dockerfile
context: ./enclave/attestation
tags:
- dev-${DEVSPACE_TIMESTAMP}

# This is a list of `deployments` that DevSpace can create for this project
deployments:
Expand Down Expand Up @@ -119,10 +111,8 @@ dev:
sync:
- path: ./backend/grid:/root/app/grid
- path: ../syft:/root/app/syft
enclave-attestation:
sync:
- path: ./enclave/attestation/server:/app/server
ssh: {}
ssh:
localPort: 3480

profiles:
- name: gateway
Expand All @@ -135,6 +125,22 @@ profiles:
- op: remove
path: dev.seaweedfs

# Port Re-Mapping
# Mongo
- op: replace
path: dev.mongo.ports[0].port
value: 27018:27017

# Backend
- op: replace
path: dev.backend.ports[0].port
value: 5679:5678

# Backend Container SSH
- op: replace
path: dev.backend.containers.backend-container.ssh.localPort
value: 3481

- name: gcp
patches:
- op: replace
Expand All @@ -155,3 +161,57 @@ profiles:
path: deployments.syft.helm.valuesFiles
value:
- ./helm/examples/azure/azure.high.yaml

- name: enclave
patches:
- op: replace
path: deployments.syft.helm.values.node.type
value: "enclave"

- op: add
path: images
value:
enclave-attestation:
image: "${CONTAINER_REGISTRY}/${DOCKER_IMAGE_ENCLAVE_ATTESTATION}"
buildKit:
args: ["--platform", "linux/amd64"]
dockerfile: ./enclave/attestation/attestation.dockerfile
context: ./enclave/attestation
tags:
- dev-${DEVSPACE_TIMESTAMP}
- op: add
path: dev.backend.containers
value:
enclave-attestation:
sync:
- path: ./enclave/attestation/server:/app/server
rasswanth-s marked this conversation as resolved.
Show resolved Hide resolved

- op: add
path: deployments.syft.helm.values
value:
attestation:
enabled: true

# Port Re-Mapping
# Mongo
- op: replace
path: dev.mongo.ports[0].port
value: 27019:27017

# Backend
- op: replace
path: dev.backend.ports[0].port
value: 5680:5678

# Backend Container SSH
- op: replace
path: dev.backend.containers.backend-container.ssh.localPort
value: 3482

- op: replace
path: dev.seaweedfs.ports
value:
- port: "9334:9333" # admin
- port: "8889:8888" # filer
- port: "8334:8333" # S3
- port: "4002:4001" # mount api
11 changes: 6 additions & 5 deletions packages/grid/enclave/attestation/enclave-development.md
Original file line number Diff line number Diff line change
Expand Up @@ -103,12 +103,13 @@ client.add_verifier(attestation.Devices.GPU, attestation.Environment.REMOTE, NRA
client.attest()
```

### Instructions for using helm charts
### Instructions for Development (Devspace)

- The attestation container runs inside the backend pod (so backend pod has two containers now). However, in order to run the attestation container, you need to uncomment the attestation flags in `packages/grid/helm/values.dev.yaml`
- Next, we run the deployment. Since k3d creates an intermediate layer of nesting, we need to mount some volumes from host to k3d registry. Thus, when launching, use the following tox command `tox -e dev.k8s.start -- --volume /sys/kernel/security:/sys/kernel/security --volume /dev/tmprm0:/dev/tmprm0`
- Finally, note that the GPU privileges/drivers etc. have not been completed so while the GPU attestation endpoints should work, they will not produce the expected tokens. To test the GPU code, follow the steps provided in [For GPU Attestation
](#for-gpu-attestation) to look at the tokens.
We could launch an enclave stack by the command.

```sh
tox -e dev.k8s.launch.enclave
```

### Local Client-side Verification

Expand Down
7 changes: 0 additions & 7 deletions scripts/k8s/delete_stack.sh

This file was deleted.

7 changes: 0 additions & 7 deletions scripts/k8s/launch_domain.sh

This file was deleted.

7 changes: 0 additions & 7 deletions scripts/k8s/launch_gateway.sh

This file was deleted.

38 changes: 38 additions & 0 deletions tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -988,6 +988,44 @@ commands =
bash -c 'devspace cleanup images --kube-context k3d-${CLUSTER_NAME} --no-warn --namespace syft --var CONTAINER_REGISTRY=k3d-registry.localhost:5800 || true'
bash -c 'kubectl --context k3d-${CLUSTER_NAME} delete namespace syft --now=true || true'

[testenv:dev.k8s.launch.gateway]
description = Launch a single gateway on K8s
passenv = HOME, USER
setenv=
CLUSTER_NAME = {env:CLUSTER_NAME:test-gateway-1}
CLUSTER_HTTP_PORT={env:CLUSTER_HTTP_PORT:9081}
DEVSPACE_PROFILE=gateway
allowlist_externals =
tox
commands =
tox -e dev.k8s.start
tox -e dev.k8s.{posargs:deploy}

[testenv:dev.k8s.launch.domain]
description = Launch a single domain on K8s
passenv = HOME, USER
setenv=
CLUSTER_NAME = {env:CLUSTER_NAME:test-domain-1}
CLUSTER_HTTP_PORT={env:CLUSTER_HTTP_PORT:9082}
allowlist_externals =
tox
commands =
tox -e dev.k8s.start
tox -e dev.k8s.{posargs:deploy}

[testenv:dev.k8s.launch.enclave]
description = Launch a single Enclave on K8s
passenv = HOME, USER
setenv=
CLUSTER_NAME = {env:CLUSTER_NAME:test-enclave-1}
CLUSTER_HTTP_PORT={env:CLUSTER_HTTP_PORT:9083}
DEVSPACE_PROFILE=enclave
allowlist_externals =
tox
commands =
tox -e dev.k8s.start -- --volume /sys/kernel/security:/sys/kernel/security --volume /dev/tmprm0:/dev/tmprm0
tox -e dev.k8s.{posargs:deploy}

[testenv:dev.k8s.destroy]
description = Destroy local Kubernetes cluster
changedir = {toxinidir}/packages/grid
Expand Down