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
+7 -8
View File
@@ -106,14 +106,13 @@ A Helm chart to install the SPIRE server.
| telemetry.prometheus.podMonitor.namespace | string | `""` | Override where to install the podMonitor, if not set will use the same namespace as the spire-server |
| tolerations | list | `[]` | |
| topologySpreadConstraints | list | `[]` | |
| tornjak.config.backend.dataStore.driver | string | `"sqlite3"` | |
| tornjak.config.backend.dataStore.file | string | `"/run/spire/data/tornjak.sqlite3"` | |
| tornjak.config.frontend.apiServerURL | string | `"http://localhost:10000"` | |
| tornjak.enabled | bool | `false` | |
| tornjak.image.pullPolicy | string | `"IfNotPresent"` | |
| tornjak.image.registry | string | `"ghcr.io"` | |
| tornjak.image.repository | string | `"spiffe/tornjak"` | |
| tornjak.image.version | string | `"latest"` | |
| tornjak.config.dataStore | object | `{"driver":"sqlite3","file":"/run/spire/data/tornjak.sqlite3"}` | persistent DB for storing Tornjak specific information |
| tornjak.enabled | bool | `false` | Deploys Tornjak API (backend) |
| tornjak.image | object | `{"pullPolicy":"IfNotPresent","registry":"ghcr.io","repository":"spiffe/tornjak-be","version":"v1.0.2"}` | Tornjak API image |
| tornjak.image.version | string | `"v1.0.2"` | Overrides the image tag whose default is the chart appVersion. |
| tornjak.service.annotations | object | `{}` | |
| tornjak.service.port | int | `10000` | |
| tornjak.service.type | string | `"ClusterIP"` | |
| trustDomain | string | `"example.org"` | |
| upstreamAuthority.certManager.enabled | bool | `false` | |
| upstreamAuthority.certManager.issuer_group | string | `"cert-manager.io"` | |
@@ -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 }}
+15 -17
View File
@@ -12,7 +12,7 @@ image:
repository: spiffe/spire-server
# -- The image pull policy
pullPolicy: IfNotPresent
# Overrides the image tag whose default is the chart appVersion.
# -- Overrides the image tag whose default is the chart appVersion.
version: ""
imagePullSecrets: []
@@ -258,23 +258,21 @@ nodeAttestor:
# tornjak - Tornjak specific configuration
tornjak:
# -- Deploys Tornjak API (backend)
enabled: false
# image - Tornjak image (frontend + backend) if not separated above
image: # ghcr.io/spiffe/tornjak
# -- Tornjak API image
image:
registry: ghcr.io
repository: spiffe/tornjak
repository: spiffe/tornjak-be
pullPolicy: IfNotPresent
# Overrides the image tag whose default is the chart appVersion.
# TODO we should use a specific Tornjak version instead of 'latest'
version: "latest"
# -- Overrides the image tag whose default is the chart appVersion.
version: "v1.0.2"
service:
type: ClusterIP
port: 10000
annotations: {}
config:
# Front-end specific configuration:
frontend:
# apiServerURL - URL of the Tornjak back-end
apiServerURL: "http://localhost:10000" # 👈 Use it for minikube or kind
# Back-end specific configuration
backend:
# dataStore - persistent DB for storing Tornjak specific information
dataStore:
driver: "sqlite3"
file: "/run/spire/data/tornjak.sqlite3"
# -- persistent DB for storing Tornjak specific information
dataStore:
driver: "sqlite3"
file: "/run/spire/data/tornjak.sqlite3"