From bffeefab9b22deeb37c9dff5e87a9be2b42c74b5 Mon Sep 17 00:00:00 2001 From: Shubham Gupta Date: Tue, 30 Apr 2024 21:55:16 +0530 Subject: [PATCH] add rathole to devspace and define a configmap to update server.toml --- packages/grid/devspace.yaml | 13 ++++++++++ .../templates/rathole/rathole-configmap.yaml | 11 ++++++++ .../rathole/rathole-statefulset.yaml | 25 +++++++++++++------ 3 files changed, 41 insertions(+), 8 deletions(-) create mode 100644 packages/grid/helm/syft/templates/rathole/rathole-configmap.yaml diff --git a/packages/grid/devspace.yaml b/packages/grid/devspace.yaml index 75e2757e58a..ae0a17f7ec1 100644 --- a/packages/grid/devspace.yaml +++ b/packages/grid/devspace.yaml @@ -25,6 +25,7 @@ vars: DOCKER_IMAGE_BACKEND: openmined/grid-backend DOCKER_IMAGE_FRONTEND: openmined/grid-frontend DOCKER_IMAGE_SEAWEEDFS: openmined/grid-seaweedfs + DOCKER_IMAGE_RATHOLE: openmined/grid-rathole CONTAINER_REGISTRY: "docker.io" VERSION: "0.8.7-beta.2" PLATFORM: $(uname -m | grep -q 'arm64' && echo "arm64" || echo "amd64") @@ -58,6 +59,14 @@ 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: @@ -109,6 +118,10 @@ dev: - path: ./backend/grid:/root/app/grid - path: ../syft:/root/app/syft ssh: {} + rathole: + labelSelector: + app.kubernetes.io/name: syft + app.kubernetes.io/component: rathole profiles: - name: gateway diff --git a/packages/grid/helm/syft/templates/rathole/rathole-configmap.yaml b/packages/grid/helm/syft/templates/rathole/rathole-configmap.yaml new file mode 100644 index 00000000000..02aca907e6f --- /dev/null +++ b/packages/grid/helm/syft/templates/rathole/rathole-configmap.yaml @@ -0,0 +1,11 @@ +apiVersion: v1 +kind: ConfigMap +metadata: + name: rathole-config + labels: + {{- include "common.labels" . | nindent 4 }} + app.kubernetes.io/component: rathole +data: + myserver.toml: | + [server] + bind_addr = "0.0.0.0:2333" diff --git a/packages/grid/helm/syft/templates/rathole/rathole-statefulset.yaml b/packages/grid/helm/syft/templates/rathole/rathole-statefulset.yaml index ff72a8cb593..992370bbbcb 100644 --- a/packages/grid/helm/syft/templates/rathole/rathole-statefulset.yaml +++ b/packages/grid/helm/syft/templates/rathole/rathole-statefulset.yaml @@ -34,7 +34,7 @@ spec: - name: rathole image: {{ .Values.global.registry }}/openmined/grid-rathole:{{ .Values.global.version }} imagePullPolicy: Always - resources: {{ include "common.resources.set" (dict "resources" .Values.rathole.resources "preset" .Values.rathole.resourcesPreset) | nindent 12 }} + resources: {{ include "common.resources.set" (dict "resources" .Values.rathole.resources "preset" .Values.rathole.resourcesPreset) | nindent 12 }} env: - name: SERVICE_NAME value: "rathole" @@ -65,25 +65,34 @@ spec: failureThreshold: 30 livenessProbe: httpGet: - path: /ping?probe=livenessProbe + path: /?probe=livenessProbe port: api-port periodSeconds: 15 timeoutSeconds: 5 failureThreshold: 3 volumeMounts: - - name: rathole-data - mountPath: /data + - name: rathole-config + mountPath: /app/data/myserver.toml + subPath: myserver.toml readOnly: false - # TODO: Mount the .toml and nginx.conf files + terminationGracePeriodSeconds: 5 + volumes: + - name: rathole-config + configMap: + name: rathole-config + # TODO: Mount the .toml and nginx.conf files # Add any additional container configuration here # such as environment variables, volumes, etc. volumeClaimTemplates: - metadata: name: rathole-data + labels: + {{- include "common.volumeLabels" . | nindent 8 }} + app.kubernetes.io/component: rathole spec: - accessModes: [ "ReadWriteOnce" ] + accessModes: + - ReadWriteOnce resources: requests: - storage: {{ .Values.rathole.volumeSize | quote }} - storageClassName: {{ .Values.rathole.storageClassName | quote }} \ No newline at end of file + storage: 10Mi \ No newline at end of file