Skip to content
This repository has been archived by the owner on Mar 22, 2024. It is now read-only.

Commit

Permalink
Improve tornjak docs (#276)
Browse files Browse the repository at this point in the history
- Align tornjak backend naming with same convention as frontend
- Align Tornjak backend and frontend notes style
- Add disclaimer for Tornjak usage to example

---------

Signed-off-by: Marco Franssen <marco.franssen@gmail.com>
  • Loading branch information
marcofranssen authored and mrsabath committed May 12, 2023
1 parent e5f6b58 commit 45c4202
Show file tree
Hide file tree
Showing 6 changed files with 60 additions and 36 deletions.
12 changes: 7 additions & 5 deletions charts/spire/charts/spire-server/templates/NOTES.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,17 @@ Installed {{ .Chart.Name }}…

{{- if eq (.Values.tornjak.enabled | toString) "true" }}

Installed {{ include "spire-tornjak.fullname" . }}…

### WARNING ###

This Tornjak is configured without authentication and it is intended for
testing only. Please do not use this version in production.
Tornjak runs without authentication and is therefore NOT suitable to run in production environments.
Only use in test environments!

Tornjak APIs (Backend):
kubectl -n {{ include "spire-server.namespace" . }} port-forward {{ include "spire-server.fullname" . }}-0 {{ .Values.tornjak.service.port }}:10000
Access Tornjak:

kubectl -n {{ include "spire-server.namespace" . }} port-forward service/{{ include "spire-tornjak.backend" . }} {{ .Values.tornjak.service.port }}:10000

Open browser to: http://localhost:{{ .Values.tornjak.service.port }}

Installed {{ include "spire-tornjak.fullname" . }}…
{{- end }}
4 changes: 3 additions & 1 deletion charts/spire/charts/spire-server/templates/_helpers.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -161,9 +161,11 @@ Tornjak specific section
{{- define "spire-tornjak.fullname" -}}
{{ include "spire-server.fullname" . | trimSuffix "-server" }}-tornjak
{{- end }}

{{- define "spire-tornjak.config" -}}
{{ include "spire-tornjak.fullname" . }}-config
{{- end }}

{{- define "spire-tornjak.backend" -}}
{{ include "spire-tornjak.fullname" . }}-be
{{ include "spire-tornjak.fullname" . }}-backend
{{- end }}
24 changes: 0 additions & 24 deletions charts/spire/charts/spire-server/templates/service.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -26,27 +26,3 @@ spec:
{{- end }}
selector:
{{- include "spire-server.selectorLabels" . | nindent 4 }}

{{- if eq (.Values.tornjak.enabled | toString) "true" }}
---
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.tornjak.service.type }}
selector:
{{- include "spire-server.selectorLabels" . | nindent 4 }}
ports:
- name: {{ include "spire-tornjak.backend" . }}
port: {{ .Values.tornjak.service.port }}
targetPort: tornjak
protocol: TCP
{{- end }}
22 changes: 22 additions & 0 deletions charts/spire/charts/spire-server/templates/tornjak-service.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
{{- if eq (.Values.tornjak.enabled | toString) "true" }}
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.tornjak.service.type }}
selector:
{{- include "spire-server.selectorLabels" . | nindent 4 }}
ports:
- name: {{ include "spire-tornjak.backend" . }}
port: {{ .Values.tornjak.service.port }}
targetPort: tornjak
protocol: TCP
{{- end }}
12 changes: 8 additions & 4 deletions charts/spire/charts/tornjak-frontend/templates/NOTES.txt
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,19 @@ Namespace: {{ include "tornjak-frontend.namespace" . }}
Tornjak UI (Frontend)
image: {{ template "spire-lib.image" (dict "appVersion" $.Chart.AppVersion "image" .Values.image "global" .Values.global) }}
pull policy: {{ .Values.image.pullPolicy }}
Configured with Tornjak API (Backend): {{ include "tornjak-frontend.apiURL" . }}
Tornjak API (Backend): {{ include "tornjak-frontend.apiURL" . }}

### WARNING ###
This Tornjak is configured without authentication and it is intended for
testing only. Please do not use this version in production.

You can use port forwarding to access UI:
Tornjak runs without authentication and is therefore NOT suitable to run in production environments.
Only use in test environments!

Access Tornjak:

kubectl -n {{ include "tornjak-frontend.namespace" . }} port-forward service/{{ include "tornjak-frontend.fullname" . }} {{ .Values.service.port }}:3000

Ensure you have port-forwarding for tornjak-backend as well.

Open browser to: http://localhost:{{ .Values.service.port }}

To learn more about the release, try:
Expand Down
22 changes: 20 additions & 2 deletions examples/tornjak/README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
# Recommended setup to deploy Tornjak

> **Warning**: The current version of Tornjak in this chart is deployed without authentication. Therefore it is not suitable to run this version in production.
To install Spire with the least privileges possible we deploy spire across 2 namespaces.

```shell
Expand All @@ -9,11 +11,27 @@ kubectl create namespace "spire-server"
kubectl label namespace "spire-server" pod-security.kubernetes.io/enforce=restricted

# deploy SPIRE with Tornjak enabled
helm upgrade --install --namespace spire-server --values ../production/values.yaml \
--values ./values.yaml spire charts/spire
helm upgrade --install --namespace spire-server \
--values ../production/values.yaml \
--values ./values.yaml \
--render-subchart-notes \
spire charts/spire

# test the Tornjak deployment
helm test spire -n spire-server
```

## Access tornjak

To access Tornjak you will have to use port-forwarding for the time being *(until we add authentication and ingress)*.

Run following commands from your shell, if you ran with different values your namespace might differ. Consult the install notes printed when running above `helm upgrade` command in that case.

```shell
kubectl -n spire-server port-forward service/spire-tornjak-backend 10000:10000
kubectl -n spire-server port-forward service/spire-tornjak-frontend 3000:3000
```

You can now access Tornjak at [localhost:3000](http://localhost:3000).

See [values.yaml](./values.yaml) for more details on the chart configurations to achieve this setup.

0 comments on commit 45c4202

Please sign in to comment.