Skip to content

Commit a489f51

Browse files
committed
Substituted OKE module so that the cluster is instantiated with OKE images instead of Platform images
1 parent ec71891 commit a489f51

File tree

4 files changed

+89
-23
lines changed

4 files changed

+89
-23
lines changed

deploy/devops/tf-env/data.tf

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,3 +20,11 @@ data "oci_identity_compartment" "compartment" {
2020
data "oci_identity_users" "users" {
2121
compartment_id = var.tenancy_ocid
2222
}
23+
24+
data "oci_containerengine_cluster_option" "oke" {
25+
cluster_option_id = "all"
26+
}
27+
28+
data "oci_containerengine_cluster_kube_config" "kubeconfig" {
29+
cluster_id = module.oke.cluster_id
30+
}

deploy/devops/tf-env/oke.tf

Lines changed: 64 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,71 @@
1-
module "oke-quickstart" {
2-
source = "github.com/oracle-quickstart/terraform-oci-oke-quickstart?ref=0.9.2"
3-
1+
locals {
2+
cluster_k8s_latest_version = reverse(sort(data.oci_containerengine_cluster_option.oke.kubernetes_versions))[0]
3+
}
44

5-
providers = {
6-
oci = oci
7-
oci.home_region = oci.home_region
5+
module "oke" {
6+
source = "oracle-terraform-modules/oke/oci"
7+
version = "5.1.3"
8+
region = var.region
9+
compartment_id = var.compartment_ocid
10+
# IAM - Policies
11+
create_iam_autoscaler_policy = "never"
12+
create_iam_kms_policy = "never"
13+
create_iam_operator_policy = "never"
14+
create_iam_worker_policy = "never"
15+
# Network module - VCN
16+
assign_dns = true
17+
create_vcn = true
18+
vcn_cidrs = ["10.22.0.0/16"]
19+
vcn_dns_label = "oke-${random_string.deploy_id.result}"
20+
vcn_name = "oke-${random_string.deploy_id.result}-vcn"
21+
lockdown_default_seclist = true
22+
allow_rules_public_lb ={
23+
"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"},
24+
"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"}
25+
}
26+
# Network module - security
27+
allow_node_port_access = true
28+
allow_worker_internet_access = true
29+
allow_worker_ssh_access = true
30+
control_plane_allowed_cidrs = ["0.0.0.0/0"]
31+
control_plane_is_public = true
32+
enable_waf = false
33+
load_balancers = "public"
34+
preferred_load_balancer = "public"
35+
worker_is_public = false
36+
# Cluster module
37+
create_cluster = true
38+
cluster_name = "oke-${random_string.deploy_id.result}"
39+
cluster_type = "basic"
40+
cni_type = "flannel"
41+
kubernetes_version = local.cluster_k8s_latest_version
42+
pods_cidr = "10.244.0.0/16"
43+
services_cidr = "10.96.0.0/16"
44+
use_signed_images = false
45+
use_defined_tags = false
46+
# Workers
47+
worker_pool_mode = "node-pool"
48+
worker_pool_size = 2
49+
worker_image_type = "oke"
50+
worker_pools = {
51+
np1 = {
52+
shape = "VM.Standard.E3.Flex",
53+
ocpus = 1,
54+
memory = 32,
55+
boot_volume_size = 120,
56+
create = true
57+
}
858
}
959

10-
tenancy_ocid = var.tenancy_ocid
11-
compartment_ocid = var.compartment_ocid
12-
region = var.region
13-
14-
app_name = "DevOps ${random_string.deploy_id.result}"
60+
# Bastion
61+
create_bastion = false
1562

16-
metrics_server_enabled = false
63+
# Operator
64+
create_operator = false
1765

18-
# OKE Node Pool 1
19-
node_pool_cni_type_1 = "FLANNEL_OVERLAY"
20-
node_pool_autoscaler_enabled_1 = false
21-
node_pool_initial_num_worker_nodes_1 = 2
22-
node_pool_max_num_worker_nodes_1 = 3
23-
node_pool_instance_shape_1 = { "instanceShape" = "VM.Standard.E4.Flex", "ocpus" = 1, "memory" = 32 }
24-
node_pool_boot_volume_size_in_gbs_1 = 120
66+
providers = {
67+
oci = oci
68+
oci.home = oci.home_region
69+
}
2570

26-
# VCN for OKE arguments
27-
vcn_cidr_blocks = "10.22.0.0/16"
2871
}

deploy/devops/tf-env/output.tf

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,12 @@ output "devops_ons_topic_ocid" {
33
}
44

55
output "kubeconfig" {
6-
value = module.oke-quickstart.kubeconfig
6+
value = data.oci_containerengine_cluster_kube_config.kubeconfig.content
77
sensitive = true
88
}
99

1010
output "oke_cluster_ocid" {
11-
value = module.oke-quickstart.oke_cluster_ocid
11+
value = module.oke.cluster_id
1212
}
1313

1414
output "github_access_token_secret_ocid" {

deploy/devops/tf-env/provider.tf

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
# TODO: To be modified before pushing to main
2+
3+
14
provider "oci" {
25
tenancy_ocid = var.tenancy_ocid
36
region = var.region
@@ -8,3 +11,15 @@ provider "oci" {
811
tenancy_ocid = var.tenancy_ocid
912
region = lookup(data.oci_identity_regions.home_region.regions[0], "name")
1013
}
14+
15+
16+
/*provider "oci" {
17+
config_file_profile = var.config_file_profile
18+
region = var.region
19+
}
20+
21+
provider "oci" {
22+
alias = "home_region"
23+
config_file_profile = var.config_file_profile
24+
region = lookup(data.oci_identity_regions.home_region.regions[0], "name")
25+
}*/

0 commit comments

Comments
 (0)