diff --git a/components/tyk-enterprise-portal/templates/statefulset-enterprise-portal.yaml b/components/tyk-enterprise-portal/templates/statefulset-enterprise-portal.yaml index 8f5a6e66..3a2209c1 100644 --- a/components/tyk-enterprise-portal/templates/statefulset-enterprise-portal.yaml +++ b/components/tyk-enterprise-portal/templates/statefulset-enterprise-portal.yaml @@ -1,5 +1,5 @@ apiVersion: apps/v1 -kind: StatefulSet +kind: {{ .Values.kind }} metadata: name: {{ include "tyk-enterprise-portal.fullname" . }} labels: @@ -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" . }} @@ -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 @@ -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 @@ -162,6 +172,7 @@ spec: mountPath: /opt/portal/db subPath: db {{- end }} + {{- end }} livenessProbe: httpGet: scheme: "HTTP{{ if .Values.global.tls.enterprisePortal }}S{{ end }}" @@ -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" . }} @@ -214,3 +234,4 @@ spec: {{ $key }}: {{ $value | quote }} {{- end }} {{- end }} + {{- end }} diff --git a/components/tyk-enterprise-portal/values.yaml b/components/tyk-enterprise-portal/values.yaml index b476bd40..4b216f30 100644 --- a/components/tyk-enterprise-portal/values.yaml +++ b/components/tyk-enterprise-portal/values.yaml @@ -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 @@ -110,9 +117,6 @@ extraVolumes: [] ## readOnly: true extraVolumeMounts: [] - - - livenessProbe: initialDelaySeconds: 60 diff --git a/tyk-single-dc/values.yaml b/tyk-single-dc/values.yaml index bfe768cf..c8875e81 100644 --- a/tyk-single-dc/values.yaml +++ b/tyk-single-dc/values.yaml @@ -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