Skip to content

Commit

Permalink
[TT-9266] Added fs support for EDP (#101)
Browse files Browse the repository at this point in the history
* Update chart dependency of tyk-single-dc

* Install enterprise portal only if component is enabled in tyk-single-dc

* Enterprise portal can be deployed as deployment. User can mount exisiting PVC

* Provide a way to set portal storage type

* Mount volumes only if fs type of storage is used

* Add comment on new field added to values.yaml

* Fix linter error

* Fix typo

---------

Co-authored-by: Pranshu <[email protected]>
  • Loading branch information
komalsukhani and singhpr authored Sep 12, 2023
1 parent 6dc091f commit 1a62bcc
Show file tree
Hide file tree
Showing 3 changed files with 37 additions and 7 deletions.
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
apiVersion: apps/v1
kind: StatefulSet
kind: {{ .Values.kind }}
metadata:
name: {{ include "tyk-enterprise-portal.fullname" . }}
labels:
Expand All @@ -8,11 +8,18 @@ metadata:
release: {{ .Release.Name }}
heritage: {{ .Release.Service }}
spec:
{{- if eq .Values.kind "StatefulSet"}}
serviceName: enterprise-portal-svc-{{ include "tyk-enterprise-portal.fullname" . }}
replicas: {{ .Values.replicaCount }}
{{- end }}
{{- if eq .Values.kind "StatefulSet"}}
updateStrategy:
{{- else }}
strategy:
# indicate which strategy we want for rolling update
type: RollingUpdate
{{- end }}
replicas: {{ .Values.replicaCount }}

selector:
matchLabels:
app: {{ include "tyk-enterprise-portal.fullname" . }}
Expand Down Expand Up @@ -73,6 +80,8 @@ spec:
name: secrets-{{ include "tyk-enterprise-portal.fullname" . }}
{{ end }}
key: EnterprisePortalAdminPassword
- name: PORTAL_STORAGE
value: "{{ .Values.storage.type }}"
- name: PORTAL_DATABASE_DIALECT
value: "{{ .Values.storage.database.type }}"
- name: PORTAL_DATABASE_CONNECTIONSTRING
Expand Down Expand Up @@ -129,6 +138,7 @@ spec:
workingDir: /opt/portal
ports:
- containerPort: {{ .Values.containerPort }}
{{ if eq .Values.storage.type "fs" }}
volumeMounts:
- name: enterprise-portal-pvc-{{ include "tyk-enterprise-portal.fullname" . }}
mountPath: /opt/portal/public/system/api_details
Expand Down Expand Up @@ -162,6 +172,7 @@ spec:
mountPath: /opt/portal/db
subPath: db
{{- end }}
{{- end }}
livenessProbe:
httpGet:
scheme: "HTTP{{ if .Values.global.tls.enterprisePortal }}S{{ end }}"
Expand All @@ -180,10 +191,19 @@ spec:
periodSeconds: 10
timeoutSeconds: 3
failureThreshold: 3

{{- if and (eq .Values.kind "Deployment") (eq .Values.storage.type "fs") .Values.storage.persistence.mountExistingPVC }}
volumes:
- name: enterprise-portal-pvc-{{ include "tyk-enterprise-portal.fullname" . }}
persistentVolumeClaim:
claimName: {{ .Values.storage.persistence.mountExistingPVC }}
{{- end }}

{{- if .Values.securityContext }}
securityContext:
{{- toYaml .Values.securityContext | nindent 8 }}
{{- end}}
{{ if and (eq .Values.kind "StatefulSet") (eq .Values.storage.type "fs") }}
volumeClaimTemplates:
- metadata:
name: enterprise-portal-pvc-{{ include "tyk-enterprise-portal.fullname" . }}
Expand Down Expand Up @@ -214,3 +234,4 @@ spec:
{{ $key }}: {{ $value | quote }}
{{- end }}
{{- end }}
{{- end }}
12 changes: 8 additions & 4 deletions components/tyk-enterprise-portal/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -32,12 +32,19 @@ license: ""
#In case you want to deploy enterprise portal as a standalone app, you can configure a different dashboard URL using
#the parameter bellow
overrideTykDashUrl: ""

# Enterprise portal can be deployed as StatefulSet or as Deployment
kind: StatefulSet
storage:
# User can set the storage type for portal.
# Supported types: fs, s3, db
type: "fs"
database:
type: "sqlite3"
connectionString: "db/portal.db"
persistence:
# User can mount existing PVC to enterprise portal
# Make sure to change the kind to Deployment if you are mounting existing PVC
mountExistingPVC: ""
storageClass: ""
accessModes:
- ReadWriteOnce
Expand Down Expand Up @@ -110,9 +117,6 @@ extraVolumes: []
## readOnly: true
extraVolumeMounts: []




livenessProbe:
initialDelaySeconds: 60

Expand Down
7 changes: 6 additions & 1 deletion tyk-single-dc/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -638,16 +638,21 @@ tyk-enterprise-portal:
# is present. The secret is created during the dashboard bootstrapping and
# be turned on and off using the dash.enterprisePortalSecret bool.


# The hostname to bind the Enterprise Portal to.
hostName: tyk-enterprise-portal.local
# Enterprise Portal license.
license: ""
# Enterprise portal can be deployed as StatefulSet or as Deployment
kind: StatefulSet
storage:
# User can set the storage type for portal.
# Supported types: fs, s3, db
type: "fs"
database:
type: "sqlite3"
connectionString: "db/portal.db"
persistence:
mountExistingPVC: ""
storageClass: ""
accessModes:
- ReadWriteOnce
Expand Down

0 comments on commit 1a62bcc

Please sign in to comment.