@@ -20,6 +20,8 @@ locals {
2020
2121 workers_subnet = cidrsubnet (local. vcn_cidr , lookup (var. subnets [" workers" ], " newbits" ), lookup (var. subnets [" workers" ], " netnum" ))
2222
23+ pods_subnet = cidrsubnet (local. vcn_cidr , lookup (var. subnets [" pods" ], " newbits" ), lookup (var. subnets [" pods" ], " netnum" ))
24+
2325 fss_subnet = cidrsubnet (local. vcn_cidr , lookup (var. subnets [" fss" ], " newbits" ), lookup (var. subnets [" fss" ], " netnum" ))
2426
2527 anywhere = " 0.0.0.0/0"
@@ -91,15 +93,15 @@ locals {
9193 destination = local.osn,
9294 destination_type = " SERVICE_CIDR_BLOCK" ,
9395 protocol = local.tcp_protocol,
94- port = 443 ,
96+ port = - 1 ,
9597 stateless = false
9698 },
9799 {
98- description = " Allow all TCP traffic from control plane to worker nodes" ,
100+ description = " Allow Kubernetes Control plane to communicate with worker nodes" ,
99101 destination = local.workers_subnet,
100102 destination_type = " CIDR_BLOCK" ,
101103 protocol = local.tcp_protocol,
102- port = - 1 ,
104+ port = 10250 ,
103105 stateless = false
104106 },
105107 {
@@ -149,17 +151,9 @@ locals {
149151
150152 # workers
151153 workers_egress = [
152- {
153- description = " Allow egress for all traffic to allow pods to communicate between each other on different worker nodes on the worker subnet" ,
154- destination = local.workers_subnet,
155- destination_type = " CIDR_BLOCK" ,
156- protocol = local.all_protocols,
157- port = - 1 ,
158- stateless = false
159- },
160154 {
161155 description = " Allow ICMP traffic for path discovery" ,
162- destination = local.workers_subnet
156+ destination = local.anywhere
163157 destination_type = " CIDR_BLOCK" ,
164158 protocol = local.icmp_protocol,
165159 port = - 1 ,
@@ -203,7 +197,7 @@ locals {
203197 {
204198 description = " Allow control plane to communicate with worker nodes" ,
205199 protocol = local.tcp_protocol,
206- port = - 1 ,
200+ port = 10250 ,
207201 source = local.cp_subnet,
208202 source_type = " CIDR_BLOCK" ,
209203 stateless = false
@@ -219,6 +213,60 @@ locals {
219213 }
220214 ]
221215
216+ pods_egress = [
217+ {
218+ description = " Allow pods to communicate with other pods." ,
219+ destination = local.pods_subnet,
220+ destination_type = " CIDR_BLOCK" ,
221+ protocol = local.all_protocols,
222+ port = - 1 ,
223+ stateless = false
224+ },
225+ {
226+ description = " Allow ICMP traffic for path discovery" ,
227+ destination = local.osn,
228+ destination_type = " SERVICE_CIDR_BLOCK" ,
229+ protocol = local.icmp_protocol,
230+ port = - 1 ,
231+ stateless = false
232+ },
233+ {
234+ description = " Allow pods to communicate with OCI Services" ,
235+ destination = local.osn,
236+ destination_type = " SERVICE_CIDR_BLOCK" ,
237+ protocol = local.tcp_protocol,
238+ port = - 1 ,
239+ stateless = false
240+ },
241+ ]
242+
243+ pods_ingress = [
244+ {
245+ description = " Allow worker nodes to access pods." ,
246+ protocol = local.all_protocols,
247+ port = - 1 ,
248+ source = local.cp_subnet,
249+ source_type = " CIDR_BLOCK" ,
250+ stateless = false
251+ },
252+ {
253+ description = " Allow Kubernetes Control Plane to communicate with pods." ,
254+ protocol = local.all_protocols,
255+ port = - 1 ,
256+ source = local.workers_subnet,
257+ source_type = " CIDR_BLOCK" ,
258+ stateless = false
259+ },
260+ {
261+ description = " Allow pods to communicate with each other." ,
262+ protocol = local.all_protocols,
263+ port = - 1 ,
264+ source = local.pods_subnet,
265+ source_type = " CIDR_BLOCK" ,
266+ stateless = false
267+ },
268+ ]
269+
222270 int_lb_egress = [
223271 {
224272 description = " Allow stateful egress to workers. Required for NodePorts" ,
@@ -247,7 +295,7 @@ locals {
247295 ]
248296
249297 # Combine supplied allow list and the public load balancer subnet
250- internal_lb_allowed_cidrs = var. load_balancers == " both" ? concat (var. internal_lb_allowed_cidrs , tolist ([local . pub_lb_subnet ])) : var. internal_lb_allowed_cidrs
298+ internal_lb_allowed_cidrs = var. load_balancers == " both" ? concat (var. internal_lb_allowed_cidrs , tolist ([local . pub_lb_subnet ])) : var. internal_lb_allowed_cidrs
251299
252300 # Create a Cartesian product of allowed cidrs and ports
253301 internal_lb_allowed_cidrs_and_ports = setproduct (local. internal_lb_allowed_cidrs , var. internal_lb_allowed_ports )
0 commit comments