From c2ab1029579cb98fb763ac4fd9996242957bfac0 Mon Sep 17 00:00:00 2001 From: Yash Gorana Date: Sun, 30 Jun 2024 17:24:45 +0530 Subject: [PATCH] fix charts --- packages/grid/devspace.yaml | 126 +++++++++--------- .../dev/base.yaml} | 29 ++-- .../grid/helm/examples/dev/domain.tunnel.yaml | 11 ++ packages/grid/helm/examples/dev/enclave.yaml | 8 ++ packages/grid/helm/examples/dev/gateway.yaml | 14 ++ packages/grid/helm/syft/values.yaml | 8 +- packages/grid/helm/values.dev.high.yaml | 48 ------- packages/grid/helm/values.dev.low.yaml | 48 ------- tox.ini | 21 ++- 9 files changed, 133 insertions(+), 180 deletions(-) rename packages/grid/helm/{values.dev.yaml => examples/dev/base.yaml} (74%) create mode 100644 packages/grid/helm/examples/dev/domain.tunnel.yaml create mode 100644 packages/grid/helm/examples/dev/enclave.yaml create mode 100644 packages/grid/helm/examples/dev/gateway.yaml delete mode 100644 packages/grid/helm/values.dev.high.yaml delete mode 100644 packages/grid/helm/values.dev.low.yaml diff --git a/packages/grid/devspace.yaml b/packages/grid/devspace.yaml index b961d17da26..8bbf3487daf 100644 --- a/packages/grid/devspace.yaml +++ b/packages/grid/devspace.yaml @@ -60,14 +60,6 @@ images: context: ./seaweedfs tags: - dev-${DEVSPACE_TIMESTAMP} - rathole: - image: "${CONTAINER_REGISTRY}/${DOCKER_IMAGE_RATHOLE}" - buildKit: - args: ["--platform", "linux/${PLATFORM}"] - dockerfile: ./rathole/rathole.dockerfile - context: ./rathole - tags: - - dev-${DEVSPACE_TIMESTAMP} # This is a list of `deployments` that DevSpace can create for this project deployments: @@ -76,20 +68,16 @@ deployments: releaseName: syft-dev chart: name: ./helm/syft - # anything that does not need devspace $env vars should go in values.dev.yaml - valuesFiles: - - ./helm/syft/values.yaml - - ./helm/values.dev.yaml + # values that need to be templated go here values: global: registry: ${CONTAINER_REGISTRY} version: dev-${DEVSPACE_TIMESTAMP} - node: - type: domain # required for the gateway profile - rtunnel: - mode: client - proxy: - enabled: true # required for the gateway profile + node: {} + # anything that does not need templating should go in helm/examples/dev/base.yaml + # or profile specific values files + valuesFiles: + - ./helm/examples/dev/base.yaml dev: mongo: @@ -127,69 +115,86 @@ dev: - path: ../syft:/root/app/syft ssh: localPort: 3480 - rathole: - labelSelector: - app.kubernetes.io/name: syft - app.kubernetes.io/component: rathole - ports: - - port: "2333" # reverse_tunnel profiles: - - name: dev-low + - name: domain-low + description: "Deploy a low-side domain" patches: - op: add path: deployments.syft.helm.values.node value: side: low - - name: dev-high + + - name: domain-tunnel + description: "Deploy a domain with tunneling enabled" patches: + # enable rathole image - op: add - path: deployments.syft.helm.values.node + path: images value: - side: high + rathole: + image: "${CONTAINER_REGISTRY}/${DOCKER_IMAGE_RATHOLE}" + buildKit: + args: ["--platform", "linux/${PLATFORM}"] + dockerfile: ./rathole/rathole.dockerfile + context: ./rathole + tags: + - dev-${DEVSPACE_TIMESTAMP} + # use rathole client-specific chart values + - op: add + path: deployments.syft.helm.valuesFiles + value: ./helm/examples/dev/domain.tunnel.yaml - name: gateway + description: "Deploy a Gateway Node with tunnel enabled" patches: - - op: replace - path: deployments.syft.helm.values.node.type - value: "gateway" + # enable rathole image + - op: add + path: images + value: + rathole: + image: "${CONTAINER_REGISTRY}/${DOCKER_IMAGE_RATHOLE}" + buildKit: + args: ["--platform", "linux/${PLATFORM}"] + dockerfile: ./rathole/rathole.dockerfile + context: ./rathole + tags: + - dev-${DEVSPACE_TIMESTAMP} + # enable rathole `devspace dev` config + - op: add + path: dev + value: + rathole: + labelSelector: + app.kubernetes.io/name: syft + app.kubernetes.io/component: rathole + ports: + - port: "2333" + # use gateway-specific chart values + - op: add + path: deployments.syft.helm.valuesFiles + value: ./helm/examples/dev/gateway.yaml + # remove unused images - op: remove path: images.seaweedfs - op: remove path: dev.seaweedfs - - # Patch mode to server - - op: replace - path: deployments.syft.helm.values.rtunnel.mode - value: server - - # Enable proxy for gateway - - op: replace - path: deployments.syft.helm.values.proxy.enabled - value: true - # 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 - - # Reverse tunnel port - op: replace path: dev.rtunnel.ports[0].port value: 2334:2333 - name: gcp + description: "Deploy a high-side domain on GCP" patches: - op: replace path: deployments.syft.helm.valuesFiles @@ -197,6 +202,7 @@ profiles: - ./helm/examples/gcp/gcp.high.yaml - name: gcp-low + description: "Deploy a low-side domain on GCP" patches: - op: replace path: deployments.syft.helm.valuesFiles @@ -204,6 +210,7 @@ profiles: - ./helm/examples/gcp/gcp.low.yaml - name: azure + description: "Deploy a high-side domain on AKS" patches: - op: replace path: deployments.syft.helm.valuesFiles @@ -211,11 +218,9 @@ profiles: - ./helm/examples/azure/azure.high.yaml - name: enclave + description: "Deploy an enclave node" patches: - - op: replace - path: deployments.syft.helm.values.node.type - value: "enclave" - + # enable image build for enclave-attestation - op: add path: images value: @@ -233,29 +238,20 @@ profiles: enclave-attestation: sync: - path: ./enclave/attestation/server:/app/server - + # use gateway-specific chart values - op: add - path: deployments.syft.helm.values - value: - attestation: - enabled: true - + path: deployments.syft.helm.valuesFiles + value: ./helm/examples/dev/enclave.yaml # 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: diff --git a/packages/grid/helm/values.dev.yaml b/packages/grid/helm/examples/dev/base.yaml similarity index 74% rename from packages/grid/helm/values.dev.yaml rename to packages/grid/helm/examples/dev/base.yaml index 493850cbb67..b81e4847cd8 100644 --- a/packages/grid/helm/values.dev.yaml +++ b/packages/grid/helm/examples/dev/base.yaml @@ -1,15 +1,9 @@ -# Helm chart values used for development and testing -# Can be used through `helm install -f values.dev.yaml` or devspace `valuesFiles` +# Base Helm chart values used for development and testing +# Can be used through `helm install -f packages/grid/helm/examples/dev/base.yaml` or devspace `valuesFiles` global: randomizedSecrets: false -registry: - resourcesPreset: null - resources: null - - storageSize: "5Gi" - node: rootEmail: info@openmined.org associationRequestAutoApproval: true @@ -44,14 +38,21 @@ frontend: resources: null proxy: + enabled: true + resourcesPreset: null resources: null -rtunnel: +registry: enabled: true - logLevel: "trace" -# attestation: -# enabled: true -# resourcesPreset: null -# resources: null + resourcesPreset: null + resources: null + + storageSize: "5Gi" + +rtunnel: + enabled: false + +attestation: + enabled: false diff --git a/packages/grid/helm/examples/dev/domain.tunnel.yaml b/packages/grid/helm/examples/dev/domain.tunnel.yaml new file mode 100644 index 00000000000..cec2e97cc6e --- /dev/null +++ b/packages/grid/helm/examples/dev/domain.tunnel.yaml @@ -0,0 +1,11 @@ +# Values for deploying a domain with a reverse tunnel server in client-mode +# Patched on top of patch `base.yaml` + +# Proxy is required for the tunnel to work +proxy: + enabled: true + +rtunnel: + enabled: true + mode: client + logLevel: debug diff --git a/packages/grid/helm/examples/dev/enclave.yaml b/packages/grid/helm/examples/dev/enclave.yaml new file mode 100644 index 00000000000..2951da06b05 --- /dev/null +++ b/packages/grid/helm/examples/dev/enclave.yaml @@ -0,0 +1,8 @@ +# Values for deploying an enclave +# Patched on top of patch `base.yaml` + +node: + type: enclave + +attestation: + enabled: true diff --git a/packages/grid/helm/examples/dev/gateway.yaml b/packages/grid/helm/examples/dev/gateway.yaml new file mode 100644 index 00000000000..e0916c98c21 --- /dev/null +++ b/packages/grid/helm/examples/dev/gateway.yaml @@ -0,0 +1,14 @@ +# Values for deploying a gateway with a reverse tunnel server +# Patched on top of patch `base.yaml` + +node: + type: gateway + +# Proxy is required for the tunnel to work +proxy: + enabled: true + +rtunnel: + enabled: true + mode: server + logLevel: debug diff --git a/packages/grid/helm/syft/values.yaml b/packages/grid/helm/syft/values.yaml index b5372d8e857..377bd763c54 100644 --- a/packages/grid/helm/syft/values.yaml +++ b/packages/grid/helm/syft/values.yaml @@ -134,6 +134,7 @@ proxy: registry: enabled: true + # Extra environment vars env: null @@ -239,14 +240,15 @@ ingress: rtunnel: - # Extra environment vars - env: null enabled: false - logLevel: "info" + logLevel: info port: 2333 mode: client + # Extra environment vars + env: null + # Pod labels & annotations podLabels: null podAnnotations: null diff --git a/packages/grid/helm/values.dev.high.yaml b/packages/grid/helm/values.dev.high.yaml deleted file mode 100644 index 9a0e266704a..00000000000 --- a/packages/grid/helm/values.dev.high.yaml +++ /dev/null @@ -1,48 +0,0 @@ -# Helm chart values used for development and testing -# Can be used through `helm install -f values.dev.yaml` or devspace `valuesFiles` - -global: - randomizedSecrets: false - -registry: - resourcesPreset: null - resources: null - - storageSize: "5Gi" - -node: - rootEmail: info@openmined.org - side: high - - resourcesPreset: 2xlarge - resources: null - - defaultWorkerPool: - count: 1 - podLabels: null - podAnnotations: null - - secret: - defaultRootPassword: changethis - -mongo: - resourcesPreset: null - resources: null - - secret: - rootPassword: example - -seaweedfs: - resourcesPreset: null - resources: null - - secret: - s3RootPassword: admin - -frontend: - resourcesPreset: null - resources: null - -proxy: - resourcesPreset: null - resources: null diff --git a/packages/grid/helm/values.dev.low.yaml b/packages/grid/helm/values.dev.low.yaml deleted file mode 100644 index 7e5de1a68f2..00000000000 --- a/packages/grid/helm/values.dev.low.yaml +++ /dev/null @@ -1,48 +0,0 @@ -# Helm chart values used for development and testing -# Can be used through `helm install -f values.dev.yaml` or devspace `valuesFiles` - -global: - randomizedSecrets: false - -registry: - resourcesPreset: null - resources: null - - storageSize: "5Gi" - -node: - rootEmail: info@openmined.org - side: low - - resourcesPreset: 2xlarge - resources: null - - defaultWorkerPool: - count: 1 - podLabels: null - podAnnotations: null - - secret: - defaultRootPassword: changethis - -mongo: - resourcesPreset: null - resources: null - - secret: - rootPassword: example - -seaweedfs: - resourcesPreset: null - resources: null - - secret: - s3RootPassword: admin - -frontend: - resourcesPreset: null - resources: null - -proxy: - resourcesPreset: null - resources: null diff --git a/tox.ini b/tox.ini index 6fdda86e25c..7955837a2ae 100644 --- a/tox.ini +++ b/tox.ini @@ -471,7 +471,7 @@ commands = # Creating test-domain-1 cluster on port 9082 bash -c '\ - export CLUSTER_NAME=${DOMAIN_CLUSTER_NAME} CLUSTER_HTTP_PORT=9082 && \ + export CLUSTER_NAME=${DOMAIN_CLUSTER_NAME} CLUSTER_HTTP_PORT=9082 DEVSPACE_PROFILE=domain-tunnel && \ tox -e dev.k8s.start && \ tox -e dev.k8s.deploy' @@ -874,6 +874,23 @@ 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.render] +description = Dump devspace rendered chargs for debugging. Save in `packages/grid/out.render` +changedir = {toxinidir}/packages/grid +passenv = HOME, USER, DEVSPACE_PROFILE +setenv= + OUTPUT_DIR = {env:OUTPUT_DIR:./.devspace/rendered} +allowlist_externals = + bash +commands = + bash -c '\ + if [[ -n "${DEVSPACE_PROFILE}" ]]; then export DEVSPACE_PROFILE="-p ${DEVSPACE_PROFILE}"; fi && \ + rm -rf ${OUTPUT_DIR} && \ + mkdir -p ${OUTPUT_DIR} && \ + echo "profile: $DEVSPACE_PROFILE" && \ + devspace print ${DEVSPACE_PROFILE} > ${OUTPUT_DIR}/config.txt && \ + devspace deploy --render --skip-build --no-warn ${DEVSPACE_PROFILE} --namespace syft --var CONTAINER_REGISTRY=k3d-registry.localhost:5800 > ${OUTPUT_DIR}/chart.yaml' + [testenv:dev.k8s.launch.gateway] description = Launch a single gateway on K8s passenv = HOME, USER @@ -888,7 +905,7 @@ commands = tox -e dev.k8s.{posargs:deploy} [testenv:dev.k8s.launch.domain] -description = Launch a single domain on K8s +description = Launch a single domain on K8s passenv = HOME, USER setenv= CLUSTER_NAME = {env:CLUSTER_NAME:test-domain-1}