Skip to content

✨ Introduce NetworkPolicy for core component workloads. #3579

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

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
86 changes: 86 additions & 0 deletions deploy/chart/templates/0000_50_olm_01-networkpolicies.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
apiVersion: networking.k8s.io/v1
kind: NetworkPolicy
metadata:
name: default-deny-all-traffic
namespace: {{ .Values.namespace }}
spec:
podSelector: { }
policyTypes:
- Ingress
- Egress
---
apiVersion: networking.k8s.io/v1
kind: NetworkPolicy
metadata:
name: olm-operator
namespace: {{ .Values.namespace }}
spec:
podSelector:
matchLabels:
app: olm-operator
ingress:
- {{ .Values.networkPolicy.metrics | toYaml | nindent 6 | trimSuffix "\n" }}
egress:
- {{ .Values.networkPolicy.kubeAPIServer | toYaml | nindent 6 | trimSuffix "\n" }}
- {{ .Values.networkPolicy.dns | toYaml | nindent 6 | trimSuffix "\n" }}
policyTypes:
- Ingress
- Egress
---
apiVersion: networking.k8s.io/v1
kind: NetworkPolicy
metadata:
name: catalog-operator
namespace: {{ .Values.namespace }}
spec:
podSelector:
matchLabels:
app: catalog-operator
ingress:
- {{ .Values.networkPolicy.metrics | toYaml | nindent 6 | trimSuffix "\n" }}
egress:
- {{ .Values.networkPolicy.kubeAPIServer | toYaml | nindent 6 | trimSuffix "\n" }}
- {{ .Values.networkPolicy.dns | toYaml | nindent 6 | trimSuffix "\n" }}
- ports: # This is another distinct rule in the egress list
- protocol: TCP
port: {{ .Values.catalogGrpcPodPort }}
policyTypes:
- Ingress
- Egress
---
apiVersion: networking.k8s.io/v1
kind: NetworkPolicy
metadata:
name: packageserver
namespace: {{ .Values.namespace }}
spec:
podSelector:
matchLabels:
app: packageserver
ingress:
- ports:
- protocol: TCP
port: {{ .Values.package.service.internalPort }}
egress:
- {{ .Values.networkPolicy.dns | toYaml | nindent 6 | trimSuffix "\n" }}
- ports:
- protocol: TCP
port: {{ .Values.catalogGrpcPodPort }}
policyTypes:
- Ingress
- Egress
---
apiVersion: networking.k8s.io/v1
kind: NetworkPolicy
metadata:
name: default-allow-all
namespace: {{ .Values.operator_namespace }}
spec:
podSelector: { }
policyTypes:
- Ingress
- Egress
ingress:
- { }
egress:
- { }
18 changes: 18 additions & 0 deletions deploy/chart/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@ writeStatusName: '""'
imagestream: false
debug: false
installType: upstream
catalogGrpcPodPort: 50051

olm:
replicaCount: 1
image:
Expand Down Expand Up @@ -75,3 +77,19 @@ package:
monitoring:
enabled: false
namespace: monitoring

networkPolicy:
dns:
ports:
- protocol: TCP
port: 53
- protocol: UDP
port: 53
kubeAPIServer:
ports:
- protocol: TCP
port: 6443
metrics:
ports:
- protocol: TCP
port: metrics