From d9417a659b8776725ab83367fdfb2e0762f1c3fe Mon Sep 17 00:00:00 2001 From: ndr_brt Date: Tue, 16 Jul 2024 12:29:32 +0200 Subject: [PATCH] refactor(charts): cleanup unneeded version checks --- .../templates/ingress-controlplane.yaml | 17 +---------------- .../templates/ingress-dataplane.yaml | 17 +---------------- .../templates/ingress-runtime.yaml | 17 +---------------- .../templates/ingress-controlplane.yaml | 17 +---------------- .../templates/ingress-dataplane.yaml | 17 +---------------- 5 files changed, 5 insertions(+), 80 deletions(-) diff --git a/charts/tractusx-connector-azure-vault/templates/ingress-controlplane.yaml b/charts/tractusx-connector-azure-vault/templates/ingress-controlplane.yaml index 0be9a53a8..8957cbf4c 100644 --- a/charts/tractusx-connector-azure-vault/templates/ingress-controlplane.yaml +++ b/charts/tractusx-connector-azure-vault/templates/ingress-controlplane.yaml @@ -20,7 +20,6 @@ {{- $fullName := include "txdc.fullname" . }} {{- $controlLabels := include "txdc.controlplane.labels" . }} {{- $controlEdcEndpoints := .Values.controlplane.endpoints }} -{{- $gitVersion := .Capabilities.KubeVersion.GitVersion }} {{- $namespace := .Release.Namespace }} {{- range .Values.controlplane.ingresses }} @@ -28,13 +27,7 @@ {{- $controlIngressName := printf "%s-controlplane-%s" $fullName .hostname }} {{- $annotations := .annotations | default dict }} --- -{{- if semverCompare ">=1.19-0" $gitVersion }} apiVersion: networking.k8s.io/v1 -{{- else if semverCompare ">=1.14-0" $gitVersion }} -apiVersion: networking.k8s.io/v1beta1 -{{- else }} -apiVersion: extensions/v1beta1 -{{- end }} kind: Ingress metadata: name: {{ $controlIngressName }} @@ -42,11 +35,6 @@ metadata: labels: {{- $controlLabels | nindent 4 }} annotations: - {{- if and .className (not (semverCompare ">=1.18-0" $gitVersion)) }} - {{- if not (hasKey $annotations "kubernetes.io/ingress.class") }} - {{- $_ := set $annotations "kubernetes.io/ingress.class" .className}} - {{- end }} - {{- end }} {{- if .certManager }} {{- if .certManager.issuer }} {{- $_ := set $annotations "cert-manager.io/issuer" .certManager.issuer}} @@ -59,7 +47,7 @@ metadata: {{- toYaml . | nindent 4 }} {{- end }} spec: - {{- if and .className (semverCompare ">=1.18-0" $gitVersion) }} + {{- if .className }} ingressClassName: {{ .className }} {{- end }} {{- if .hostname }} @@ -83,13 +71,10 @@ spec: - path: {{ $mapping.path }} pathType: Prefix backend: - {{- if semverCompare ">=1.19-0" $gitVersion }} service: name: {{ $fullName }}-controlplane port: number: {{ $mapping.port }} - {{- else }} - {{- end }} {{- end }} {{- end }} {{- end }} diff --git a/charts/tractusx-connector-azure-vault/templates/ingress-dataplane.yaml b/charts/tractusx-connector-azure-vault/templates/ingress-dataplane.yaml index c59084455..b46c30285 100644 --- a/charts/tractusx-connector-azure-vault/templates/ingress-dataplane.yaml +++ b/charts/tractusx-connector-azure-vault/templates/ingress-dataplane.yaml @@ -20,7 +20,6 @@ {{- $fullName := include "txdc.fullname" . }} {{- $dataLabels := include "txdc.dataplane.labels" . }} {{- $dataEdcEndpoints := .Values.dataplane.endpoints }} -{{- $gitVersion := .Capabilities.KubeVersion.GitVersion }} {{- $namespace := .Release.Namespace }} {{- range .Values.dataplane.ingresses }} @@ -28,13 +27,7 @@ {{- $dataIngressName := printf "%s-dataplane-%s" $fullName .hostname }} {{- $annotations := .annotations | default dict }} --- -{{- if semverCompare ">=1.19-0" $gitVersion }} apiVersion: networking.k8s.io/v1 -{{- else if semverCompare ">=1.14-0" $gitVersion }} -apiVersion: networking.k8s.io/v1beta1 -{{- else }} -apiVersion: extensions/v1beta1 -{{- end }} kind: Ingress metadata: name: {{ $dataIngressName }} @@ -42,11 +35,6 @@ metadata: labels: {{- $dataLabels | nindent 4 }} annotations: - {{- if and .className (not (semverCompare ">=1.18-0" $gitVersion)) }} - {{- if not (hasKey $annotations "kubernetes.io/ingress.class") }} - {{- $_ := set $annotations "kubernetes.io/ingress.class" .className}} - {{- end }} - {{- end }} {{- if .certManager }} {{- if .certManager.issuer }} {{- $_ := set $annotations "cert-manager.io/issuer" .certManager.issuer}} @@ -59,7 +47,7 @@ metadata: {{- toYaml . | nindent 4 }} {{- end }} spec: - {{- if and .className (semverCompare ">=1.18-0" $gitVersion) }} + {{- if .className }} ingressClassName: {{ .className }} {{- end }} {{- if .hostname }} @@ -83,13 +71,10 @@ spec: - path: {{ $mapping.path }} pathType: Prefix backend: - {{- if semverCompare ">=1.19-0" $gitVersion }} service: name: {{ $fullName }}-dataplane port: number: {{ $mapping.port }} - {{- else }} - {{- end }} {{- end }} {{- end }} {{- end }} diff --git a/charts/tractusx-connector-memory/templates/ingress-runtime.yaml b/charts/tractusx-connector-memory/templates/ingress-runtime.yaml index 211f78685..6b3ed68a1 100644 --- a/charts/tractusx-connector-memory/templates/ingress-runtime.yaml +++ b/charts/tractusx-connector-memory/templates/ingress-runtime.yaml @@ -24,7 +24,6 @@ {{- $fullName := include "txdc.fullname" . }} {{- $controlLabels := include "txdc.runtime.labels" . }} {{- $controlEdcEndpoints := .Values.runtime.endpoints }} -{{- $gitVersion := .Capabilities.KubeVersion.GitVersion }} {{- $namespace := .Release.Namespace }} {{- range .Values.runtime.ingresses }} @@ -32,13 +31,7 @@ {{- $controlIngressName := printf "%s-runtime-%s" $fullName .hostname }} {{- $annotations := .annotations | default dict }} --- -{{- if semverCompare ">=1.19-0" $gitVersion }} apiVersion: networking.k8s.io/v1 -{{- else if semverCompare ">=1.14-0" $gitVersion }} -apiVersion: networking.k8s.io/v1beta1 -{{- else }} -apiVersion: extensions/v1beta1 -{{- end }} kind: Ingress metadata: name: {{ $controlIngressName }} @@ -46,11 +39,6 @@ metadata: labels: {{- $controlLabels | nindent 4 }} annotations: - {{- if and .className (not (semverCompare ">=1.18-0" $gitVersion)) }} - {{- if not (hasKey $annotations "kubernetes.io/ingress.class") }} - {{- $_ := set $annotations "kubernetes.io/ingress.class" .className}} - {{- end }} - {{- end }} {{- if .certManager }} {{- if .certManager.issuer }} {{- $_ := set $annotations "cert-manager.io/issuer" .certManager.issuer}} @@ -63,7 +51,7 @@ metadata: {{- toYaml . | nindent 4 }} {{- end }} spec: - {{- if and .className (semverCompare ">=1.18-0" $gitVersion) }} + {{- if .className }} ingressClassName: {{ .className }} {{- end }} {{- if .hostname }} @@ -87,13 +75,10 @@ spec: - path: {{ $mapping.path }} pathType: Prefix backend: - {{- if semverCompare ">=1.19-0" $gitVersion }} service: name: {{ $fullName }}-runtime port: number: {{ $mapping.port }} - {{- else }} - {{- end }} {{- end }} {{- end }} {{- end }} diff --git a/charts/tractusx-connector/templates/ingress-controlplane.yaml b/charts/tractusx-connector/templates/ingress-controlplane.yaml index 292ba233e..624eac3cd 100644 --- a/charts/tractusx-connector/templates/ingress-controlplane.yaml +++ b/charts/tractusx-connector/templates/ingress-controlplane.yaml @@ -24,7 +24,6 @@ {{- $fullName := include "txdc.fullname" . }} {{- $controlLabels := include "txdc.controlplane.labels" . }} {{- $controlEdcEndpoints := .Values.controlplane.endpoints }} -{{- $gitVersion := .Capabilities.KubeVersion.GitVersion }} {{- $namespace := .Release.Namespace }} {{- range .Values.controlplane.ingresses }} @@ -32,13 +31,7 @@ {{- $controlIngressName := printf "%s-controlplane-%s" $fullName .hostname }} {{- $annotations := .annotations | default dict }} --- -{{- if semverCompare ">=1.19-0" $gitVersion }} apiVersion: networking.k8s.io/v1 -{{- else if semverCompare ">=1.14-0" $gitVersion }} -apiVersion: networking.k8s.io/v1beta1 -{{- else }} -apiVersion: extensions/v1beta1 -{{- end }} kind: Ingress metadata: name: {{ $controlIngressName }} @@ -46,11 +39,6 @@ metadata: labels: {{- $controlLabels | nindent 4 }} annotations: - {{- if and .className (not (semverCompare ">=1.18-0" $gitVersion)) }} - {{- if not (hasKey $annotations "kubernetes.io/ingress.class") }} - {{- $_ := set $annotations "kubernetes.io/ingress.class" .className}} - {{- end }} - {{- end }} {{- if .certManager }} {{- if .certManager.issuer }} {{- $_ := set $annotations "cert-manager.io/issuer" .certManager.issuer}} @@ -63,7 +51,7 @@ metadata: {{- toYaml . | nindent 4 }} {{- end }} spec: - {{- if and .className (semverCompare ">=1.18-0" $gitVersion) }} + {{- if .className }} ingressClassName: {{ .className }} {{- end }} {{- if .hostname }} @@ -87,13 +75,10 @@ spec: - path: {{ $mapping.path }} pathType: Prefix backend: - {{- if semverCompare ">=1.19-0" $gitVersion }} service: name: {{ $fullName }}-controlplane port: number: {{ $mapping.port }} - {{- else }} - {{- end }} {{- end }} {{- end }} {{- end }} diff --git a/charts/tractusx-connector/templates/ingress-dataplane.yaml b/charts/tractusx-connector/templates/ingress-dataplane.yaml index 84df3ffea..9d5653f94 100644 --- a/charts/tractusx-connector/templates/ingress-dataplane.yaml +++ b/charts/tractusx-connector/templates/ingress-dataplane.yaml @@ -24,7 +24,6 @@ {{- $fullName := include "txdc.fullname" . }} {{- $dataLabels := include "txdc.dataplane.labels" . }} {{- $dataEdcEndpoints := .Values.dataplane.endpoints }} -{{- $gitVersion := .Capabilities.KubeVersion.GitVersion }} {{- $namespace := .Release.Namespace }} {{- range .Values.dataplane.ingresses }} @@ -32,13 +31,7 @@ {{- $dataIngressName := printf "%s-dataplane-%s" $fullName .hostname }} {{- $annotations := .annotations | default dict }} --- -{{- if semverCompare ">=1.19-0" $gitVersion }} apiVersion: networking.k8s.io/v1 -{{- else if semverCompare ">=1.14-0" $gitVersion }} -apiVersion: networking.k8s.io/v1beta1 -{{- else }} -apiVersion: extensions/v1beta1 -{{- end }} kind: Ingress metadata: name: {{ $dataIngressName }} @@ -46,11 +39,6 @@ metadata: labels: {{- $dataLabels | nindent 4 }} annotations: - {{- if and .className (not (semverCompare ">=1.18-0" $gitVersion)) }} - {{- if not (hasKey $annotations "kubernetes.io/ingress.class") }} - {{- $_ := set $annotations "kubernetes.io/ingress.class" .className}} - {{- end }} - {{- end }} {{- if .certManager }} {{- if .certManager.issuer }} {{- $_ := set $annotations "cert-manager.io/issuer" .certManager.issuer}} @@ -63,7 +51,7 @@ metadata: {{- toYaml . | nindent 4 }} {{- end }} spec: - {{- if and .className (semverCompare ">=1.18-0" $gitVersion) }} + {{- if .className }} ingressClassName: {{ .className }} {{- end }} {{- if .hostname }} @@ -87,13 +75,10 @@ spec: - path: {{ $mapping.path }} pathType: Prefix backend: - {{- if semverCompare ">=1.19-0" $gitVersion }} service: name: {{ $fullName }}-dataplane port: number: {{ $mapping.port }} - {{- else }} - {{- end }} {{- end }} {{- end }} {{- end }}