From 53587f16bcbac576a884f9110a1e6a130b187e38 Mon Sep 17 00:00:00 2001 From: Marton Schneider Date: Fri, 1 Dec 2023 11:24:17 +0100 Subject: [PATCH] feat: add init container to check dep. services --- appwrite/Chart.yaml | 2 +- appwrite/templates/_pod.tpl | 19 +++++++++++++++++++ appwrite/values.yaml | 12 ++++++++++-- 3 files changed, 30 insertions(+), 3 deletions(-) diff --git a/appwrite/Chart.yaml b/appwrite/Chart.yaml index 1dfcacf..824d19d 100644 --- a/appwrite/Chart.yaml +++ b/appwrite/Chart.yaml @@ -9,7 +9,7 @@ keywords: - "appwrite" icon: "https://appwrite.io/images/logos/logo.svg" type: application -version: 0.1.13 +version: 0.1.14 appVersion: "1.4.13" kubeVersion: ">=1.26" deprecated: false diff --git a/appwrite/templates/_pod.tpl b/appwrite/templates/_pod.tpl index 97ab2b2..bf56940 100644 --- a/appwrite/templates/_pod.tpl +++ b/appwrite/templates/_pod.tpl @@ -9,6 +9,25 @@ securityContext: {{- toYaml . | nindent 2 }} {{- end }} restartPolicy: {{ .component.config.restartPolicy }} +{{- if .component.config.test }} +initContainers: + {{- $configname := (printf "%s-env" (include "appwrite.fullname" .)) -}} + {{- range $i, $v := .component.config.test }} + - name: "dependency-test-{{ $i }}" + image: ghcr.io/schneidermr/kubernetes-tools:telnet-test + env: + - name: TEST_HOST + valueFrom: + configMapKeyRef: + name: {{ $configname }} + key: {{ $v.hostkey }} + - name: TEST_PORT + valueFrom: + configMapKeyRef: + name: {{ $configname }} + key: {{ $v.portkey }} + {{- end }} +{{- end }} containers: - name: {{ .component.name }} {{- with .component.config.containerSecurityContext }} diff --git a/appwrite/values.yaml b/appwrite/values.yaml index c824aa7..52fc677 100644 --- a/appwrite/values.yaml +++ b/appwrite/values.yaml @@ -328,12 +328,12 @@ components: # -- Define the rediness probe readinessProbe: httpGet: - path: /api/health + path: / port: 80 # -- Define the liveness probe livenessProbe: httpGet: - path: /api/health + path: / port: 80 initialDelaySeconds: 30 timeoutSeconds: 30 @@ -360,6 +360,11 @@ components: - name: http containerPort: 80 protocol: TCP + test: + - hostkey: _APP_REDIS_HOST + portkey: _APP_REDIS_PORT + - hostkey: _APP_DB_HOST + portkey: _APP_DB_PORT # Service configuration service: @@ -568,6 +573,9 @@ components: - name: http containerPort: 80 protocol: TCP + test: + - hostkey: _APP_REDIS_HOST + portkey: _APP_REDIS_PORT # Service configuration service: