Skip to content
Snippets Groups Projects
Verified Commit 0cce90e7 authored by Sheogorath's avatar Sheogorath :european_castle:
Browse files

chore(shared): Switch network policies to matchExpressions

This patch moves from labelSelectors to matchExpressions since they are
immune to kustomize commonLabels, which prevents them from being
overwritten by accident.

References:
https://github.com/kubernetes-sigs/kustomize/issues/157
https://github.com/kubernetes-sigs/kustomize/issues/1009
parent 7d0b90e4
No related branches found
No related tags found
No related merge requests found
...@@ -11,8 +11,11 @@ spec: ...@@ -11,8 +11,11 @@ spec:
matchLabels: matchLabels:
database.shivering-isles.com/network-access-required: "true" database.shivering-isles.com/network-access-required: "true"
podSelector: podSelector:
matchLabels: matchExpressions:
app.kubernetes.io/name: postgres-operator - key: app.kubernetes.io/name
operator: In
values:
- postgres-operator
ports: ports:
- port: 8008 - port: 8008
protocol: TCP protocol: TCP
...@@ -25,13 +28,19 @@ spec: ...@@ -25,13 +28,19 @@ spec:
matchLabels: matchLabels:
monitoring.shivering-isles.com/network-access-required: "true" monitoring.shivering-isles.com/network-access-required: "true"
podSelector: podSelector:
matchLabels: matchExpressions:
app.kubernetes.io/name: prometheus - key: app.kubernetes.io/name
operator: In
values:
- prometheus
ports: ports:
- port: 9187 - port: 9187
protocol: TCP protocol: TCP
- port: 8008 - port: 8008
protocol: TCP protocol: TCP
podSelector: podSelector:
matchLabels: matchExpressions:
application: spilo - key: application
operator: In
values:
- spilo
...@@ -9,3 +9,5 @@ spec: ...@@ -9,3 +9,5 @@ spec:
- namespaceSelector: - namespaceSelector:
matchLabels: matchLabels:
ingress.shivering-isles.com/network-access-required: "true" ingress.shivering-isles.com/network-access-required: "true"
podSelector:
matchLabels: {}
\ No newline at end of file
...@@ -9,8 +9,6 @@ spec: ...@@ -9,8 +9,6 @@ spec:
- namespaceSelector: - namespaceSelector:
matchLabels: matchLabels:
kubernetes.io/metadata.name: kube-system kubernetes.io/metadata.name: kube-system
podSelector:
matchLabels: {}
- from: - from:
- ipBlock: - ipBlock:
cidr: 192.168.100.0/24 # Kubernetes hosts cidr: 192.168.100.0/24 # Kubernetes hosts
......
...@@ -11,5 +11,10 @@ spec: ...@@ -11,5 +11,10 @@ spec:
matchLabels: matchLabels:
monitoring.shivering-isles.com/network-access-required: "true" monitoring.shivering-isles.com/network-access-required: "true"
podSelector: podSelector:
matchLabels: matchExpressions:
app.kubernetes.io/name: prometheus - key: app.kubernetes.io/name
operator: In
values:
- prometheus
podSelector:
matchLabels: {}
\ No newline at end of file
...@@ -12,13 +12,19 @@ spec: ...@@ -12,13 +12,19 @@ spec:
matchLabels: matchLabels:
redis.shivering-isles.com/network-access-required: "true" redis.shivering-isles.com/network-access-required: "true"
podSelector: podSelector:
matchLabels: matchExpressions:
app.kubernetes.io/name: redis-operator - key: app.kubernetes.io/name
operator: In
values:
- redis-operator
ports: ports:
- port: 26379 - port: 26379
protocol: TCP protocol: TCP
- port: 6379 - port: 6379
protocol: TCP protocol: TCP
podSelector: podSelector:
matchLabels: matchExpressions:
app.kubernetes.io/part-of: redis-failover - key: app.kubernetes.io/part-of
operator: In
values:
- redis-failover
...@@ -18,10 +18,16 @@ spec: ...@@ -18,10 +18,16 @@ spec:
port: 9000 port: 9000
- to: - to:
- podSelector: - podSelector:
matchLabels: matchExpressions:
application: spilo - key: application
operator: In
values:
- spilo
podSelector: podSelector:
matchLabels: matchExpressions:
application: spilo - key: application
operator: In
values:
- spilo
policyTypes: policyTypes:
- Egress - Egress
...@@ -10,8 +10,11 @@ spec: ...@@ -10,8 +10,11 @@ spec:
matchLabels: matchLabels:
kubernetes.io/metadata.name: kube-system kubernetes.io/metadata.name: kube-system
podSelector: podSelector:
matchLabels: matchExpressions:
k8s-app: kube-dns - key: k8s-app
operator: In
values:
- kube-dns
ports: ports:
- port: 53 - port: 53
protocol: UDP protocol: UDP
...@@ -19,3 +22,5 @@ spec: ...@@ -19,3 +22,5 @@ spec:
protocol: TCP protocol: TCP
policyTypes: policyTypes:
- Egress - Egress
podSelector:
matchLabels: {}
\ No newline at end of file
...@@ -18,12 +18,17 @@ spec: ...@@ -18,12 +18,17 @@ spec:
matchLabels: matchLabels:
kubernetes.io/metadata.name: kube-system kubernetes.io/metadata.name: kube-system
podSelector: podSelector:
matchLabels: matchExpressions:
k8s-app: kube-dns - key: k8s-app
operator: In
values:
- kube-dns
ports: ports:
- port: 53 - port: 53
protocol: UDP protocol: UDP
- port: 53 - port: 53
protocol: TCP protocol: TCP
podSelector:
matchLabels: {}
policyTypes: policyTypes:
- Egress - Egress
...@@ -10,8 +10,11 @@ spec: ...@@ -10,8 +10,11 @@ spec:
matchLabels: matchLabels:
kubernetes.io/metadata.name: nginx-system kubernetes.io/metadata.name: nginx-system
podSelector: podSelector:
matchLabels: matchExpressions:
app.kubernetes.io/name: haproxy - key: app.kubernetes.io/name
operator: In
values:
- haproxy
ports: ports:
- protocol: TCP - protocol: TCP
port: 80 port: 80
...@@ -36,12 +39,17 @@ spec: ...@@ -36,12 +39,17 @@ spec:
matchLabels: matchLabels:
kubernetes.io/metadata.name: kube-system kubernetes.io/metadata.name: kube-system
podSelector: podSelector:
matchLabels: matchExpressions:
k8s-app: kube-dns - key: k8s-app
operator: In
values:
- kube-dns
ports: ports:
- port: 53 - port: 53
protocol: UDP protocol: UDP
- port: 53 - port: 53
protocol: TCP protocol: TCP
podSelector:
matchLabels: {}
policyTypes: policyTypes:
- Egress - Egress
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment