From fdea39efb0d1e6fa969dcb1230d7f9290fac7dad Mon Sep 17 00:00:00 2001 From: Paritosh Paliwal Date: Tue, 9 Jan 2024 11:40:37 +0530 Subject: [PATCH] [Quick Fix] Updates to Dashboard Import Module (#62) * dashboard imports is optional --- .gitignore | 3 +++ terraform/oke/inputs.tf | 8 +++++++- terraform/oke/main.tf | 19 ++++++++++--------- terraform/oke/schema.yaml | 19 ++++++++++++++----- 4 files changed, 34 insertions(+), 15 deletions(-) diff --git a/.gitignore b/.gitignore index 9096408b..958b220a 100644 --- a/.gitignore +++ b/.gitignore @@ -64,3 +64,6 @@ charts/**/charts/ # zip artifacts releases/ + +# vscode +.vscode \ No newline at end of file diff --git a/terraform/oke/inputs.tf b/terraform/oke/inputs.tf index 5cd9f0c2..64bd2968 100644 --- a/terraform/oke/inputs.tf +++ b/terraform/oke/inputs.tf @@ -68,7 +68,7 @@ variable "boat_tenancy_ocid" { } #### -## Dynamic Group and Policies +## Optional Inputs #### # Option to create Dynamic Group and Policies @@ -77,6 +77,12 @@ variable "opt_create_dynamicGroup_and_policies" { default = false } +# Option to import dashboards +variable "opt_import_dashboards" { + type = bool + default = true +} + #### ## OKE Cluster Information #### diff --git a/terraform/oke/main.tf b/terraform/oke/main.tf index 46a2e6e9..fb757b62 100644 --- a/terraform/oke/main.tf +++ b/terraform/oke/main.tf @@ -14,7 +14,7 @@ locals { ## Module dependencies should be included here as well so a module does not run when it's depenedent moudle is disabled module_controls_enable_livelab_module = alltrue([var.toggle_livelab_module, var.livelab_switch]) - module_controls_enable_dashboards_module = alltrue([var.toggle_dashboards_module]) + module_controls_enable_dashboards_module = alltrue([var.toggle_dashboards_module, var.opt_import_dashboards]) module_controls_enable_iam_module = alltrue([var.toggle_iam_module, var.opt_create_dynamicGroup_and_policies, !var.livelab_switch]) module_controls_enable_logan_module = alltrue([var.toggle_logan_module]) module_controls_enable_mgmt_agent_module = alltrue([var.toggle_mgmt_agent_module]) @@ -36,14 +36,6 @@ module "livelab" { } */ } -// Import Kubernetes Dashboards -module "import_kubernetes_dashbords" { - source = "./modules/dashboards" - compartment_ocid = var.oci_onm_compartment_ocid - - count = local.module_controls_enable_dashboards_module ? 1 : 0 -} - // Create Required Polcies and Dynamic Group // Needs to be called with OCI Home Region Provider module "policy_and_dynamic-group" { @@ -103,3 +95,12 @@ module "helm_release" { count = local.module_controls_enable_helm_module ? 1 : 0 } + +// Import Kubernetes Dashboards +module "import_kubernetes_dashbords" { + source = "./modules/dashboards" + compartment_ocid = var.oci_onm_compartment_ocid + + count = local.module_controls_enable_dashboards_module ? 1 : 0 + depends_on = [ module.helm_release ] +} \ No newline at end of file diff --git a/terraform/oke/schema.yaml b/terraform/oke/schema.yaml index 62db0e6b..90ae17ca 100644 --- a/terraform/oke/schema.yaml +++ b/terraform/oke/schema.yaml @@ -45,7 +45,7 @@ variableGroups: - stack_deployment_option visible: false - - title: Select an OKE cluster deployed in this region to start monitoring. + - title: Select an OKE cluster deployed in this region to start monitoring description: "Use CLI (Helm) if your cluster does not have a public API endpoint or if it's restricted from accessing container-registry.oracle.com. See: https://github.com/oracle-quickstart/oci-kubernetes-monitoring" variables: - oke_compartment_ocid @@ -61,9 +61,10 @@ variableGroups: - oci_la_logGroup_name - fluentd_baseDir_path - - title: OCI IAM Policies and Dynamic Groups (Optional) + - title: Advanced Configuration variables: - opt_create_dynamicGroup_and_policies + - opt_import_dashboards variables: @@ -189,14 +190,22 @@ variables: - livelab_switch #### - ## Pre-requisites + ## Optional Inputs #### # Option to create Dynamic Group and Policies opt_create_dynamicGroup_and_policies: type: boolean - title: Select this check box to create dynamic groups and policies that are required for deploying the monitoring solution. + title: Select this check box to create OCI IAM dynamic groups and policies which are required for the monitoring solution #description: "Ref: https://github.com/oracle-quickstart/oci-kubernetes-monitoring#pre-requisites" description: "Note: If node pools and the OKE cluster are in different compartments, then the dynamic group definition must be updated." default: false - required: true \ No newline at end of file + required: true + + # Option to create Dynamic Group and Policies + opt_import_dashboards: + type: boolean + title: Select this check box to import dashboards + description: "Note: You may need to manually clean up the dashboards when you destory the stack as dashboards will not be deleted automatically." + default: true + required: true