Skip to content

Commit

Permalink
Add config for k8s Services' ipFamilies and ipFamilyPolicy
Browse files Browse the repository at this point in the history
  • Loading branch information
consideRatio committed Sep 18, 2024
1 parent aef71b2 commit 8a1a5a6
Show file tree
Hide file tree
Showing 6 changed files with 40 additions and 7 deletions.
13 changes: 10 additions & 3 deletions jupyterhub/templates/hub/service.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,6 @@ metadata:
{{- end }}
spec:
type: {{ .Values.hub.service.type }}
{{- with .Values.hub.service.loadBalancerIP }}
loadBalancerIP: {{ . }}
{{- end }}
selector:
{{- include "jupyterhub.matchLabels" . | nindent 4 }}
ports:
Expand All @@ -35,3 +32,13 @@ spec:
{{- with .Values.hub.service.extraPorts }}
{{- . | toYaml | nindent 4 }}
{{- end }}
{{- with .Values.hub.service.loadBalancerIP }}
loadBalancerIP: {{ . }}
{{- end }}
{{- with .Values.hub.service.ipFamilyPolicy }}
ipFamilyPolicy: {{ . }}
{{- end }}
{{- with .Values.hub.service.ipFamilies }}
ipFamilies:
{{- . | toYaml | nindent 4 }}
{{- end }}
7 changes: 7 additions & 0 deletions jupyterhub/templates/proxy/autohttps/service.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -22,4 +22,11 @@ spec:
ports:
- port: 8000
targetPort: http
{{- with .Values.proxy.service.ipFamilyPolicy }}
ipFamilyPolicy: {{ . }}
{{- end }}
{{- with .Values.proxy.service.ipFamilies }}
ipFamilies:
{{- . | toYaml | nindent 4 }}
{{- end }}
{{- end }}
6 changes: 2 additions & 4 deletions jupyterhub/templates/proxy/service.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -79,10 +79,8 @@ spec:
ipFamilyPolicy: {{ . }}
{{- end }}
{{- with .Values.proxy.service.ipFamilies }}
ipFamilies:
{{- range $family := . }}
- {{ $family }}
{{- end }}
ipFamilies:
{{- . | toYaml | nindent 4 }}
{{- end }}
{{- if eq .Values.proxy.service.type "LoadBalancer" }}
{{- with .Values.proxy.service.loadBalancerSourceRanges }}
Expand Down
12 changes: 12 additions & 0 deletions jupyterhub/values.schema.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -1127,6 +1127,16 @@ properties:
A public IP address the hub Kubernetes service should be exposed
on. To expose the hub directly is not recommended. Instead route
traffic through the proxy-public service towards the hub.
ipFamilyPolicy: &ipFamilyPolicy-spec
type: [string]
description: |
See the [Kubernetes docs](https://kubernetes.io/docs/concepts/services-networking/dual-stack/#services)
for more info.
ipFamilies: &ipFamilies-spec
type: array
description: |
See the [Kubernetes docs](https://kubernetes.io/docs/concepts/services-networking/dual-stack/#services)
for more info.
pdb: &pdb-spec
type: object
Expand Down Expand Up @@ -1744,6 +1754,8 @@ properties:
description: |
A list of IP CIDR ranges that are allowed to access the load balancer service.
Defaults to allowing everyone to access it.
ipFamilyPolicy: *ipFamilyPolicy-spec
ipFamilies: *ipFamilies-spec
https:
type: object
additionalProperties: false
Expand Down
2 changes: 2 additions & 0 deletions jupyterhub/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,8 @@ hub:
nodePort:
extraPorts: []
loadBalancerIP:
ipFamilyPolicy: ""
ipFamilies: []
baseUrl: /
cookieSecret:
initContainers: []
Expand Down
7 changes: 7 additions & 0 deletions tools/templates/lint-and-validate-values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,9 @@ hub:
- name: dummy-port-2
port: 8182
targetPort: string-named-target-port
ipFamilyPolicy: SingleStack
ipFamilies:
- IPv4
baseUrl: /
activeServerLimit: 3
deploymentStrategy:
Expand Down Expand Up @@ -223,6 +226,10 @@ proxy:
nodePorts:
http:
https:
ipFamilyPolicy: DualStack
ipFamilies:
- IPv4
- IPv6
chp:
revisionHistoryLimit: 1
extraCommandLineFlags:
Expand Down

0 comments on commit 8a1a5a6

Please sign in to comment.