Skip to content
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

Add network policy to allow connections to the metal api #376

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
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
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,10 @@ spec:
networking.gardener.cloud/to-public-networks: allowed
networking.gardener.cloud/to-private-networks: allowed
networking.resources.gardener.cloud/to-all-shoots-kube-apiserver-tcp-443: allowed
{{ include "labels" . | indent 8 }}
{{- if .Values.networkPolicies.enabled }}
networking.resources.gardener.cloud/to-metal-api: allowed
{{- end }}
{{ include "labels" . | indent 8 }}
spec:
containers:
- name: {{ include "name" . }}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
{{- if .Values.networkPolicies.enabled }}
apiVersion: networking.k8s.io/v1
kind: NetworkPolicy
metadata:
name: to-metal-api
spec:
egress:
- ports:
- port: 8080
protocol: TCP
to:
- namespaceSelector:
matchLabels:
kubernetes.io/metadata.name: {{ .Values.networkPolicies.toMetalApi.namespace }}
- podSelector:
matchLabels: {{ .Values.networkPolicies.toMetalApi.ingressController.podSelector | nindent 12 }}
- ports:
- port: 80
protocol: TCP
- port: 443
protocol: TCP
to:
- namespaceSelector:
matchLabels:
kubernetes.io/metadata.name: {{ .Values.networkPolicies.toMetalApi.ingressController.namespace }}
- podSelector: {}
podSelector:
matchLabels:
networking.resources.gardener.cloud/to-metal-api: allowed
policyTypes:
- Egress
{{- end }}
9 changes: 9 additions & 0 deletions charts/gardener-extension-provider-metal/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -85,3 +85,12 @@ config:
gardener:
seed:
provider: metal

networkPolicies:
enabled: false
toMetalApi:
namespace: metal-control-plane
podSelector:
app: metal-api
ingressController:
namespace: ingress-nginx
Loading