Skip to content

Commit

Permalink
Replace network policy ingress rules with matchLabel
Browse files Browse the repository at this point in the history
hub.jupyter.org/network-access-*: "true"
  • Loading branch information
manics committed Mar 6, 2018
1 parent c112942 commit e22e4a3
Show file tree
Hide file tree
Showing 6 changed files with 15 additions and 19 deletions.
5 changes: 2 additions & 3 deletions jupyterhub/templates/hub/configmap.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -170,11 +170,10 @@ data:
{{ if .Values.singleuser.cpu.guarantee -}}
singleuser.cpu.guarantee: {{ .Values.singleuser.cpu.guarantee | quote}}
{{- end }}
{{ if .Values.singleuser.extraLabels -}}
singleuser.extra-labels: |
{{ range $key, $value := .Values.singleuser.extraLabels -}}
hub.jupyter.org/network-access-hub: "true"
{{ range $key, $value := .Values.singleuser.extraLabels -}}
{{ $key | quote }}: {{ $value | quote }}
{{- end }}
{{- end }}
{{ if .Values.singleuser.extraEnv -}}
singleuser.extra-env: |
Expand Down
3 changes: 3 additions & 0 deletions jupyterhub/templates/hub/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,9 @@ spec:
component: hub
release: {{ .Release.Name }}
heritage: {{ .Release.Service }}
hub.jupyter.org/network-access-proxy-api: "true"
hub.jupyter.org/network-access-proxy-http: "true"
hub.jupyter.org/network-access-singleuser: "true"
{{ if .Values.hub.labels -}}
# Because toYaml + indent is super flaky
{{ range $key, $value := .Values.proxy.labels -}}
Expand Down
7 changes: 1 addition & 6 deletions jupyterhub/templates/hub/netpol-hub.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,7 @@ spec:
- from:
- podSelector:
matchLabels:
name: proxy
component: proxy
- podSelector:
matchLabels:
app: jupyterhub
component: singleuser-server
hub.jupyter.org/network-access-hub: "true"
ports:
- protocol: TCP
port: 8081
Expand Down
8 changes: 1 addition & 7 deletions jupyterhub/templates/hub/netpol-singleuser.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,7 @@ spec:
- from:
- podSelector:
matchLabels:
name: hub
app: jupyterhub
component: hub
- podSelector:
matchLabels:
name: proxy
component: proxy
hub.jupyter.org/network-access-singleuser: "true"
ports:
- protocol: TCP
port: 8888
Expand Down
2 changes: 2 additions & 0 deletions jupyterhub/templates/proxy/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,8 @@ spec:
# required for kube-lego to work
app: kube-lego
{{- end }}
hub.jupyter.org/network-access-hub: "true"
hub.jupyter.org/network-access-singleuser: "true"
spec:
{{- if .Values.rbac.enabled }}
serviceAccountName: proxy
Expand Down
9 changes: 6 additions & 3 deletions jupyterhub/templates/proxy/netpol-proxy.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -26,12 +26,15 @@ spec:
- from:
- podSelector:
matchLabels:
name: hub
app: jupyterhub
component: hub
hub.jupyter.org/network-access-proxy-http: "true"
ports:
- protocol: TCP
port: 8000
- from:
- podSelector:
matchLabels:
hub.jupyter.org/network-access-proxy-api: "true"
ports:
- protocol: TCP
port: 8001
egress:
Expand Down

0 comments on commit e22e4a3

Please sign in to comment.