Skip to content

Commit 76b18db

Browse files
authored
refactor(charts): cleanup unneeded version checks (#1424)
1 parent c2e9506 commit 76b18db

File tree

5 files changed

+5
-80
lines changed

5 files changed

+5
-80
lines changed

charts/tractusx-connector-azure-vault/templates/ingress-controlplane.yaml

+1-16
Original file line numberDiff line numberDiff line change
@@ -20,33 +20,21 @@
2020
{{- $fullName := include "txdc.fullname" . }}
2121
{{- $controlLabels := include "txdc.controlplane.labels" . }}
2222
{{- $controlEdcEndpoints := .Values.controlplane.endpoints }}
23-
{{- $gitVersion := .Capabilities.KubeVersion.GitVersion }}
2423
{{- $namespace := .Release.Namespace }}
2524

2625
{{- range .Values.controlplane.ingresses }}
2726
{{- if and .enabled .endpoints }}
2827
{{- $controlIngressName := printf "%s-controlplane-%s" $fullName .hostname }}
2928
{{- $annotations := .annotations | default dict }}
3029
---
31-
{{- if semverCompare ">=1.19-0" $gitVersion }}
3230
apiVersion: networking.k8s.io/v1
33-
{{- else if semverCompare ">=1.14-0" $gitVersion }}
34-
apiVersion: networking.k8s.io/v1beta1
35-
{{- else }}
36-
apiVersion: extensions/v1beta1
37-
{{- end }}
3831
kind: Ingress
3932
metadata:
4033
name: {{ $controlIngressName }}
4134
namespace: {{ $namespace | default "default" | quote }}
4235
labels:
4336
{{- $controlLabels | nindent 4 }}
4437
annotations:
45-
{{- if and .className (not (semverCompare ">=1.18-0" $gitVersion)) }}
46-
{{- if not (hasKey $annotations "kubernetes.io/ingress.class") }}
47-
{{- $_ := set $annotations "kubernetes.io/ingress.class" .className}}
48-
{{- end }}
49-
{{- end }}
5038
{{- if .certManager }}
5139
{{- if .certManager.issuer }}
5240
{{- $_ := set $annotations "cert-manager.io/issuer" .certManager.issuer}}
@@ -59,7 +47,7 @@ metadata:
5947
{{- toYaml . | nindent 4 }}
6048
{{- end }}
6149
spec:
62-
{{- if and .className (semverCompare ">=1.18-0" $gitVersion) }}
50+
{{- if .className }}
6351
ingressClassName: {{ .className }}
6452
{{- end }}
6553
{{- if .hostname }}
@@ -83,13 +71,10 @@ spec:
8371
- path: {{ $mapping.path }}
8472
pathType: Prefix
8573
backend:
86-
{{- if semverCompare ">=1.19-0" $gitVersion }}
8774
service:
8875
name: {{ $fullName }}-controlplane
8976
port:
9077
number: {{ $mapping.port }}
91-
{{- else }}
92-
{{- end }}
9378
{{- end }}
9479
{{- end }}
9580
{{- end }}

charts/tractusx-connector-azure-vault/templates/ingress-dataplane.yaml

+1-16
Original file line numberDiff line numberDiff line change
@@ -20,33 +20,21 @@
2020
{{- $fullName := include "txdc.fullname" . }}
2121
{{- $dataLabels := include "txdc.dataplane.labels" . }}
2222
{{- $dataEdcEndpoints := .Values.dataplane.endpoints }}
23-
{{- $gitVersion := .Capabilities.KubeVersion.GitVersion }}
2423
{{- $namespace := .Release.Namespace }}
2524

2625
{{- range .Values.dataplane.ingresses }}
2726
{{- if and .enabled .endpoints }}
2827
{{- $dataIngressName := printf "%s-dataplane-%s" $fullName .hostname }}
2928
{{- $annotations := .annotations | default dict }}
3029
---
31-
{{- if semverCompare ">=1.19-0" $gitVersion }}
3230
apiVersion: networking.k8s.io/v1
33-
{{- else if semverCompare ">=1.14-0" $gitVersion }}
34-
apiVersion: networking.k8s.io/v1beta1
35-
{{- else }}
36-
apiVersion: extensions/v1beta1
37-
{{- end }}
3831
kind: Ingress
3932
metadata:
4033
name: {{ $dataIngressName }}
4134
namespace: {{ $namespace | default "default" | quote }}
4235
labels:
4336
{{- $dataLabels | nindent 4 }}
4437
annotations:
45-
{{- if and .className (not (semverCompare ">=1.18-0" $gitVersion)) }}
46-
{{- if not (hasKey $annotations "kubernetes.io/ingress.class") }}
47-
{{- $_ := set $annotations "kubernetes.io/ingress.class" .className}}
48-
{{- end }}
49-
{{- end }}
5038
{{- if .certManager }}
5139
{{- if .certManager.issuer }}
5240
{{- $_ := set $annotations "cert-manager.io/issuer" .certManager.issuer}}
@@ -59,7 +47,7 @@ metadata:
5947
{{- toYaml . | nindent 4 }}
6048
{{- end }}
6149
spec:
62-
{{- if and .className (semverCompare ">=1.18-0" $gitVersion) }}
50+
{{- if .className }}
6351
ingressClassName: {{ .className }}
6452
{{- end }}
6553
{{- if .hostname }}
@@ -83,13 +71,10 @@ spec:
8371
- path: {{ $mapping.path }}
8472
pathType: Prefix
8573
backend:
86-
{{- if semverCompare ">=1.19-0" $gitVersion }}
8774
service:
8875
name: {{ $fullName }}-dataplane
8976
port:
9077
number: {{ $mapping.port }}
91-
{{- else }}
92-
{{- end }}
9378
{{- end }}
9479
{{- end }}
9580
{{- end }}

charts/tractusx-connector-memory/templates/ingress-runtime.yaml

+1-16
Original file line numberDiff line numberDiff line change
@@ -24,33 +24,21 @@
2424
{{- $fullName := include "txdc.fullname" . }}
2525
{{- $controlLabels := include "txdc.runtime.labels" . }}
2626
{{- $controlEdcEndpoints := .Values.runtime.endpoints }}
27-
{{- $gitVersion := .Capabilities.KubeVersion.GitVersion }}
2827
{{- $namespace := .Release.Namespace }}
2928

3029
{{- range .Values.runtime.ingresses }}
3130
{{- if and .enabled .endpoints }}
3231
{{- $controlIngressName := printf "%s-runtime-%s" $fullName .hostname }}
3332
{{- $annotations := .annotations | default dict }}
3433
---
35-
{{- if semverCompare ">=1.19-0" $gitVersion }}
3634
apiVersion: networking.k8s.io/v1
37-
{{- else if semverCompare ">=1.14-0" $gitVersion }}
38-
apiVersion: networking.k8s.io/v1beta1
39-
{{- else }}
40-
apiVersion: extensions/v1beta1
41-
{{- end }}
4235
kind: Ingress
4336
metadata:
4437
name: {{ $controlIngressName }}
4538
namespace: {{ $namespace | default "default" | quote }}
4639
labels:
4740
{{- $controlLabels | nindent 4 }}
4841
annotations:
49-
{{- if and .className (not (semverCompare ">=1.18-0" $gitVersion)) }}
50-
{{- if not (hasKey $annotations "kubernetes.io/ingress.class") }}
51-
{{- $_ := set $annotations "kubernetes.io/ingress.class" .className}}
52-
{{- end }}
53-
{{- end }}
5442
{{- if .certManager }}
5543
{{- if .certManager.issuer }}
5644
{{- $_ := set $annotations "cert-manager.io/issuer" .certManager.issuer}}
@@ -63,7 +51,7 @@ metadata:
6351
{{- toYaml . | nindent 4 }}
6452
{{- end }}
6553
spec:
66-
{{- if and .className (semverCompare ">=1.18-0" $gitVersion) }}
54+
{{- if .className }}
6755
ingressClassName: {{ .className }}
6856
{{- end }}
6957
{{- if .hostname }}
@@ -87,13 +75,10 @@ spec:
8775
- path: {{ $mapping.path }}
8876
pathType: Prefix
8977
backend:
90-
{{- if semverCompare ">=1.19-0" $gitVersion }}
9178
service:
9279
name: {{ $fullName }}-runtime
9380
port:
9481
number: {{ $mapping.port }}
95-
{{- else }}
96-
{{- end }}
9782
{{- end }}
9883
{{- end }}
9984
{{- end }}

charts/tractusx-connector/templates/ingress-controlplane.yaml

+1-16
Original file line numberDiff line numberDiff line change
@@ -24,33 +24,21 @@
2424
{{- $fullName := include "txdc.fullname" . }}
2525
{{- $controlLabels := include "txdc.controlplane.labels" . }}
2626
{{- $controlEdcEndpoints := .Values.controlplane.endpoints }}
27-
{{- $gitVersion := .Capabilities.KubeVersion.GitVersion }}
2827
{{- $namespace := .Release.Namespace }}
2928

3029
{{- range .Values.controlplane.ingresses }}
3130
{{- if and .enabled .endpoints }}
3231
{{- $controlIngressName := printf "%s-controlplane-%s" $fullName .hostname }}
3332
{{- $annotations := .annotations | default dict }}
3433
---
35-
{{- if semverCompare ">=1.19-0" $gitVersion }}
3634
apiVersion: networking.k8s.io/v1
37-
{{- else if semverCompare ">=1.14-0" $gitVersion }}
38-
apiVersion: networking.k8s.io/v1beta1
39-
{{- else }}
40-
apiVersion: extensions/v1beta1
41-
{{- end }}
4235
kind: Ingress
4336
metadata:
4437
name: {{ $controlIngressName }}
4538
namespace: {{ $namespace | default "default" | quote }}
4639
labels:
4740
{{- $controlLabels | nindent 4 }}
4841
annotations:
49-
{{- if and .className (not (semverCompare ">=1.18-0" $gitVersion)) }}
50-
{{- if not (hasKey $annotations "kubernetes.io/ingress.class") }}
51-
{{- $_ := set $annotations "kubernetes.io/ingress.class" .className}}
52-
{{- end }}
53-
{{- end }}
5442
{{- if .certManager }}
5543
{{- if .certManager.issuer }}
5644
{{- $_ := set $annotations "cert-manager.io/issuer" .certManager.issuer}}
@@ -63,7 +51,7 @@ metadata:
6351
{{- toYaml . | nindent 4 }}
6452
{{- end }}
6553
spec:
66-
{{- if and .className (semverCompare ">=1.18-0" $gitVersion) }}
54+
{{- if .className }}
6755
ingressClassName: {{ .className }}
6856
{{- end }}
6957
{{- if .hostname }}
@@ -87,13 +75,10 @@ spec:
8775
- path: {{ $mapping.path }}
8876
pathType: Prefix
8977
backend:
90-
{{- if semverCompare ">=1.19-0" $gitVersion }}
9178
service:
9279
name: {{ $fullName }}-controlplane
9380
port:
9481
number: {{ $mapping.port }}
95-
{{- else }}
96-
{{- end }}
9782
{{- end }}
9883
{{- end }}
9984
{{- end }}

charts/tractusx-connector/templates/ingress-dataplane.yaml

+1-16
Original file line numberDiff line numberDiff line change
@@ -24,33 +24,21 @@
2424
{{- $fullName := include "txdc.fullname" . }}
2525
{{- $dataLabels := include "txdc.dataplane.labels" . }}
2626
{{- $dataEdcEndpoints := .Values.dataplane.endpoints }}
27-
{{- $gitVersion := .Capabilities.KubeVersion.GitVersion }}
2827
{{- $namespace := .Release.Namespace }}
2928

3029
{{- range .Values.dataplane.ingresses }}
3130
{{- if and .enabled .endpoints }}
3231
{{- $dataIngressName := printf "%s-dataplane-%s" $fullName .hostname }}
3332
{{- $annotations := .annotations | default dict }}
3433
---
35-
{{- if semverCompare ">=1.19-0" $gitVersion }}
3634
apiVersion: networking.k8s.io/v1
37-
{{- else if semverCompare ">=1.14-0" $gitVersion }}
38-
apiVersion: networking.k8s.io/v1beta1
39-
{{- else }}
40-
apiVersion: extensions/v1beta1
41-
{{- end }}
4235
kind: Ingress
4336
metadata:
4437
name: {{ $dataIngressName }}
4538
namespace: {{ $namespace | default "default" | quote }}
4639
labels:
4740
{{- $dataLabels | nindent 4 }}
4841
annotations:
49-
{{- if and .className (not (semverCompare ">=1.18-0" $gitVersion)) }}
50-
{{- if not (hasKey $annotations "kubernetes.io/ingress.class") }}
51-
{{- $_ := set $annotations "kubernetes.io/ingress.class" .className}}
52-
{{- end }}
53-
{{- end }}
5442
{{- if .certManager }}
5543
{{- if .certManager.issuer }}
5644
{{- $_ := set $annotations "cert-manager.io/issuer" .certManager.issuer}}
@@ -63,7 +51,7 @@ metadata:
6351
{{- toYaml . | nindent 4 }}
6452
{{- end }}
6553
spec:
66-
{{- if and .className (semverCompare ">=1.18-0" $gitVersion) }}
54+
{{- if .className }}
6755
ingressClassName: {{ .className }}
6856
{{- end }}
6957
{{- if .hostname }}
@@ -87,13 +75,10 @@ spec:
8775
- path: {{ $mapping.path }}
8876
pathType: Prefix
8977
backend:
90-
{{- if semverCompare ">=1.19-0" $gitVersion }}
9178
service:
9279
name: {{ $fullName }}-dataplane
9380
port:
9481
number: {{ $mapping.port }}
95-
{{- else }}
96-
{{- end }}
9782
{{- end }}
9883
{{- end }}
9984
{{- end }}

0 commit comments

Comments
 (0)