Skip to content

Commit 0e01835

Browse files
committed
Fix missing LB rule
1 parent a8b3c54 commit 0e01835

File tree

1 file changed

+56
-16
lines changed

1 file changed

+56
-16
lines changed

deploy/devops/tf-env/oke.tf

Lines changed: 56 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,55 @@
11
locals {
22
cluster_k8s_latest_version = reverse(sort(data.oci_containerengine_cluster_option.oke.kubernetes_versions))[0]
3+
lb_subnet_cidr = "10.22.128.0/27"
4+
workers_subnet_cidr = "10.22.144.0/20"
5+
cp_subnet_cidr = "10.22.0.8/29"
6+
vcn_cidr = "10.22.0.0/16"
7+
}
8+
9+
resource "oci_core_vcn" "oke_vcn" {
10+
compartment_id = var.compartment_ocid
11+
cidr_blocks = [local.vcn_cidr]
12+
display_name = "oke-${random_string.deploy_id.result}-vcn"
13+
dns_label = "oke"
14+
}
15+
16+
resource "oci_core_security_list" "pub_lb_sl" {
17+
compartment_id = var.compartment_ocid
18+
vcn_id = oci_core_vcn.oke_vcn.id
19+
ingress_security_rules {
20+
protocol = "6"
21+
source = "0.0.0.0/0"
22+
source_type = "CIDR_BLOCK"
23+
description = "Allow HTTP for all load balancers"
24+
tcp_options {
25+
destination_port_range {
26+
max = 80
27+
min = 80
28+
}
29+
}
30+
}
31+
egress_security_rules {
32+
destination = local.workers_subnet_cidr
33+
protocol = "6"
34+
destination_type = "CIDR_BLOCK"
35+
description = "Allow OCI load balancer or network load balancer to communicate with kube-proxy on worker nodes."
36+
tcp_options {
37+
destination_port_range {
38+
max = 10256
39+
min = 10256
40+
}
41+
}
42+
}
43+
}
44+
45+
resource "oci_core_subnet" "pub_lb_subnet" {
46+
cidr_block = local.lb_subnet_cidr
47+
compartment_id = var.compartment_ocid
48+
vcn_id = oci_core_vcn.oke_vcn.id
49+
prohibit_public_ip_on_vnic = false
50+
dns_label = "plb"
51+
display_name = "pub_lb"
52+
security_list_ids = [oci_core_security_list.pub_lb_sl.id]
353
}
454

555
module "oke" {
@@ -22,15 +72,14 @@ module "oke" {
2272
}
2373
cp = {
2474
create = "always",
25-
cidr = "10.22.0.8/29"
75+
cidr = local.cp_subnet_cidr
2676
}
2777
pub_lb = {
28-
create = "always",
29-
cidr = "10.22.128.0/27"
78+
create = "never"
3079
}
3180
workers = {
3281
create = "always",
33-
cidr = "10.22.144.0/20"
82+
cidr = local.workers_subnet_cidr
3483
}
3584
int_lb = {
3685
create = "never"
@@ -44,21 +93,12 @@ module "oke" {
4493
operator = { create = "never" }
4594
cp = { create = "always"}
4695
int_lb = { create = "never" }
47-
pub_lb = { create = "always" }
96+
pub_lb = { create = "never" }
4897
workers = { create = "always"}
4998
pods = { create = "never" }
5099
}
51-
assign_dns = true
52-
create_vcn = true
53-
vcn_cidrs = ["10.22.0.0/16"]
54-
vcn_dns_label = "oke"
55-
vcn_name = "oke-${random_string.deploy_id.result}-vcn"
56-
lockdown_default_seclist = true
57-
allow_rules_public_lb ={
58-
"Allow TCP ingress to public load balancers for SSL traffic from anywhere" : { protocol = 6, port = 443, source="0.0.0.0/0", source_type="CIDR_BLOCK"},
59-
"Allow TCP ingress to public load balancers for HTTP traffic from anywhere" : { protocol = 6, port = 80, source="0.0.0.0/0", source_type="CIDR_BLOCK"},
60-
"Allow TCP egress from public load balancers to worker nodes for health checks" : {protocol = 6, port=-1, source = "10.22.144.0/20", source_type="CIDR_BLOCK"}
61-
}
100+
create_vcn = false
101+
vcn_id = oci_core_vcn.oke_vcn.id
62102
# Network module - security
63103
allow_node_port_access = true
64104
allow_worker_internet_access = true

0 commit comments

Comments
 (0)