Skip to content

Commit

Permalink
Add support for using cert manager to issue TLS certs
Browse files Browse the repository at this point in the history
This allows K8s to use cert-manager.io to issue TLS certs for
both the core Forge apps and the Instances.
  • Loading branch information
hardillb committed Dec 29, 2023
1 parent 07c5394 commit 2231360
Show file tree
Hide file tree
Showing 5 changed files with 28 additions and 3 deletions.
1 change: 1 addition & 0 deletions helm/flowforge/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,7 @@ Everything under `forge.rate_limits` is used as input to Fastify Rate Limit plug
### Ingress
- `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.certManagerIssuer` the name of the CertManager Issuer to use to create HTTPS certificates. (default is not set)

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

Expand Down
11 changes: 10 additions & 1 deletion helm/flowforge/templates/broker.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -134,8 +134,11 @@ metadata:
name: flowforge-broker
labels:
app: flowforge-broker
{{- if .Values.ingress.annotations }}
annotations:
{{- if .Values.ingress.certManagerIssuer }}
cert-manager.io/cluster-issuer: {{ $.Values.ingress.certManagerIssuer }}
{{- end }}
{{- if .Values.ingress.annotations }}
{{ toYaml .Values.ingress.annotations | replace "{{ instanceHost }}" $brokerHostname | replace "{{ serviceName }}" "flowforge-broker" | indent 4 }}
{{- end }}
spec:
Expand All @@ -153,6 +156,12 @@ spec:
name: flowforge-broker
port:
number: 1884
{{- if .Values.ingress.certManagerIssuer }}
tls:
- hosts:
- mqtt.{{ .Values.forge.domain }}
secretName: broker-tls
{{- end }}
# ---
# apiVersion: v1
# kind: Service
Expand Down
3 changes: 3 additions & 0 deletions helm/flowforge/templates/configmap.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,9 @@ data:
{{- if .Values.forge.privateCA }}
privateCA: {{ .Values.forge.privateCA.configMapName }}
{{- end }}
{{- if .Values.ingress.certManagerIssuer }}
certManagerIssuer: {{ .Values.ingress.certManagerIssuer }}
{{- end }}
{{- if .Values.forge.email }}
email:
enabled: true
Expand Down
13 changes: 11 additions & 2 deletions helm/flowforge/templates/service-ingress.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,16 +15,19 @@ apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
name: flowforge-ingress
{{- if .Values.ingress.annotations }}
annotations:
{{- if .Values.ingress.certManagerIssuer }}
cert-manager.io/cluster-issuer: {{ $.Values.ingress.certManagerIssuer }}
{{- end }}
{{- if .Values.ingress.annotations }}
{{ toYaml .Values.ingress.annotations | replace "{{ instanceHost }}" $forgeHostname | replace "{{ serviceName }}" "forge" | indent 4 }}
{{- end }}
spec:
{{- if and $.Values.ingress.className (semverCompare ">=1.18-0" $.Capabilities.KubeVersion.GitVersion) }}
ingressClassName: {{ $.Values.ingress.className }}
{{- end }}
rules:
- host: {{ $forgeHostname}}
- host: {{ $forgeHostname }}
http:
paths:
- pathType: Prefix
Expand All @@ -34,3 +37,9 @@ spec:
name: forge
port:
number: 80
{{- if .Values.ingress.certManagerIssuer }}
tls:
- hosts:
- {{ $forgeHostname }}
secretName: flowforge-tls
{{- end }}
3 changes: 3 additions & 0 deletions helm/flowforge/values.schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -412,6 +412,9 @@
},
"className": {
"type": "string"
},
"certManagerIssuer": {
"type": "string"
}
}
},
Expand Down

0 comments on commit 2231360

Please sign in to comment.