Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow variable substituion in Ingress Annotations #156

Merged
merged 14 commits into from
Aug 1, 2023
8 changes: 8 additions & 0 deletions helm/flowforge/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ If using an external PostgreSQL Database you will need to create the database an
- `forge.dbPassword`
- `forge.postgres.host`
- `forge.postgres.port`
- `forge.postgres.ssl`

## Configuration Values

Expand Down Expand Up @@ -133,6 +134,13 @@ Everything under `forge.rate_limits` is used as input to Fastify Rate Limit plug
- `ingress.annotations` ingress annotations (default is `{}`). This value is also applied to Editor instances created by FlowForge.
- `ingress.className` ingress class name (default is `"""`). This value is also applied to Editor instances created by FlowForge.

`ingress.annotations` values can contain the following tokens that will be replaced as follows:

- `{{ instanceHost }}` replaced by the hostname of the instance
- `{{ instanceURL }}` replaced by the URL for the instance
- `{{ instanceProtocol }}` replaced by either `http` or `https`
- `{{ serviceName }}` replaced by the service name of the instance

### Editors IAM
Provision default service account for Editors if `editors.serviceAccount.create` is `true`.

Expand Down
7 changes: 5 additions & 2 deletions helm/flowforge/templates/broker.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
{{- if .Values.forge.broker.enabled -}}
{{- $brokerHostname := or (.Values.forge.entryPoint) (printf "%s%s" "mqtt." .Values.forge.domain) -}}
apiVersion: v1
kind: ConfigMap
metadata:
Expand Down Expand Up @@ -130,9 +131,11 @@ metadata:
name: flowforge-broker
labels:
app: flowforge-broker
annotations:
{{- if .Values.ingress.annotations }}
{{- toYaml .Values.ingress.annotations | nindent 4 }}
annotations:
{{- range $keys, $values := .Values.ingress.annotations }}
{{ $keys }}: {{ $values | replace "{{ instanceHost }}" $brokerHostname | replace "{{ serviceName }}" "flowforge-broker"}}
{{- end }}
{{- end }}
spec:
{{- if $.Values.ingress.className }}
Expand Down
13 changes: 6 additions & 7 deletions helm/flowforge/templates/service-ingress.yaml
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
{{- $forgeHostname := or (.Values.forge.entryPoint) (printf "%s%s" "forge." .Values.forge.domain) -}}
apiVersion: v1
kind: Service
metadata:
Expand All @@ -14,20 +15,18 @@ apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
name: flowforge-ingress
annotations:
{{- if .Values.ingress.annotations }}
{{- toYaml .Values.ingress.annotations | nindent 4 }}
annotations:
{{- range $keys, $values := .Values.ingress.annotations }}
{{ $keys }}: {{ $values | replace "{{ instanceHost }}" $forgeHostname | replace "{{ serviceName }}" "forge"}}
{{- end }}
{{- end }}
spec:
{{- if and $.Values.ingress.className (semverCompare ">=1.18-0" $.Capabilities.KubeVersion.GitVersion) }}
ingressClassName: {{ $.Values.ingress.className }}
{{- end }}
rules:
{{- if .Values.forge.entryPoint }}
- host: {{ .Values.forge.entryPoint }}
{{- else }}
- host: forge.{{ .Values.forge.domain}}
{{- end }}
- host: {{ $forgeHostname}}
http:
paths:
- pathType: Prefix
Expand Down
2 changes: 1 addition & 1 deletion helm/flowforge/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ forge:
type: postgres
host: flowforge-postgresql
username: forge
password: ""
password: Zai1Wied
database: ff-context
support:
enabled: false
Expand Down