Skip to content

Commit

Permalink
feat: Allow disabling scratch volume
Browse files Browse the repository at this point in the history
  • Loading branch information
jakub-bochenski committed Aug 31, 2023
1 parent a382191 commit 9f8fd34
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 1 deletion.
23 changes: 22 additions & 1 deletion components/tyk-gateway/templates/deployment-gw-repset.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -53,14 +53,16 @@ spec:
affinity:
{{ toYaml .Values.gateway.affinity | indent 8 }}
{{- end }}
{{- if .Values.gateway.scratch.enabled }}
initContainers:
- name: "setup-directories"
image: busybox:1.32
command: ['sh','-c','mkdir -p apps middleware policies && touch policies/policies.json']
workingDir: /mnt/tyk-gateway
volumeMounts:
- name: tyk-scratch
mountPath: /mnt/tyk-gateway
mountPath: /mnt/tyk-gateway
{{- end }}
containers:
- name: gateway-{{ .Chart.Name }}
image: "{{ .Values.gateway.image.repository }}:{{ .Values.gateway.image.tag }}"
Expand Down Expand Up @@ -136,12 +138,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
Expand Down Expand Up @@ -180,7 +189,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"
Expand All @@ -203,7 +216,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}}"
Expand Down Expand Up @@ -244,8 +261,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 }}
Expand Down Expand Up @@ -280,8 +299,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:
Expand Down
3 changes: 3 additions & 0 deletions components/tyk-gateway/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,9 @@ gateway:
# image pull policy for Tyk Gateway
pullPolicy: IfNotPresent

scratch:
enabled: true

service:
# type of service
type: NodePort
Expand Down

0 comments on commit 9f8fd34

Please sign in to comment.