Skip to content

Commit 57a714e

Browse files
authored
Merge pull request #1110 from vshn/fix/missing_netpol_cnpg
Add missing networkpolicy to CNPG
2 parents 9e87098 + 0ffe66d commit 57a714e

File tree

8 files changed

+154
-0
lines changed

8 files changed

+154
-0
lines changed

component/cnpg.jsonnet

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -239,6 +239,33 @@ local prometheusrule = std.prune(kube._Object('monitoring.coreos.com/v1', 'Prome
239239
},
240240
});
241241

242+
local netpol = std.prune(kube._Object('networking.k8s.io/v1', 'NetworkPolicy', 'allow-webhook-all-namespaces') {
243+
metadata+: {
244+
namespace: params.namespace,
245+
labels: labels,
246+
},
247+
spec+: {
248+
policyTypes: [
249+
'Ingress',
250+
],
251+
ingress: [
252+
{
253+
ports: [
254+
{
255+
port: 9443,
256+
protocol: 'TCP',
257+
},
258+
],
259+
},
260+
],
261+
podSelector: {
262+
matchLabels: {
263+
'app.kubernetes.io/name': 'cloudnative-pg',
264+
},
265+
},
266+
},
267+
});
268+
242269
{
243270
'00_namespace': namespace {
244271
metadata+: {
@@ -247,4 +274,5 @@ local prometheusrule = std.prune(kube._Object('monitoring.coreos.com/v1', 'Prome
247274
},
248275
},
249276
'10_cnpg_prometheusrule': prometheusrule,
277+
'11_networkpolicy': netpol,
250278
}
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
apiVersion: networking.k8s.io/v1
2+
kind: NetworkPolicy
3+
metadata:
4+
labels:
5+
app.kubernetes.io/managed-by: commodore
6+
app.kubernetes.io/name: cnpg
7+
name: allow-webhook-all-namespaces
8+
namespace: syn-cnpg-system
9+
spec:
10+
ingress:
11+
- ports:
12+
- port: 9443
13+
protocol: TCP
14+
podSelector:
15+
matchLabels:
16+
app.kubernetes.io/name: cloudnative-pg
17+
policyTypes:
18+
- Ingress
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
apiVersion: networking.k8s.io/v1
2+
kind: NetworkPolicy
3+
metadata:
4+
labels:
5+
app.kubernetes.io/managed-by: commodore
6+
app.kubernetes.io/name: cnpg
7+
name: allow-webhook-all-namespaces
8+
namespace: syn-cnpg-system
9+
spec:
10+
ingress:
11+
- ports:
12+
- port: 9443
13+
protocol: TCP
14+
podSelector:
15+
matchLabels:
16+
app.kubernetes.io/name: cloudnative-pg
17+
policyTypes:
18+
- Ingress
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
apiVersion: networking.k8s.io/v1
2+
kind: NetworkPolicy
3+
metadata:
4+
labels:
5+
app.kubernetes.io/managed-by: commodore
6+
app.kubernetes.io/name: cnpg
7+
name: allow-webhook-all-namespaces
8+
namespace: syn-cnpg-system
9+
spec:
10+
ingress:
11+
- ports:
12+
- port: 9443
13+
protocol: TCP
14+
podSelector:
15+
matchLabels:
16+
app.kubernetes.io/name: cloudnative-pg
17+
policyTypes:
18+
- Ingress
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
apiVersion: networking.k8s.io/v1
2+
kind: NetworkPolicy
3+
metadata:
4+
labels:
5+
app.kubernetes.io/managed-by: commodore
6+
app.kubernetes.io/name: cnpg
7+
name: allow-webhook-all-namespaces
8+
namespace: syn-cnpg-system
9+
spec:
10+
ingress:
11+
- ports:
12+
- port: 9443
13+
protocol: TCP
14+
podSelector:
15+
matchLabels:
16+
app.kubernetes.io/name: cloudnative-pg
17+
policyTypes:
18+
- Ingress
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
apiVersion: networking.k8s.io/v1
2+
kind: NetworkPolicy
3+
metadata:
4+
labels:
5+
app.kubernetes.io/managed-by: commodore
6+
app.kubernetes.io/name: cnpg
7+
name: allow-webhook-all-namespaces
8+
namespace: syn-cnpg-system
9+
spec:
10+
ingress:
11+
- ports:
12+
- port: 9443
13+
protocol: TCP
14+
podSelector:
15+
matchLabels:
16+
app.kubernetes.io/name: cloudnative-pg
17+
policyTypes:
18+
- Ingress
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
apiVersion: networking.k8s.io/v1
2+
kind: NetworkPolicy
3+
metadata:
4+
labels:
5+
app.kubernetes.io/managed-by: commodore
6+
app.kubernetes.io/name: cnpg
7+
name: allow-webhook-all-namespaces
8+
namespace: syn-cnpg-system
9+
spec:
10+
ingress:
11+
- ports:
12+
- port: 9443
13+
protocol: TCP
14+
podSelector:
15+
matchLabels:
16+
app.kubernetes.io/name: cloudnative-pg
17+
policyTypes:
18+
- Ingress
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
apiVersion: networking.k8s.io/v1
2+
kind: NetworkPolicy
3+
metadata:
4+
labels:
5+
app.kubernetes.io/managed-by: commodore
6+
app.kubernetes.io/name: cnpg
7+
name: allow-webhook-all-namespaces
8+
namespace: syn-cnpg-system
9+
spec:
10+
ingress:
11+
- ports:
12+
- port: 9443
13+
protocol: TCP
14+
podSelector:
15+
matchLabels:
16+
app.kubernetes.io/name: cloudnative-pg
17+
policyTypes:
18+
- Ingress

0 commit comments

Comments
 (0)