feat: add support to tls for ingress-route

If tls is enabled on the process, we create add the https entrypoint and also add the requisite tls secret-name
This commit is contained in:
Jose Diaz-Gonzalez
2024-01-22 07:36:42 -05:00
parent 63a6e9087f
commit 29760e8ecd
2 changed files with 10 additions and 8 deletions

View File

@@ -86,7 +86,7 @@ func createIngressRoutesFiles(input CreateIngressRoutesInput) error {
return fmt.Errorf("Error reading ingress route append file: %w", err)
}
contents := string(bytes.Join([][]byte{b, append}, []byte("")))
contents := strings.Join([]string{strings.TrimSpace(string(b)), string(append)}, "")
contents = strings.ReplaceAll(contents, " routes: null", "")
contents = strings.Join([]string{
"{{- if .Values.processes.PROCESS_TYPE.domains }}",
@@ -731,11 +731,6 @@ type IngressRoute struct {
}
func templateKubernetesIngressRoute(input IngressRoute) traefikv1alpha1.IngressRoute {
entryPoint := IngressRouteEntrypoint_HTTP
if input.PortMap.Scheme == "https" {
entryPoint = IngressRouteEntrypoint_HTTPS
}
labels := map[string]string{
"app.kubernetes.io/instance": fmt.Sprintf("%s-%s", input.AppName, input.ProcessType),
"app.kubernetes.io/name": input.ProcessType,
@@ -754,7 +749,7 @@ func templateKubernetesIngressRoute(input IngressRoute) traefikv1alpha1.IngressR
Annotations: annotations,
},
Spec: traefikv1alpha1.IngressRouteSpec{
EntryPoints: []string{string(entryPoint)},
EntryPoints: []string{string(IngressRouteEntrypoint_HTTP)},
},
}

View File

@@ -1,3 +1,6 @@
{{ if .Values.processes.PROCESS_TYPE.tls }}
- websecure
{{- end }}
routes:
{{- range .Values.processes.PROCESS_TYPE.domains }}
- kind: Rule
@@ -8,4 +11,8 @@
passHostHeader: true
port: PORT_MAPPING
scheme: PORT_SCHEME
{{- end }}
{{- end }}
{{ if .Values.processes.PROCESS_TYPE.tls }}
tls:
secretName: tls-APP_NAME-PROCESS_TYPE
{{- end }}