-
Notifications
You must be signed in to change notification settings - Fork 803
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Initial network Policies for hub proxy singleuser #546
Merged
Merged
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
caa277d
Initial network Policies for hub proxy singleuser
manics 3e94aed
Remove default namespace in netpol
manics 48566bd
Add more ports including k8s api-server
manics 4f1dffd
Replace network policy ingress rules with matchLabel
manics acbee66
Remove access from singleuser to proxy
manics 85e8fff
Allow all egress for hub proxy by default
manics File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
spot-checking this PR from the fuuuture
what does
{{- if and <XXX> }}
accomplish? To the untrained eye it seems like this is a typo, or is there a particular use forif and
in the context of jinja?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
(nb. these aren't jinja templates but go templates)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pretty sure it's a typo that's Mostly Harmless(tm)