Skip to content

Commit

Permalink
Merge pull request jupyterhub#1380 from yuvipanda/feat/netpol-custom
Browse files Browse the repository at this point in the history
Allow adding additional ingress rules in network policy
  • Loading branch information
consideRatio authored Aug 31, 2019
2 parents 7087fdb + 94b50f3 commit 54b884b
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 0 deletions.
4 changes: 4 additions & 0 deletions jupyterhub/templates/hub/netpol.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,10 @@ spec:
ports:
- protocol: TCP
port: 8081
{{- /* Useful if you want to give hub access to pods from other namespaces */}}
{{- if .Values.hub.networkPolicy.ingress}}
{{- .Values.hub.networkPolicy.ingress| toYaml | trimSuffix "\n" | nindent 4 }}
{{- end }}
egress:
{{- /*
The default is to allow all egress for hub If you want to restrict it the
Expand Down
4 changes: 4 additions & 0 deletions jupyterhub/templates/proxy/netpol.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,10 @@ spec:
ports:
- protocol: TCP
port: 8001
{{- /* Useful if you want to give proxy access to pods from other namespaces */}}
{{- if .Values.proxy.networkPolicy.ingress}}
{{- .Values.proxy.networkPolicy.ingress | toYaml | trimSuffix "\n" | nindent 4 }}
{{- end }}
egress:
{{- /*
The default is to allow all egress for proxy If you want to restrict it the
Expand Down
4 changes: 4 additions & 0 deletions jupyterhub/templates/singleuser/netpol.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,10 @@ spec:
ports:
- protocol: TCP
port: 8888
{{- /* Useful if you want to give user server access to pods from other namespaces */}}
{{- if .Values.singleuser.networkPolicy.ingress }}
{{- .Values.singleuser.networkPolicy.ingress | toYaml | trimSuffix "\n" | nindent 4 }}
{{- end }}
egress:
- to:
- podSelector:
Expand Down
3 changes: 3 additions & 0 deletions jupyterhub/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ hub:
minAvailable: 1
networkPolicy:
enabled: false
ingress: []
egress:
- to:
- ipBlock:
Expand Down Expand Up @@ -124,6 +125,7 @@ proxy:
hosts: []
networkPolicy:
enabled: false
ingress: []
egress:
- to:
- ipBlock:
Expand Down Expand Up @@ -170,6 +172,7 @@ singleuser:
ip: 169.254.169.254
networkPolicy:
enabled: false
ingress: []
egress:
# Required egress is handled by other rules so it's safe to modify this
- to:
Expand Down

0 comments on commit 54b884b

Please sign in to comment.