Skip to content

Commit

Permalink
Add option for setting nodePort for LoadBalancers (#389)
Browse files Browse the repository at this point in the history
* Add option for LoadBalancer nodePort
* Check configuration for LoadBalancer type
  • Loading branch information
gauthier-labs authored Nov 7, 2024
1 parent 8ed2006 commit f05354d
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 2 deletions.
2 changes: 1 addition & 1 deletion charts/prefect-server/templates/service.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ spec:
port: {{ .Values.service.port }}
protocol: TCP
targetPort: {{ .Values.service.targetPort }}
{{- if and (eq .Values.service.type "NodePort") (not (empty .Values.service.nodePort)) }}
{{- if and (or (eq .Values.service.type "NodePort") (eq .Values.service.type "LoadBalancer")) (not (empty .Values.service.nodePort)) }}
nodePort: {{ .Values.service.nodePort }}
{{- else if eq .Values.service.type "ClusterIP" }}
nodePort: null
Expand Down
22 changes: 21 additions & 1 deletion charts/prefect-server/tests/server_test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -488,7 +488,7 @@ tests:
path: .spec.ports[0].port
value: 4200

- it: Should set custom service configuration
- it: Should set custom service configuration for NodePort type
set:
service:
type: NodePort
Expand All @@ -508,6 +508,26 @@ tests:
path: .spec.ports[0].nodePort
value: 30080

- it: Should set custom service configuration for LoadBalancer type
set:
service:
type: LoadBalancer
port: 8080
nodePort: 30080
asserts:
- template: service.yaml
equal:
path: .spec.type
value: LoadBalancer
- template: service.yaml
equal:
path: .spec.ports[0].port
value: 8080
- template: service.yaml
equal:
path: .spec.ports[0].nodePort
value: 30080

- it: Should set ingress configuration when enabled
set:
ingress:
Expand Down

0 comments on commit f05354d

Please sign in to comment.