Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add missing Service spec fields #132

Merged
merged 2 commits into from
Feb 9, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 22 additions & 0 deletions traefikee/templates/proxy/service.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,31 @@ metadata:
spec:
type: {{ $proxy.serviceType | default "LoadBalancer" }}
ports: {{ toYaml $proxy.servicePorts | nindent 4 }}
{{- with $proxy.clusterIP }}
clusterIP: {{ . }}
{{- end }}
{{- with $proxy.externalIPs }}
externalIPs: {{- toYaml . | nindent 2 }}
{{- end }}
{{- with $proxy.externalTrafficPolicy }}
externalTrafficPolicy: {{ . }}
{{- end }}
{{- with $proxy.ipFamilyPolicy }}
ipFamilyPolicy: {{ . }}
{{- end }}
{{- with $proxy.ipFamilies }}
ipFamilies: {{- toYaml . | nindent 2 }}
{{- end }}
{{- with $proxy.loadBalancerClass }}
loadBalancerClass: {{ . }}
{{- end }}
{{- with $proxy.loadBalancerIP }}
loadBalancerIP: {{ . }}
{{- end }}
{{- with $proxy.loadBalancerSourceRanges }}
loadBalancerSourceRanges: {{- toYaml . | nindent 2 }}
{{- end }}

selector:
app: traefikee
release: {{ $.Values.cluster }}
Expand Down
37 changes: 34 additions & 3 deletions traefikee/tests/proxy_service_test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -50,11 +50,21 @@ tests:
- equal:
path: spec.loadBalancerIP
value: "1.2.3.4"
- it: should set loadbalancerIP
- it: should set service spec options
set:
proxy:
loadBalancerIP: "1.2.3.4"
serviceType: LoadBalancer
clusterIP: "1.2.3.4"
externalIPs: [ "1.1.1.1", "2.2.2.2" ]
## One of Cluster or Local
externalTrafficPolicy: Cluster
## One of SingleStack, PreferDualStack, or RequireDualStack.
ipFamilyPolicy: SingleStack
## List of IP families (e.g. IPv4 and/or IPv6).
ipFamilies: [ "IPv4", "IPv6" ]
loadBalancerClass: "lb"
loadBalancerIP: "5.6.7.8"
loadBalancerSourceRanges: [ "3.3.3.3/28", "4.4.4.4/32" ]
asserts:
- isKind:
of: Service
Expand All @@ -64,8 +74,29 @@ tests:
path: spec.type
value: LoadBalancer
- equal:
path: spec.loadBalancerIP
path: spec.clusterIP
value: "1.2.3.4"
- lengthEqual:
path: spec.externalIPs
count: 2
- equal:
path: spec.externalTrafficPolicy
value: "Cluster"
- equal:
path: spec.ipFamilyPolicy
value: "SingleStack"
- lengthEqual:
path: spec.ipFamilies
count: 2
- equal:
path: spec.loadBalancerClass
value: "lb"
- equal:
path: spec.loadBalancerIP
value: "5.6.7.8"
- lengthEqual:
path: spec.loadBalancerSourceRanges
count: 2
- it: should have label selector
set:
cluster: mysupertraefikee
Expand Down
16 changes: 14 additions & 2 deletions traefikee/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -194,8 +194,20 @@ proxy:
- name: https
port: 443
targetPort: https
# # Specify Static IP of cloud provider LB
# loadBalancerIP: "1.2.3.4"
## Service spec options
mloiseleur marked this conversation as resolved.
Show resolved Hide resolved
## /!\ Note: some Service fields are immutable.
## `helm upgrade --force [...]` can be used to replace resources with immutable fields.
clusterIP:
externalIPs:
## One of Cluster or Local
externalTrafficPolicy:
mloiseleur marked this conversation as resolved.
Show resolved Hide resolved
## One of SingleStack, PreferDualStack, or RequireDualStack.
ipFamilyPolicy:
## List of IP families (e.g. IPv4 and/or IPv6).
ipFamilies:
loadBalancerClass:
loadBalancerIP:
loadBalancerSourceRanges:

# To disable affinity at all set this value to null
affinity:
Expand Down