From b4af47fa5f6a263579a008a8e578e45c0343d3c4 Mon Sep 17 00:00:00 2001 From: Jacob Pleiness Date: Fri, 4 Nov 2022 11:42:00 -0400 Subject: [PATCH 1/3] test-connection: allow pod to be disabled or changed * Add `testConnection` to `values.yaml` * Modify `test-connection.yaml` to use templating * Add test-connection to configuration options in `README.md` --- charts/sourcegraph/README.md | 4 ++++ .../sourcegraph/templates/tests/test-connection.yaml | 11 ++++++++--- charts/sourcegraph/values.yaml | 11 +++++++++++ 3 files changed, 23 insertions(+), 3 deletions(-) diff --git a/charts/sourcegraph/README.md b/charts/sourcegraph/README.md index 1d26cf73..fdab8e81 100644 --- a/charts/sourcegraph/README.md +++ b/charts/sourcegraph/README.md @@ -332,6 +332,10 @@ In addition to the documented values, all services also support the following va | syntectServer.resources | object | `{"limits":{"cpu":"4","memory":"6G"},"requests":{"cpu":"250m","memory":"2G"}}` | Resource requests & limits for the `syntect-server` container, learn more from the [Kubernetes documentation](https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/) | | syntectServer.serviceAccount.create | bool | `false` | Enable creation of ServiceAccount for `syntect-server` | | syntectServer.serviceAccount.name | string | `""` | Name of the ServiceAccount to be created or an existing ServiceAccount | +| testConnection.enabled | bool | `true` | Enable `test-connection` test | +| testConnection.image.defaultTag | string | `"latest"` | Docker image tag for the `test-connection` image | +| testConnection.image.name | string | `"busybox"` | Docker image name for the `test-connection` image | +| testConnection.name | string| `"sg-test-connection"` | Name used by resources. Does not effect service names of PVCs. | | worker.containerSecurityContext | object | `{"allowPrivilegeEscalation":false,"readOnlyRootFilesystem":true,"runAsGroup":101,"runAsUser":100}` | Security context for the `worker` container, learn more from the [Kubernetes documentation](https://kubernetes.io/docs/tasks/configure-pod-container/security-context/#set-the-security-context-for-a-container) | | worker.image.defaultTag | string | `"4.1.2@sha256:79c85866469e96379a6f0b36c2deee08ba3d81520f6fffc8de16a6e7667a67ab"` | Docker image tag for the `worker` image | | worker.image.name | string | `"worker"` | Docker image name for the `worker` image | diff --git a/charts/sourcegraph/templates/tests/test-connection.yaml b/charts/sourcegraph/templates/tests/test-connection.yaml index 8bf16f39..45a23c1a 100644 --- a/charts/sourcegraph/templates/tests/test-connection.yaml +++ b/charts/sourcegraph/templates/tests/test-connection.yaml @@ -1,15 +1,20 @@ +{{- if .Values.testConnection.enabled -}} apiVersion: v1 kind: Pod metadata: - name: "sg-test-connection" + name: {{ .Values.testConnection.name }} labels: {{- include "sourcegraph.labels" . | nindent 4 }} + {{- if .Values.testConnection.labels }} + {{- toYaml .Values.testConnection.labels | nindent 4 }} + {{- end }} annotations: "helm.sh/hook": test spec: containers: - name: wget - image: busybox + image: {{ .Values.testConnection.image.name }}:{{ .Values.testConnection.image.defaultTag }} command: ['wget'] args: ['sourcegraph-frontend:30080/'] - restartPolicy: Never \ No newline at end of file + restartPolicy: Never +{{- end }} \ No newline at end of file diff --git a/charts/sourcegraph/values.yaml b/charts/sourcegraph/values.yaml index f6dc74e1..55201c65 100644 --- a/charts/sourcegraph/values.yaml +++ b/charts/sourcegraph/values.yaml @@ -1255,6 +1255,17 @@ worker: create: false # -- Name of the ServiceAccount to be created or an existing ServiceAccount name: "" + +testConnection: + # -- Enable `test-connection` + enabled: true + image: + # -- Docker image tag for the `test-connection` image + defaultTag: "latest" + # -- Docker image name for the `test-connection` image + name: "busybox" + # -- Name used by resources. Does not affect service names or PVCs. + name: "sg-test-connection" # -- Additional resources to include in the rendered manifest. Templates are supported. extraResources: [] From f085c669777ef542bf3b5ac3bd86e074f1b673dd Mon Sep 17 00:00:00 2001 From: Jacob Pleiness Date: Fri, 4 Nov 2022 12:22:29 -0400 Subject: [PATCH 2/3] Revert changes to `README.md` --- charts/sourcegraph/README.md | 4 ---- 1 file changed, 4 deletions(-) diff --git a/charts/sourcegraph/README.md b/charts/sourcegraph/README.md index fdab8e81..1d26cf73 100644 --- a/charts/sourcegraph/README.md +++ b/charts/sourcegraph/README.md @@ -332,10 +332,6 @@ In addition to the documented values, all services also support the following va | syntectServer.resources | object | `{"limits":{"cpu":"4","memory":"6G"},"requests":{"cpu":"250m","memory":"2G"}}` | Resource requests & limits for the `syntect-server` container, learn more from the [Kubernetes documentation](https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/) | | syntectServer.serviceAccount.create | bool | `false` | Enable creation of ServiceAccount for `syntect-server` | | syntectServer.serviceAccount.name | string | `""` | Name of the ServiceAccount to be created or an existing ServiceAccount | -| testConnection.enabled | bool | `true` | Enable `test-connection` test | -| testConnection.image.defaultTag | string | `"latest"` | Docker image tag for the `test-connection` image | -| testConnection.image.name | string | `"busybox"` | Docker image name for the `test-connection` image | -| testConnection.name | string| `"sg-test-connection"` | Name used by resources. Does not effect service names of PVCs. | | worker.containerSecurityContext | object | `{"allowPrivilegeEscalation":false,"readOnlyRootFilesystem":true,"runAsGroup":101,"runAsUser":100}` | Security context for the `worker` container, learn more from the [Kubernetes documentation](https://kubernetes.io/docs/tasks/configure-pod-container/security-context/#set-the-security-context-for-a-container) | | worker.image.defaultTag | string | `"4.1.2@sha256:79c85866469e96379a6f0b36c2deee08ba3d81520f6fffc8de16a6e7667a67ab"` | Docker image tag for the `worker` image | | worker.image.name | string | `"worker"` | Docker image name for the `worker` image | From b61f8621459a495fee7c8339ac84bbf4b33cbaa8 Mon Sep 17 00:00:00 2001 From: Jacob Pleiness Date: Fri, 4 Nov 2022 15:10:04 -0400 Subject: [PATCH 3/3] Update README.md via `./scripts/helm-docs.sh` --- charts/sourcegraph/README.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/charts/sourcegraph/README.md b/charts/sourcegraph/README.md index 1d26cf73..bfb54dbc 100644 --- a/charts/sourcegraph/README.md +++ b/charts/sourcegraph/README.md @@ -332,6 +332,10 @@ In addition to the documented values, all services also support the following va | syntectServer.resources | object | `{"limits":{"cpu":"4","memory":"6G"},"requests":{"cpu":"250m","memory":"2G"}}` | Resource requests & limits for the `syntect-server` container, learn more from the [Kubernetes documentation](https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/) | | syntectServer.serviceAccount.create | bool | `false` | Enable creation of ServiceAccount for `syntect-server` | | syntectServer.serviceAccount.name | string | `""` | Name of the ServiceAccount to be created or an existing ServiceAccount | +| testConnection.enabled | bool | `true` | Enable `test-connection` | +| testConnection.image.defaultTag | string | `"latest"` | Docker image tag for the `test-connection` image | +| testConnection.image.name | string | `"busybox"` | Docker image name for the `test-connection` image | +| testConnection.name | string | `"sg-test-connection"` | Name used by resources. Does not affect service names or PVCs. | | worker.containerSecurityContext | object | `{"allowPrivilegeEscalation":false,"readOnlyRootFilesystem":true,"runAsGroup":101,"runAsUser":100}` | Security context for the `worker` container, learn more from the [Kubernetes documentation](https://kubernetes.io/docs/tasks/configure-pod-container/security-context/#set-the-security-context-for-a-container) | | worker.image.defaultTag | string | `"4.1.2@sha256:79c85866469e96379a6f0b36c2deee08ba3d81520f6fffc8de16a6e7667a67ab"` | Docker image tag for the `worker` image | | worker.image.name | string | `"worker"` | Docker image name for the `worker` image |