This commit is contained in:
Stavros kois
2023-12-07 23:54:17 +02:00
parent a7085c7478
commit 811fffd7ba
2 changed files with 0 additions and 131 deletions

View File

@@ -1,69 +0,0 @@
{{/*
This template serves as a blueprint for all Ingress objects that are created
within the common library.
*/}}
{{- define "tc.v1.common.class.ingress.old" -}}
{{- $fullName := include "tc.v1.common.lib.chart.names.fullname" . -}}
{{- $values := dict -}}
{{- $ingressName := "" -}}
{{/* Get the name of the primary service, if any */}}
{{- $primaryServiceName := (include "tc.v1.common.lib.util.service.primary" (dict "services" .Values.service "root" .)) -}}
{{/* Get service values of the primary service, if any */}}
{{- $primaryService := get .Values.service $primaryServiceName -}}
{{- $defaultServiceName := $fullName -}}
{{- if and (hasKey $primaryService "nameOverride") $primaryService.nameOverride -}}
{{- $defaultServiceName = printf "%v-%v" $defaultServiceName $primaryService.nameOverride -}}
{{- end -}}
{{- $defaultServicePort := get $primaryService.ports (include "tc.v1.common.lib.util.service.ports.primary" (dict "svcValues" $primaryService "svcName" $primaryServiceName )) -}}
---
spec:
{{- if $values.certificateIssuer }}
tls:
{{- range $index, $hostsValues := $values.hosts }}
- hosts:
- {{ tpl $hostsValues.host $ | quote }}
secretName: {{ ( printf "%v-%v-%v" $ingressName "tls" $index ) }}
{{- end -}}
{{- else if $values.tls }}
tls:
{{- range $index, $tlsValues := $values.tls }}
{{- $tlsName := ( printf "%v-%v" "tls" $index ) }}
- hosts:
{{- range $tlsValues.hosts }}
- {{ tpl . $ | quote }}
{{- end -}}
{{- if $tlsValues.certificateIssuer }}
secretName: {{ printf "%v-%v" $ingressName $tlsName }}
{{- else if and ($tlsValues.scaleCert) ($.Values.global.ixChartContext) -}}
{{- $cert := dict }}
{{- $_ := set $cert "id" $tlsValues.scaleCert }}
{{- $_ := set $cert "nameOverride" $tlsName }}
secretName: {{ printf "%s-tls-%v" (include "tc.v1.common.lib.chart.names.fullname" $) $index }}
{{- else if .clusterCertificate }}
secretName: clusterissuer-templated-{{ tpl .clusterCertificate $ }}
{{- else if .secretName }}
secretName: {{ tpl .secretName $ | quote }}
{{- end -}}
{{- end -}}
{{- end }}
rules:
{{- range $values.hosts }}
paths:
{{- range .paths -}}
{{- $service := $defaultServiceName -}}
{{- $port := $defaultServicePort.port -}}
{{- if .service -}}
{{- $service = default $service .service.name -}}
{{- $port = default $port .service.port -}}
{{- end }}
{{- end -}}
{{- end -}}
{{- end -}}

View File

@@ -1,62 +0,0 @@
{{/* Renders the Ingress objects required by the chart */}}
{{- define "tc.v1.common.spawner.ingress.old" -}}
{{- $fullname := include "tc.v1.common.lib.chart.names.fullname" $ -}}
{{/* Generate named ingresses as required */}}
{{- range $name, $ingress := .Values.ingress -}}
{{- if $ingress.enabled -}}
{{- $ingressValues := $ingress -}}
{{- $ingressName := $fullname -}}
{{/* set defaults */}}
{{- if and (not $ingressValues.nameOverride) (ne $name (include "tc.v1.common.lib.util.ingress.primary" $)) -}}
{{- $_ := set $ingressValues "nameOverride" $name -}}
{{- end -}}
{{- if $ingressValues.nameOverride -}}
{{- $ingressName = printf "%v-%v" $ingressName $ingressValues.nameOverride -}}
{{- end -}}
{{- $_ := set $ingressValues "name" $ingressName -}}
{{- $_ := set $ "ObjectValues" (dict "ingress" $ingressValues) -}}
{{- include "tc.v1.common.class.ingress" $ -}}
{{- if and ( $ingressValues.tls ) ( not $ingressValues.clusterIssuer ) -}}
{{- range $index, $tlsValues := $ingressValues.tls -}}
{{- $tlsName := ( printf "%v-%v" "tls" $index ) -}}
{{- if $tlsValues.certificateIssuer -}}
{{- include "tc.v1.common.class.certificate" (dict "root" $ "name" ( printf "%v-%v" $ingressName $tlsName ) "certificateIssuer" $tlsValues.certificateIssuer "hosts" $tlsValues.hosts ) -}}
{{- else if and ( $tlsValues.scaleCert ) ( $.Values.global.ixChartContext ) -}}
{{/* Create certificate object and use it to construct a secret */}}
{{- $objectData := dict -}}
{{- $_ := set $objectData "id" .scaleCert -}}
{{- $objectName := (printf "%s-%s" $fullname $tlsName) -}}
{{/* Perform validations */}}
{{- include "tc.v1.common.lib.chart.names.validation" (dict "name" $objectName) -}}
{{- include "tc.v1.common.lib.scaleCertificate.validation" (dict "objectData" $objectData) -}}
{{- include "tc.v1.common.lib.metadata.validation" (dict "objectData" $objectData "caller" "Certificate") -}}
{{/* Prepare data */}}
{{- $data := fromJson (include "tc.v1.common.lib.scaleCertificate.getData" (dict "rootCtx" $ "objectData" $objectData)) -}}
{{- $_ := set $objectData "data" $data -}}
{{/* Set the type to certificate */}}
{{- $_ := set $objectData "type" "certificate" -}}
{{/* Set the name of the certificate */}}
{{- $_ := set $objectData "name" $objectName -}}
{{- $_ := set $objectData "shortName" $name -}}
{{/* Call class to create the object */}}
{{- include "tc.v1.common.class.secret" (dict "rootCtx" $ "objectData" $objectData) -}}
{{- end -}}
{{- end -}}
{{- end -}}
{{- else if $ingress.required -}}
{{- fail (printf "Ingress - [ingress.%s] is set to be [required] and cannot be disabled" $name) -}}
{{- end -}}
{{- end -}}
{{- end -}}