-
Notifications
You must be signed in to change notification settings - Fork 15
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* chore: add limits and requests to pods Signed-off-by: SdgJlbl <[email protected]> * chore: add network policy Signed-off-by: SdgJlbl <[email protected]> * revert: "chore: add limits and requests to pods" This reverts commit 8d277d6. * feat: deny all traffic Signed-off-by: Guilhem Barthés <[email protected]> * feat: allow connection to redis Signed-off-by: Guilhem Barthés <[email protected]> * feat: allow connection to database Signed-off-by: Guilhem Barthés <[email protected]> * feat: allow connection to docker-registry Signed-off-by: Guilhem Barthés <[email protected]> * feat: allow connection to storage Signed-off-by: Guilhem Barthés <[email protected]> * feat: allow connection to orc Signed-off-by: Guilhem Barthés <[email protected]> * feat: allow connection to internet Signed-off-by: Guilhem Barthés <[email protected]> * feat: add communication with server Signed-off-by: Guilhem Barthés <[email protected]> * feat: add communication with k8s api server Signed-off-by: Guilhem Barthés <[email protected]> * feat: add internet communication for builder Signed-off-by: Guilhem Barthés <[email protected]> * fix: add http requests between backends in same cluster Signed-off-by: Guilhem Barthés <[email protected]> * fix: add `skaffold-local-ingress` network policies Signed-off-by: Guilhem Barthés <[email protected]> * chore: test with weaker policy for api k8s Signed-off-by: Guilhem Barthés <[email protected]> * wip: test with weaker deny all Signed-off-by: Guilhem Barthés <[email protected]> * chore: remove commented code Signed-off-by: Guilhem Barthés <[email protected]> * chore: remove commented code as it is parsed by helm but not k8s Signed-off-by: Guilhem Barthés <[email protected]> * fix: `-api-server-egress` was not an array Signed-off-by: Guilhem Barthés <[email protected]> * fix: `-api-server-egress` `ipBlock` indentation Signed-off-by: Guilhem Barthés <[email protected]> * fix: add more private IP range to target kubernetes apiserver Signed-off-by: Guilhem Barthés <[email protected]> * feat: add `server.allowLocalRequests` parameter Signed-off-by: Guilhem Barthés <[email protected]> * chore: remove duplicate network policies (replaced by `allowLocalRequests`) Signed-off-by: Guilhem Barthés <[email protected]> * fix: add `role-api-k8s-client: 'true'` to builder when `privateCa.enabled` is enabled Signed-off-by: Guilhem Barthés <[email protected]> * chore: remove unused `deploy.kubectl` Signed-off-by: Guilhem Barthés <[email protected]> * fix: allow communication between backends in the same cluster Signed-off-by: Guilhem Barthés <[email protected]> * fix: allow communication between local backends with `allowLocalRequests` Signed-off-by: Guilhem Barthés <[email protected]> * fix: readd policy to prevent compute-task to communicate with internet Signed-off-by: Guilhem Barthés <[email protected]> * doc: update chart version and changelog Signed-off-by: Guilhem Barthés <[email protected]> * chore: add network policies for Harbor (#906) * chore: add network policies for Harbor * chore: add newline Signed-off-by: Guilhem Barthés <[email protected]> --------- Signed-off-by: Guilhem Barthés <[email protected]> Co-authored-by: Guilhem Barthés <[email protected]> * fix: remove wrong value for profile `three-org` Signed-off-by: Guilhem Barthés <[email protected]> --------- Signed-off-by: SdgJlbl <[email protected]> Signed-off-by: Guilhem Barthés <[email protected]> Co-authored-by: Guilhem Barthés <[email protected]>
- Loading branch information
1 parent
ae20351
commit c1d1fde
Showing
30 changed files
with
569 additions
and
74 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
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
Large diffs are not rendered by default.
Oops, something went wrong.
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
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
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
14 changes: 14 additions & 0 deletions
14
charts/substra-backend/templates/network-task-deny-all.yaml
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,14 @@ | ||
# Deny ALL networking in launched substra ml task | ||
apiVersion: networking.k8s.io/v1 | ||
kind: NetworkPolicy | ||
metadata: | ||
name: {{ template "substra.fullname". }}-deny-ingress | ||
labels: | ||
{{ include "substra.labels" . | nindent 4 }} | ||
spec: | ||
podSelector: | ||
matchLabels: | ||
substra.ai/pod-type: compute-task | ||
policyTypes: | ||
- Ingress | ||
- Egress |
17 changes: 17 additions & 0 deletions
17
charts/substra-backend/templates/networkpolicy-api-server.yaml
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,17 @@ | ||
apiVersion: networking.k8s.io/v1 | ||
kind: NetworkPolicy | ||
metadata: | ||
name: {{ template "substra.name". }}-api-server-egress | ||
spec: | ||
podSelector: | ||
matchLabels: | ||
app.kubernetes.io/part-of: {{ template "substra.name" . }} | ||
role-api-k8s-client: 'true' | ||
policyTypes: | ||
- Egress | ||
egress: | ||
- to: | ||
- ipBlock: | ||
cidr: 10.0.0.0/8 | ||
- ipBlock: | ||
cidr: 172.16.0.0/12 |
42 changes: 42 additions & 0 deletions
42
charts/substra-backend/templates/networkpolicy-database.yaml
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,42 @@ | ||
apiVersion: networking.k8s.io/v1 | ||
kind: NetworkPolicy | ||
metadata: | ||
name: {{ template "substra.name". }}-database-ingress | ||
spec: | ||
podSelector: | ||
matchLabels: | ||
app.kubernetes.io/component: primary | ||
app.kubernetes.io/name: postgresql | ||
policyTypes: | ||
- Ingress | ||
ingress: | ||
- from: | ||
- podSelector: | ||
matchLabels: | ||
app.kubernetes.io/part-of: {{ template "substra.name" . }} | ||
role-database-client: 'true' | ||
ports: | ||
- protocol: TCP | ||
port: {{ .Values.database.port }} | ||
egress: [] | ||
--- | ||
apiVersion: networking.k8s.io/v1 | ||
kind: NetworkPolicy | ||
metadata: | ||
name: {{ template "substra.name". }}-database-egress | ||
spec: | ||
podSelector: | ||
matchLabels: | ||
app.kubernetes.io/part-of: {{ template "substra.name" . }} | ||
role-database-client: 'true' | ||
policyTypes: | ||
- Egress | ||
egress: | ||
- to: | ||
- podSelector: | ||
matchLabels: | ||
app.kubernetes.io/component: primary | ||
app.kubernetes.io/name: postgresql | ||
ports: | ||
- protocol: TCP | ||
port: {{ .Values.database.port }} |
23 changes: 23 additions & 0 deletions
23
charts/substra-backend/templates/networkpolicy-deny-all.yaml
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,23 @@ | ||
kind: NetworkPolicy | ||
apiVersion: networking.k8s.io/v1 | ||
metadata: | ||
name: {{ template "substra.name". }}-deny-all-backend | ||
spec: | ||
podSelector: | ||
matchLabels: | ||
app.kubernetes.io/part-of: substra-backend | ||
ingress: [] | ||
egress: | ||
- to: | ||
# Allow internal DNS reslution | ||
- namespaceSelector: | ||
matchLabels: | ||
kubernetes.io/metadata.name: kube-system | ||
podSelector: | ||
matchLabels: | ||
k8s-app: kube-dns | ||
ports: | ||
- protocol: TCP | ||
port: 53 | ||
- protocol: UDP | ||
port: 53 |
61 changes: 61 additions & 0 deletions
61
charts/substra-backend/templates/networkpolicy-internet.yaml
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,61 @@ | ||
apiVersion: networking.k8s.io/v1 | ||
kind: NetworkPolicy | ||
metadata: | ||
name: {{ template "substra.name". }}-internet-ingress | ||
spec: | ||
ingress: | ||
- from: | ||
- ipBlock: | ||
cidr: 0.0.0.0/0 | ||
{{- if not .Values.server.allowLocalRequests }} | ||
except: | ||
- 10.0.0.0/8 | ||
- 192.168.0.0/16 | ||
- 172.16.0.0/20 | ||
{{- end }} | ||
podSelector: | ||
matchLabels: | ||
app.kubernetes.io/part-of: {{ template "substra.name" . }} | ||
role-internet-ingress: 'true' | ||
policyTypes: | ||
- Ingress | ||
--- | ||
apiVersion: networking.k8s.io/v1 | ||
kind: NetworkPolicy | ||
metadata: | ||
name: {{ template "substra.name". }}-internet-egress | ||
spec: | ||
egress: | ||
- to: | ||
- ipBlock: | ||
cidr: 0.0.0.0/0 | ||
except: | ||
- 10.0.0.0/8 | ||
- 192.168.0.0/16 | ||
- 172.16.0.0/20 | ||
podSelector: | ||
matchLabels: | ||
# Not filtering on substra.name as kaniko builder needs access too | ||
role-internet-egress: 'true' | ||
policyTypes: | ||
- Egress | ||
--- | ||
apiVersion: networking.k8s.io/v1 | ||
kind: NetworkPolicy | ||
metadata: | ||
name: {{ template "substra.name". }}-internet-builder-egress | ||
spec: | ||
egress: | ||
- to: | ||
ports: | ||
- protocol: TCP | ||
port: 53 | ||
- protocol: UDP | ||
port: 53 | ||
podSelector: | ||
matchLabels: | ||
app.kubernetes.io/component: substra-compute | ||
# Not filtering on substra.name as kaniko builder needs access too | ||
role-internet-egress: 'true' | ||
policyTypes: | ||
- Egress |
21 changes: 21 additions & 0 deletions
21
charts/substra-backend/templates/networkpolicy-orchestrator-client.yaml
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,21 @@ | ||
apiVersion: networking.k8s.io/v1 | ||
kind: NetworkPolicy | ||
metadata: | ||
name: {{ include "substra.name" . }}-orchestrator-client-egress | ||
spec: | ||
podSelector: | ||
matchLabels: | ||
role-orchestrator-client: 'true' | ||
policyTypes: | ||
- Egress | ||
egress: | ||
- to: | ||
- namespaceSelector: {} | ||
podSelector: | ||
matchLabels: | ||
app.kubernetes.io/name: orchestrator | ||
app.kubernetes.io/component: "server" | ||
ports: | ||
- protocol: TCP | ||
port: {{ .Values.orchestrator.port }} | ||
|
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,43 @@ | ||
apiVersion: networking.k8s.io/v1 | ||
kind: NetworkPolicy | ||
metadata: | ||
name: {{ template "substra.name". }}-redis-ingress | ||
spec: | ||
podSelector: | ||
matchLabels: | ||
app.kubernetes.io/component: master | ||
app.kubernetes.io/name: redis | ||
policyTypes: | ||
- Ingress | ||
ingress: | ||
- from: | ||
- podSelector: | ||
matchLabels: | ||
app.kubernetes.io/part-of: {{ template "substra.name" . }} | ||
role-redis-client: 'true' | ||
ports: | ||
- protocol: TCP | ||
port: {{ .Values.redis.master.service.ports.redis }} | ||
egress: [] | ||
--- | ||
apiVersion: networking.k8s.io/v1 | ||
kind: NetworkPolicy | ||
metadata: | ||
name: {{ template "substra.name". }}-redis-egress | ||
spec: | ||
podSelector: | ||
matchLabels: | ||
app.kubernetes.io/part-of: {{ template "substra.name" . }} | ||
role-redis-client: 'true' | ||
|
||
policyTypes: | ||
- Egress | ||
egress: | ||
- to: | ||
- podSelector: | ||
matchLabels: | ||
app.kubernetes.io/component: master | ||
app.kubernetes.io/name: redis | ||
ports: | ||
- protocol: TCP | ||
port: {{ .Values.redis.master.service.ports.redis }} |
Oops, something went wrong.