1
+ ---
2
+ apiVersion : template.openshift.io/v1
3
+ kind : Template
4
+ labels :
5
+ template : ${GROUP_NAME}-network-security-policy
6
+ metadata :
7
+ name : ${GROUP_NAME}-network-security-policy
8
+ objects :
9
+ - kind : NetworkPolicy
10
+ apiVersion : networking.k8s.io/v1
11
+ metadata :
12
+ name : ${GROUP_NAME}-deny-by-default
13
+ labels :
14
+ app : ${GROUP_NAME}
15
+ spec :
16
+ # The default posture for a security first namespace is to
17
+ # deny all traffic. If not added this rule will be added
18
+ # by Platform Services during environment cut-over.
19
+ podSelector : {}
20
+ ingress : []
21
+ - apiVersion : networking.k8s.io/v1
22
+ kind : NetworkPolicy
23
+ metadata :
24
+ name : ${GROUP_NAME}-allow-from-openshift-ingress
25
+ labels :
26
+ app : ${GROUP_NAME}
27
+ spec :
28
+ # This policy allows any pod with a route & service combination
29
+ # to accept traffic from the OpenShift router pods. This is
30
+ # required for things outside of OpenShift (like the Internet)
31
+ # to reach your pods.
32
+ ingress :
33
+ - from :
34
+ - namespaceSelector :
35
+ matchLabels :
36
+ network.openshift.io/policy-group : ingress
37
+ podSelector : {}
38
+ policyTypes :
39
+ - Ingress
40
+ - apiVersion : networking.k8s.io/v1
41
+ kind : NetworkPolicy
42
+ metadata :
43
+ name : ${GROUP_NAME}-allow-services-to-database
44
+ labels :
45
+ app : ${GROUP_NAME}
46
+ spec :
47
+ # Allow services to connect to the database
48
+ podSelector :
49
+ matchLabels :
50
+ role : database
51
+ ingress :
52
+ - from :
53
+ - podSelector :
54
+ matchLabels :
55
+ role : api
56
+ - podSelector :
57
+ matchLabels :
58
+ role : backup
59
+ - podSelector :
60
+ matchLabels :
61
+ role : metabase
62
+ ports :
63
+ - protocol : TCP
64
+ port : 27017
65
+ - apiVersion : networking.k8s.io/v1
66
+ kind : NetworkPolicy
67
+ metadata :
68
+ name : ${GROUP_NAME}-allow-frontend-to-api
69
+ labels :
70
+ app : ${GROUP_NAME}
71
+ spec :
72
+ # Allow frontends to connect to API
73
+ podSelector :
74
+ matchLabels :
75
+ role : api
76
+ ingress :
77
+ - from :
78
+ - podSelector :
79
+ matchLabels :
80
+ role : frontend
81
+ ports :
82
+ - protocol : TCP
83
+ port : 3000
84
+ - apiVersion : networking.k8s.io/v1
85
+ kind : NetworkPolicy
86
+ metadata :
87
+ name : ${GROUP_NAME}-allow-proxy-to-frontend
88
+ labels :
89
+ app : ${GROUP_NAME}
90
+ spec :
91
+ # Allow proxy to connect to the frontend
92
+ podSelector :
93
+ matchLabels :
94
+ role : frontend
95
+ ingress :
96
+ - from :
97
+ - podSelector :
98
+ matchLabels :
99
+ role : proxy
100
+ ports :
101
+ - protocol : TCP
102
+ port : 4000 # e-guides port
103
+ parameters :
104
+ - description : A name used to group objects together to identify related objects for a set of deployments
105
+ displayName : Group name
106
+ name : GROUP_NAME
107
+ required : true
108
+ value : nrpti
0 commit comments