Skip to content

Commit bace9fb

Browse files
authored
fix: fixed empty policy issue and added oke-tags to freeform_tags in terraform.tfvars.example (#477)
Signed-off-by: Nikhil Kota <srinivasa.nikhil.kota@oracle.com>
1 parent caffd2e commit bace9fb

File tree

9 files changed

+38
-13
lines changed

9 files changed

+38
-13
lines changed

docs/configuration.adoc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -261,7 +261,7 @@ OKE Variables:-
261261
----
262262
use_encryption = true
263263
kms_key_id = <kms_key_id>
264-
enable_pv_encryption_in_transit = false
264+
use_node_pool_volume_encryption = true
265265
node_pool_volume_kms_key_id = <node_pool_volume_kms_key_id>
266266
----
267267

docs/instructions.adoc

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -74,11 +74,12 @@ If you wish to use {uri-oci-kms}[OCI KMS] to encrypt Kubernetes secrets, the fol
7474
* link:#adding-the-bastion-host[bastion must be enabled]
7575
* link:#enabling-instance_principal-on-the-operator-host[operator instance_principal must be enabled]
7676

77-
use_encryption must be set to _true_
78-
kms_key_id must be provided
77+
* use_encryption must be set to _true_
78+
* kms_key_id must be provided
7979

8080
If you wish to use {uri-oci-kms}[OCI KMS] to encrypt OKE nodepool boot/block volume, the following is required:
8181

82+
* use_node_pool_volume_encryption must be set to true
8283
* node_pool_volume_kms_key_id must be provided
8384

8485
If you wish to encrypt data in transit between the instance, the boot volume, and the block volumes in OKE node pool.

docs/terraformoptions.adoc

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -621,8 +621,8 @@ EOT
621621
|`ocid1.key.oc1....`
622622
|
623623

624-
|enable_pv_encryption_in_transit
625-
|Whether to encrypt data in transit between the instance, the boot volume, and the block volumes.
624+
|use_node_pool_volume_encryption
625+
|Whether to use {uri-oci-kms}[OCI KMS] to encrypt Kubernetes Nodepool's boot/block volume.
626626
|true/false
627627
|false
628628

@@ -631,6 +631,11 @@ EOT
631631
|`ocid1.key.oc1....`
632632
|
633633

634+
|enable_pv_encryption_in_transit
635+
|Whether to encrypt data in transit between the instance, the boot volume, and the block volumes.
636+
|true/false
637+
|false
638+
634639
|`use_signed_images`
635640
|Whether to enforce the use of signed images. If set to true, at least 1 RSA key must be provided through image_signing_keys.
636641
|true/false

main.tf

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -234,6 +234,7 @@ module "oke" {
234234
node_pool_os = var.node_pool_os
235235
node_pool_os_version = var.node_pool_os_version
236236
enable_pv_encryption_in_transit = var.enable_pv_encryption_in_transit
237+
use_node_pool_volume_encryption = var.use_node_pool_volume_encryption
237238
node_pool_volume_kms_key_id = var.node_pool_volume_kms_key_id
238239

239240
# oke load balancer parameters

modules/oke/iam.tf

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,4 +41,5 @@ resource "oci_identity_policy" "oke_volume_kms" {
4141
description = "Policies for block volumes to access kms key"
4242
name = var.label_prefix == "none" ? "oke-volume-kms" : "${var.label_prefix}-oke-volume-kms"
4343
statements = local.oke_volume_kms_policy_statements
44+
count = var.use_node_pool_volume_encryption == true ? 1 : 0
4445
}

modules/oke/locals.tf

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,10 +18,10 @@ locals {
1818
policy_statement = (var.use_encryption == true) ? "Allow dynamic-group ${oci_identity_dynamic_group.oke_kms_cluster[0].name} to use keys in compartment id ${var.compartment_id} where target.key.id = '${var.kms_key_id}'" : ""
1919

2020
# policy to allow block volumes inside oke to use kms
21-
oke_volume_kms_policy_statements = (var.node_pool_volume_kms_key_id == "") ? []: [
21+
oke_volume_kms_policy_statements = (var.use_node_pool_volume_encryption == true) ? [
2222
"Allow service oke to use key-delegates in compartment id ${var.compartment_id} where target.key.id = '${var.node_pool_volume_kms_key_id}'",
2323
"Allow service blockstorage to use keys in compartment id ${var.compartment_id} where target.key.id = '${var.node_pool_volume_kms_key_id}'"
24-
]
24+
]: []
2525

2626
# 1. get a list of available images for this cluster
2727
# 2. filter by version

modules/oke/variables.tf

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,12 +47,16 @@ variable "use_encryption" {
4747

4848
variable "kms_key_id" {}
4949

50-
variable "enable_pv_encryption_in_transit" {
50+
variable "use_node_pool_volume_encryption" {
5151
type = bool
5252
}
5353

5454
variable "node_pool_volume_kms_key_id" {}
5555

56+
variable "enable_pv_encryption_in_transit" {
57+
type = bool
58+
}
59+
5660
# signed images
5761
variable "use_signed_images" {
5862
type = bool

terraform.tfvars.example

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,7 @@ allow_node_port_access = false
130130
allow_worker_internet_access = true
131131
allow_worker_ssh_access = false
132132
cluster_name = "oke"
133-
control_plane_type = "private"
133+
control_plane_type = "private"
134134
control_plane_allowed_cidrs = ["0.0.0.0/0"]
135135
control_plane_nsgs = []
136136
dashboard_enabled = false
@@ -143,15 +143,16 @@ use_encryption = false
143143
kms_key_id = ""
144144

145145
### oke node pool volume kms integration
146-
enable_pv_encryption_in_transit = false
147-
node_pool_volume_kms_key_id = ""
146+
use_node_pool_volume_encryption = false
147+
node_pool_volume_kms_key_id = ""
148148

149149
## oke cluster container image policy and keys
150150
use_signed_images = false
151151
image_signing_keys = []
152152

153153
# node pools
154154
check_node_active = "all"
155+
enable_pv_encryption_in_transit = false
155156
node_pools = {
156157
np1 = { shape = "VM.Standard.E4.Flex", ocpus = 1, memory = 16, node_pool_size = 1, boot_volume_size = 150, label = { app = "frontend", pool = "np1" } }
157158
np2 = { shape = "VM.Standard.E4.Flex", ocpus = 1, memory = 16, node_pool_size = 1, boot_volume_size = 150, label = { app = "frontend", pool = "np2" } }
@@ -234,6 +235,12 @@ freeform_tags = {
234235
role = "operator",
235236
security = "high"
236237
}
238+
oke = {
239+
service_lb = {
240+
environment = "dev"
241+
role = "load balancer"
242+
}
243+
}
237244
}
238245

239246
# placeholder variable for debugging scripts. To be implemented in future

variables.tf

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -489,8 +489,8 @@ variable "kms_key_id" {
489489
type = string
490490
}
491491

492-
variable "enable_pv_encryption_in_transit" {
493-
description = "Whether to enable in-transit encryption for the data volume's paravirtualized attachment. This field applies to both block volumes and boot volumes. The default value is false"
492+
variable "use_node_pool_volume_encryption" {
493+
description = "Whether to use OCI KMS to encrypt Kubernetes Nodepool's boot/block volume."
494494
type = bool
495495
default = false
496496
}
@@ -526,6 +526,12 @@ variable "check_node_active" {
526526
}
527527
}
528528

529+
variable "enable_pv_encryption_in_transit" {
530+
description = "Whether to enable in-transit encryption for the data volume's paravirtualized attachment. This field applies to both block volumes and boot volumes. The default value is false"
531+
type = bool
532+
default = false
533+
}
534+
529535
variable "node_pools" {
530536
default = {
531537
np1 = { shape = "VM.Standard.E4.Flex", ocpus = 1, memory = 16, node_pool_size = 1, boot_volume_size = 150, label = { app = "frontend", pool = "np1" } }

0 commit comments

Comments
 (0)