Skip to content

Commit b2e1d7d

Browse files
authored
feat: add support for multiple hosts and tls configurations in ingress (#218)
* feat: add support for multiple hosts and tls configurations in ingress Signed-off-by: Marcus Söderberg <[email protected]> * chore(test): add ingress CI tests Signed-off-by: Marcus Söderberg <[email protected]> --------- Signed-off-by: Marcus Söderberg <[email protected]>
1 parent 9385bf3 commit b2e1d7d

8 files changed

+136
-4
lines changed

Diff for: charts/backstage/Chart.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -38,4 +38,4 @@ sources:
3838
# This is the chart version. This version number should be incremented each time you make changes
3939
# to the chart and its templates, including the app version.
4040
# Versions are expected to follow Semantic Versioning (https://semver.org/)
41-
version: 1.9.6
41+
version: 1.10.0

Diff for: charts/backstage/README.md

+4-2
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
# Backstage Helm Chart
33

44
[![Artifact Hub](https://img.shields.io/endpoint?url=https://artifacthub.io/badge/repository/backstage)](https://artifacthub.io/packages/search?repo=backstage)
5-
![Version: 1.9.6](https://img.shields.io/badge/Version-1.9.6-informational?style=flat-square)
5+
![Version: 1.10.0](https://img.shields.io/badge/Version-1.10.0-informational?style=flat-square)
66
![Type: application](https://img.shields.io/badge/Type-application-informational?style=flat-square)
77

88
A Helm chart for deploying a Backstage application
@@ -158,10 +158,12 @@ Kubernetes: `>= 1.19.0-0`
158158
| global | Global parameters Global Docker image parameters Please, note that this will override the image parameters, including dependencies, configured to use the global value Current available global Docker image parameters: imageRegistry, imagePullSecrets and storageClass | object | See below |
159159
| global.imagePullSecrets | Global Docker registry secret names as an array </br> E.g. `imagePullSecrets: [myRegistryKeySecretName]` | list | `[]` |
160160
| global.imageRegistry | Global Docker image registry | string | `""` |
161-
| ingress | Ingress parameters | object | `{"annotations":{},"className":"","enabled":false,"host":"","path":"/","tls":{"enabled":false,"secretName":""}}` |
161+
| ingress | Ingress parameters | object | `{"annotations":{},"className":"","enabled":false,"extraHosts":[],"extraTls":[],"host":"","path":"/","tls":{"enabled":false,"secretName":""}}` |
162162
| ingress.annotations | Additional annotations for the Ingress resource | object | `{}` |
163163
| ingress.className | Name of the IngressClass cluster resource which defines which controller will implement the resource (e.g nginx) | string | `""` |
164164
| ingress.enabled | Enable the creation of the ingress resource | bool | `false` |
165+
| ingress.extraHosts | List of additional hostnames to be covered with this ingress record (e.g. a CNAME) <!-- E.g. extraHosts: - name: backstage.env.example.com path: / (Optional) pathType: Prefix (Optional) port: 7007 (Optional) --> | list | `[]` |
166+
| ingress.extraTls | The TLS configuration for additional hostnames to be covered with this ingress record. <br /> Ref: https://kubernetes.io/docs/concepts/services-networking/ingress/#tls <!-- E.g. extraTls: - hosts: - backstage.env.example.com secretName: backstage-env --> | list | `[]` |
165167
| ingress.host | Hostname to be used to expose the route to access the backstage application (e.g: backstage.IP.nip.io) | string | `""` |
166168
| ingress.path | Path to be used to expose the full route to access the backstage application (e.g: IP.nip.io/backstage) | string | `"/"` |
167169
| ingress.tls | Ingress TLS parameters | object | `{"enabled":false,"secretName":""}` |

Diff for: charts/backstage/ci/ingress-extraHosts-values.yaml

+12
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
ingress:
2+
enabled: true
3+
host: backstage.example.com
4+
tls:
5+
enabled: true
6+
secretName: "backstage-tls"
7+
extraHosts:
8+
- name: backstage.dev.example.com
9+
extraTls:
10+
- hosts:
11+
- backstage.dev.example.com
12+
secretName: "backstage-dev-tls"

Diff for: charts/backstage/ci/ingress-values.yaml

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
ingress:
2+
enabled: true
3+
host: backstage.example.com
4+
tls:
5+
enabled: true
6+
secretName: "backstage-tls"

Diff for: charts/backstage/templates/ingress.yaml

+18-1
Original file line numberDiff line numberDiff line change
@@ -20,11 +20,16 @@ spec:
2020
{{- if .Values.ingress.className }}
2121
ingressClassName: {{ .Values.ingress.className | quote }}
2222
{{- end }}
23-
{{- if .Values.ingress.tls.enabled }}
23+
{{- if or .Values.ingress.tls.enabled .Values.ingress.extraTls }}
2424
tls:
25+
{{- if .Values.ingress.tls.enabled }}
2526
- hosts:
2627
- {{ include "common.tplvalues.render" ( dict "value" .Values.ingress.host "context" $ ) }}
2728
secretName: {{ include "common.tplvalues.render" ( dict "value" .Values.ingress.tls.secretName "context" $ ) }}
29+
{{- end }}
30+
{{- if .Values.ingress.extraTls }}
31+
{{- include "common.tplvalues.render" ( dict "value" .Values.ingress.extraTls "context" $ ) | nindent 4 }}
32+
{{- end }}
2833
{{- end }}
2934
rules:
3035
- host: {{ include "common.tplvalues.render" ( dict "value" .Values.ingress.host "context" $ ) }}
@@ -37,4 +42,16 @@ spec:
3742
name: {{ include "common.names.fullname" . }}
3843
port:
3944
number: {{ .Values.service.ports.backend }}
45+
{{- range .Values.ingress.extraHosts }}
46+
- host: {{ .name | quote }}
47+
http:
48+
paths:
49+
- path: {{ default $.Values.ingress.path .path }}
50+
pathType: {{ default "Prefix" .pathType }}
51+
backend:
52+
service:
53+
name: {{ include "common.names.fullname" $ }}
54+
port:
55+
number: {{ default $.Values.service.ports.backend .port }}
56+
{{- end }}
4057
{{- end }}

Diff for: charts/backstage/values.schema.json

+46
Original file line numberDiff line numberDiff line change
@@ -6124,6 +6124,52 @@
61246124
"title": "Enable the creation of the ingress resource",
61256125
"type": "boolean"
61266126
},
6127+
"extraHosts": {
6128+
"default": [],
6129+
"items": {
6130+
"additionalProperties": false,
6131+
"properties": {
6132+
"name": {
6133+
"type": "string"
6134+
},
6135+
"path": {
6136+
"type": "string"
6137+
},
6138+
"pathType": {
6139+
"type": "string"
6140+
},
6141+
"port": {
6142+
"type": "integer"
6143+
}
6144+
},
6145+
"type": "object"
6146+
},
6147+
"title": "List of additional hostnames to be covered with this ingress record",
6148+
"type": "array"
6149+
},
6150+
"extraTls": {
6151+
"default": [],
6152+
"items": {
6153+
"description": "IngressTLS describes the transport layer security associated with an ingress.",
6154+
"properties": {
6155+
"hosts": {
6156+
"description": "hosts is a list of hosts included in the TLS certificate. The values in this list must match the name/s used in the tlsSecret. Defaults to the wildcard host setting for the loadbalancer controller fulfilling this Ingress, if left unspecified.",
6157+
"items": {
6158+
"type": "string"
6159+
},
6160+
"type": "array",
6161+
"x-kubernetes-list-type": "atomic"
6162+
},
6163+
"secretName": {
6164+
"description": "secretName is the name of the secret used to terminate TLS traffic on port 443. Field is left optional to allow TLS routing based on SNI hostname alone. If the SNI host in a listener conflicts with the \"Host\" header field used by an IngressRule, the SNI host is used for termination and value of the \"Host\" header is used for routing.",
6165+
"type": "string"
6166+
}
6167+
},
6168+
"type": "object"
6169+
},
6170+
"title": "The TLS configuration for additional hostnames to be covered with this ingress record.",
6171+
"type": "array"
6172+
},
61276173
"host": {
61286174
"default": "",
61296175
"examples": [

Diff for: charts/backstage/values.schema.tmpl.json

+31
Original file line numberDiff line numberDiff line change
@@ -143,6 +143,29 @@
143143
"backstage.10.0.0.1.nip.io"
144144
]
145145
},
146+
"extraHosts": {
147+
"title": "List of additional hostnames to be covered with this ingress record",
148+
"type": "array",
149+
"default": [],
150+
"items": {
151+
"type": "object",
152+
"additionalProperties": false,
153+
"properties": {
154+
"name": {
155+
"type": "string"
156+
},
157+
"path": {
158+
"type": "string"
159+
},
160+
"pathType": {
161+
"type": "string"
162+
},
163+
"port": {
164+
"type": "integer"
165+
}
166+
}
167+
}
168+
},
146169
"path": {
147170
"title": "Path to be used to expose the full route to access the backstage application.",
148171
"type": "string",
@@ -168,6 +191,14 @@
168191
"default": ""
169192
}
170193
}
194+
},
195+
"extraTls": {
196+
"title": "The TLS configuration for additional hostnames to be covered with this ingress record.",
197+
"type": "array",
198+
"items": {
199+
"$ref": "https://raw.githubusercontent.com/yannh/kubernetes-json-schema/master/master/_definitions.json#/definitions/io.k8s.api.networking.v1.IngressTLS"
200+
},
201+
"default": []
171202
}
172203
}
173204
},

Diff for: charts/backstage/values.yaml

+18
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,15 @@ ingress:
6767
# -- Hostname to be used to expose the route to access the backstage application (e.g: backstage.IP.nip.io)
6868
host: ""
6969

70+
# -- List of additional hostnames to be covered with this ingress record (e.g. a CNAME)
71+
# <!-- E.g.
72+
# extraHosts:
73+
# - name: backstage.env.example.com
74+
# path: / (Optional)
75+
# pathType: Prefix (Optional)
76+
# port: 7007 (Optional) -->
77+
extraHosts: []
78+
7079
# -- Path to be used to expose the full route to access the backstage application (e.g: IP.nip.io/backstage)
7180
path: "/"
7281

@@ -79,6 +88,15 @@ ingress:
7988
# -- The name to which the TLS Secret will be called
8089
secretName: ""
8190

91+
# -- The TLS configuration for additional hostnames to be covered with this ingress record.
92+
# <br /> Ref: https://kubernetes.io/docs/concepts/services-networking/ingress/#tls
93+
# <!-- E.g.
94+
# extraTls:
95+
# - hosts:
96+
# - backstage.env.example.com
97+
# secretName: backstage-env -->
98+
extraTls: []
99+
82100
# -- Backstage parameters
83101
# @default -- See below
84102
backstage:

0 commit comments

Comments
 (0)