From cf8abf9cb1eb3e55c9472ed0763eb566279a6731 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jakub=20Boche=C5=84ski?= Date: Wed, 30 Aug 2023 18:29:08 +0200 Subject: [PATCH] feat: Allow disabling scratch volume --- .../templates/deployment-gw-repset.yaml | 21 +++++++++++++++++++ components/tyk-gateway/values.yaml | 3 +++ 2 files changed, 24 insertions(+) diff --git a/components/tyk-gateway/templates/deployment-gw-repset.yaml b/components/tyk-gateway/templates/deployment-gw-repset.yaml index 3780225b9..af3201f05 100644 --- a/components/tyk-gateway/templates/deployment-gw-repset.yaml +++ b/components/tyk-gateway/templates/deployment-gw-repset.yaml @@ -56,6 +56,7 @@ spec: {{- with .Values.gateway.imagePullSecrets }} imagePullSecrets: {{ toYaml . | nindent 8 }} {{- end }} + {{- if .Values.gateway.scratch.enabled }} initContainers: - name: "setup-directories" image: busybox:1.32 @@ -64,6 +65,7 @@ spec: volumeMounts: - name: tyk-scratch mountPath: /mnt/tyk-gateway + {{- end }} containers: - name: gateway-{{ .Chart.Name }} image: "{{ .Values.gateway.image.repository }}:{{ .Values.gateway.image.tag }}" @@ -139,12 +141,19 @@ spec: value: "/opt/tyk-gateway/templates" - name: TYK_GW_TYKJSPATH value: "/opt/tyk-gateway/js/tyk.js" + {{- if .Values.gateway.scratch.enabled }} - name: TYK_GW_MIDDLEWAREPATH value: "/mnt/tyk-gateway/middleware" - name: TYK_GW_APPPATH value: "/mnt/tyk-gateway/apps" - name: TYK_GW_POLICIES_POLICYPATH value: "/mnt/tyk-gateway/policies" + {{- else}} + - name: TYK_GW_MIDDLEWAREPATH + value: "/opt/tyk-gateway/middleware" + - name: TYK_GW_APPPATH + value: "/opt/tyk-gateway/apps" + {{- end}} - name: TYK_GW_STORAGE_MAXIDLE value: "1000" - name: TYK_GW_OPTIMISATIONSUSEASYNCSESSIONWRITE @@ -185,7 +194,11 @@ spec: {{- if .Values.global.remoteControlPlane.enabled }} value: "tyk_policies" {{- else}} + {{- if .Values.gateway.scratch.enabled }} value: "/mnt/tyk-gateway/policies/policies.json" + {{- else}} + value: "/opt/tyk-gateway/policies/policies.json" + {{- end}} {{- end}} - name: TYK_GW_HASHKEYS value: "true" @@ -208,7 +221,11 @@ spec: - name: TYK_GW_ENABLECUSTOMDOMAINS value: "true" - name: TYK_GW_PIDFILELOCATION + {{- if .Values.gateway.scratch.enabled }} value: "/mnt/tyk-gateway/tyk.pid" + {{- else}} + value: "/opt/tyk-gateway/tyk.pid" + {{- end}} - name: TYK_GW_DBAPPCONFOPTIONS_CONNECTIONSTRING value: "{{ include "tyk-gateway.dash_proto" . }}://dashboard-svc-{{ .Release.Name }}-tyk-dashboard.{{ .Release.Namespace }}.svc.cluster.local:{{ .Values.global.servicePorts.dashboard}}" @@ -242,8 +259,10 @@ spec: - name: {{ .Values.gateway.tls.secretName }} mountPath: /etc/certs {{ end }} + {{- if .Values.gateway.scratch.enabled }} - name: tyk-scratch mountPath: /mnt/tyk-gateway + {{ end }} {{- if .Values.gateway.extraVolumeMounts }} {{- include "tyk-gateway.tplvalues.render" (dict "value" .Values.gateway.extraVolumeMounts "context" $) | nindent 10 }} {{- end }} @@ -278,8 +297,10 @@ spec: {{- toYaml .Values.gateway.securityContext | nindent 10 }} {{- end }} volumes: + {{- if .Values.gateway.scratch.enabled }} - name: tyk-scratch emptyDir: {} + {{ end }} {{ if .Values.global.tls.gateway }} - name: {{ .Values.gateway.tls.secretName }} secret: diff --git a/components/tyk-gateway/values.yaml b/components/tyk-gateway/values.yaml index 2cb5f150f..362405dea 100644 --- a/components/tyk-gateway/values.yaml +++ b/components/tyk-gateway/values.yaml @@ -145,6 +145,9 @@ gateway: # image pull secrets to use when pulling images from repository imagePullSecrets: [] + scratch: + enabled: true + service: # type of service type: NodePort