-
Notifications
You must be signed in to change notification settings - Fork 803
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #546 from manics/network-policy
Initial network Policies for hub proxy singleuser
- Loading branch information
Showing
7 changed files
with
144 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
{{- if and .Values.hub.networkPolicy.enabled }} | ||
apiVersion: networking.k8s.io/v1 | ||
kind: NetworkPolicy | ||
metadata: | ||
name: hub-network-policy | ||
spec: | ||
podSelector: | ||
matchLabels: | ||
name: hub | ||
app: jupyterhub | ||
component: hub | ||
policyTypes: | ||
- Ingress | ||
- Egress | ||
ingress: | ||
- from: | ||
- podSelector: | ||
matchLabels: | ||
hub.jupyter.org/network-access-hub: "true" | ||
ports: | ||
- protocol: TCP | ||
port: 8081 | ||
egress: | ||
# The default is to allow all egress for hub | ||
# If you want to restrict it the following egress is required | ||
# proxy:8001 | ||
# singleuser:8888 | ||
# Kubernetes api-server | ||
{{ if .Values.hub.networkPolicy.egress }} | ||
{{ toYaml .Values.hub.networkPolicy.egress | indent 2 }} | ||
{{- end }} | ||
{{- end }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
{{- if and .Values.singleuser.networkPolicy.enabled }} | ||
apiVersion: networking.k8s.io/v1 | ||
kind: NetworkPolicy | ||
metadata: | ||
name: singleuser-network-policy | ||
spec: | ||
podSelector: | ||
matchLabels: | ||
app: jupyterhub | ||
component: singleuser-server | ||
policyTypes: | ||
- Ingress | ||
- Egress | ||
ingress: | ||
- from: | ||
- podSelector: | ||
matchLabels: | ||
hub.jupyter.org/network-access-singleuser: "true" | ||
ports: | ||
- protocol: TCP | ||
port: 8888 | ||
egress: | ||
- to: | ||
- podSelector: | ||
matchLabels: | ||
name: hub | ||
app: jupyterhub | ||
component: hub | ||
ports: | ||
- protocol: TCP | ||
port: 8081 | ||
{{ if .Values.singleuser.networkPolicy.egress }} | ||
{{ toYaml .Values.singleuser.networkPolicy.egress | indent 2 }} | ||
{{- end }} | ||
{{- end }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
{{- if and .Values.proxy.networkPolicy.enabled }} | ||
apiVersion: networking.k8s.io/v1 | ||
kind: NetworkPolicy | ||
metadata: | ||
name: proxy-network-policy | ||
spec: | ||
podSelector: | ||
matchLabels: | ||
name: proxy | ||
component: proxy | ||
policyTypes: | ||
- Ingress | ||
- Egress | ||
ingress: | ||
- ports: | ||
- protocol: TCP | ||
port: 80 | ||
- protocol: TCP | ||
port: 443 | ||
# kube-lego /healthz | ||
- protocol: TCP | ||
port: 8080 | ||
# nginx /healthz | ||
- protocol: TCP | ||
port: 10254 | ||
- from: | ||
- podSelector: | ||
matchLabels: | ||
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: | ||
# The default is to allow all egress for proxy | ||
# If you want to restrict it the following egress is required | ||
# hub:8081 | ||
# singleuser:8888 | ||
# Kubernetes api-server | ||
{{- if .Values.proxy.networkPolicy.egress }} | ||
{{ toYaml .Values.proxy.networkPolicy.egress | indent 2 }} | ||
{{- end }} | ||
{{- end }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters