traefik-helm-chart
                                
                                
                                
                                    traefik-helm-chart copied to clipboard
                            
                            
                            
                        Moved list object to individual objects
What does this PR do?
Affects the Helm template for the Service objects: This PR removes the List object for Services in favor of using the two  individual Service objects.
Why? For better compatibility with Kubernetes linters, generators and operators.
Motivation
The kind: List object is typically convenience type used by kubectl for lists of mixed types. In this specific case it contains two Service object. The use of List objects still is a bit opague. Since it is the only List object used in the Helm chart, and it does not add functionality, I opt to remove the LIst object and move the two nested Service objects to the top level.
Context on the List object:
More
- [x] Yes, I updated the chart version
 
Additional Notes
Tests pass
Resolved merge conflict and updated affected tests
Hello @mpepping
Thanks for your PR. I rebased and updated it with the last changes.
I'm also thinking about making a template shared for both services, since the diff between them is quite small:
--- udp	2022-10-10 18:04:23.915215009 +0200
+++ tcp	2022-10-10 17:53:58.841614989 +0200
@@ -1,7 +1,7 @@
 apiVersion: v1
 kind: Service
 metadata:
-  name: {{ template "traefik.fullname" . }}-udp
+  name: {{ template "traefik.fullname" . }}
   labels:
     app.kubernetes.io/name: {{ template "traefik.name" . }}
     helm.sh/chart: {{ template "traefik.chart" . }}
@@ -11,7 +11,7 @@
   {{- toYaml . | nindent 4 }}
   {{- end }}
   annotations:
-  {{- with (merge .Values.service.annotationsUDP .Values.service.annotations) }}
+  {{- with (merge .Values.service.annotationsTCP .Values.service.annotations) }}
   {{- toYaml . | nindent 4 }}
   {{- end }}
 spec:
@@ -24,12 +24,12 @@
     app.kubernetes.io/name: {{ template "traefik.name" . }}
     app.kubernetes.io/instance: {{ .Release.Name }}
   ports:
-  {{- range $name, $config := $udpPorts }}
+  {{- range $name, $config := $tcpPorts }}
   {{- if $config.expose }}
   - port: {{ default $config.port $config.exposedPort }}
     name: {{ $name }}
-    targetPort: {{ if $config.http3 }}{{ $config.port }}{{ else }}{{ $name | quote }}{{ end }}
-    protocol: UDP
+    targetPort: {{ $name | quote }}
+    protocol: TCP
     {{- if $config.nodePort }}
     nodePort: {{ $config.nodePort }}
     {{- end }}
Wdyt ?
I'm also thinking about making a template shared for both services, since the diff between them is quite small: [..] Wdyt ?
Even better, @mloiseleur! Both objects are quite similar. Nice work!