Split Tornjak Frontend into separate subchart (#179)

Signed-off-by: Mariusz Sabath <[email protected]>
Signed-off-by: Marco Franssen <[email protected]>
Co-authored-by: Marco Franssen <[email protected]>
This commit is contained in:
Mariusz Sabath
2023-05-16 19:31:38 +02:00
committed by Marco Franssen
co-authored by Marco Franssen
parent 6d221263fb
commit da186c5f53
21 changed files with 478 additions and 95 deletions
@@ -8,17 +8,14 @@ Installed {{ .Chart.Name }}…
{{- if eq (.Values.tornjak.enabled | toString) "true" }}
### WARNING ###
This Tornjak is configured without authentication and it is intended for
testing only. Please do not use this version in production.
Tornjak APIs (Backend):
kubectl -n {{ include "spire-server.namespace" . }} port-forward {{ include "spire-server.fullname" . }}-0 10000:10000
kubectl -n {{ include "spire-server.namespace" . }} port-forward {{ include "spire-server.fullname" . }}-0 {{ .Values.tornjak.service.port }}:10000
Tornjak UI (Frontend):
kubectl -n {{ include "spire-server.namespace" . }} port-forward {{ include "spire-server.fullname" . }}-0 3000:3000
Tornjak API access: {{ include "tornjak.apiURL" . }}
Tornjak UI access: {{ include "tornjak.frontendURL" . }}
Open browser to: http://localhost:{{ .Values.tornjak.service.port }}
Installed {{ include "spire-tornjak.fullname" . }}…
{{- end }}
@@ -164,9 +164,6 @@ Tornjak specific section
{{- define "spire-tornjak.config" -}}
{{ include "spire-tornjak.fullname" . }}-config
{{- end }}
{{- define "spire-tornjak.frontend" -}}
{{ include "spire-tornjak.fullname" . }}-fe
{{- end }}
{{- define "spire-tornjak.backend" -}}
{{ include "spire-tornjak.fullname" . }}-be
{{- end }}
@@ -31,31 +31,22 @@ spec:
---
apiVersion: v1
kind: Service
metadata:
namespace: {{ include "spire-server.namespace" . }}
name: {{ include "spire-tornjak.frontend" . }}
spec:
type: {{ .Values.service.type }} # ClusterIP
selector:
{{- include "spire-server.selectorLabels" . | nindent 4 }}
ports:
- name: {{ include "spire-tornjak.frontend" . }}
port: 3000
targetPort: 3000
protocol: TCP
---
apiVersion: v1
kind: Service
metadata:
namespace: {{ include "spire-server.namespace" . }}
name: {{ include "spire-tornjak.backend" . }}
{{- with .Values.tornjak.service.annotations }}
annotations:
{{- toYaml . | nindent 8 }}
{{- end }}
labels:
{{- include "spire-server.labels" . | nindent 4 }}
spec:
type: {{ .Values.service.type }} # ClusterIP
type: {{ .Values.tornjak.service.type }}
selector:
{{- include "spire-server.selectorLabels" . | nindent 4 }}
ports:
- name: {{ include "spire-tornjak.backend" . }}
port: 10000
targetPort: 10000
port: {{ .Values.tornjak.service.port }}
targetPort: tornjak
protocol: TCP
{{- end }}
@@ -167,39 +167,35 @@ spec:
startupProbe:
httpGet:
scheme: HTTP
port: 3000
failureThreshold: 6
initialDelaySeconds: 60
periodSeconds: 30
port: 10000
failureThreshold: 3
initialDelaySeconds: 5
periodSeconds: 10
successThreshold: 1
timeoutSeconds: 10
env:
{{- if .Values.tornjak.config.frontend }}
- name: REACT_APP_API_SERVER_URI
value: {{ include "tornjak.apiURL" . | required "Either .Values.tornjak.config.backend.ingress or .Values.tornjak.config.frontend.apiServerURL is required." }}
{{- end }}
timeoutSeconds: 5
args:
- -c
- /run/spire/config/server.conf
- -t
- /run/spire/tornjak-config/server.conf
- -c
- /run/spire/config/server.conf
- -t
- /run/spire/tornjak-config/server.conf
ports:
- containerPort: 3000
protocol: TCP
- name: tornjak
containerPort: 10000
protocol: TCP
volumeMounts:
- name: {{ include "spire-tornjak.config" . }}
mountPath: /run/spire/tornjak-config
- name: spire-server-socket
mountPath: /tmp/spire-server/private
readOnly: true
- name: spire-config
mountPath: /run/spire/config
readOnly: true
{{- if eq (.Values.dataStorage.enabled | toString) "true" }}
- name: spire-data
mountPath: /run/spire/data
readOnly: false
{{- end }}
- name: {{ include "spire-tornjak.config" . }}
mountPath: /run/spire/tornjak-config
- name: spire-server-socket
mountPath: /tmp/spire-server/private
readOnly: true
- name: spire-config
mountPath: /run/spire/config
readOnly: true
{{- if eq (.Values.dataStorage.enabled | toString) "true" }}
- name: spire-data
mountPath: /run/spire/data
readOnly: false
{{- end }}
{{- end }}
{{- if gt (len .Values.extraContainers) 0 }}
@@ -4,7 +4,8 @@ kind: Pod
metadata:
name: "{{ include "spire-tornjak.fullname" . }}-test-connection"
namespace: {{ include "spire-server.namespace" . }}
labels:
labels:
{{- include "spire-server.labels" . | nindent 4 }}
annotations:
"helm.sh/hook": test
spec:
@@ -12,16 +13,10 @@ spec:
{{- toYaml .Values.podSecurityContext | nindent 4 }}
containers:
- name: wget-tornjak-backend
image: busybox
command: ['wget']
args: ['--no-check-certificate', '-O', '/dev/null', 'http://{{ include "spire-tornjak.backend" . }}:10000/api/tornjak/serverinfo']
securityContext:
{{- toYaml .Values.securityContext | nindent 8 }}
- name: wget-tornjak-frontend
image: busybox
command: ['wget']
args: ['--no-check-certificate', '-O', '/dev/null', 'http://{{ include "spire-tornjak.frontend" . }}:3000']
image: cgr.dev/chainguard/bash:latest
command: ['curl']
args: ['-k', '-s', '-f', 'http://{{ include "spire-tornjak.backend" . }}.{{ include "spire-server.namespace" . }}.svc.{{ include "spire-lib.cluster-domain" . }}:{{ .Values.tornjak.service.port }}']
securityContext:
{{- toYaml .Values.securityContext | nindent 8 }}
restartPolicy: Never
{{- end }}
{{- end }}
@@ -11,11 +11,11 @@ data:
}
plugins {
{{- if .Values.tornjak.config.backend.dataStore }}
{{- if .Values.tornjak.config.dataStore }}
DataStore "sql" {
plugin_data {
drivername = "{{ .Values.tornjak.config.backend.dataStore.driver }}"
filename = "{{ .Values.tornjak.config.backend.dataStore.file }}"
drivername = "{{ .Values.tornjak.config.dataStore.driver }}"
filename = "{{ .Values.tornjak.config.dataStore.file }}"
}
}
{{- end }}