-
Notifications
You must be signed in to change notification settings - Fork 218
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: separated all templates from locals into a new file templates. (#…
…394) Added a new variable debug_mode that we can turn on to debug scripts. Only create the namespace if the value is not default. Signed-off-by: Ali Mukadam <[email protected]>
- Loading branch information
Showing
8 changed files
with
125 additions
and
104 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,103 @@ | ||
# Copyright 2017, 2021 Oracle Corporation and/or affiliates. All rights reserved. | ||
# Licensed under the Universal Permissive License v 1.0 as shown at https://oss.oracle.com/licenses/upl | ||
|
||
locals { | ||
# scripting templates | ||
|
||
check_active_worker_template = templatefile("${path.module}/scripts/check_worker_active.template.sh", | ||
{ | ||
check_node_active = var.check_node_active | ||
total_nodes = local.total_nodes | ||
} | ||
) | ||
|
||
create_service_account_template = templatefile("${path.module}/scripts/create_service_account.template.sh", | ||
{ | ||
service_account_name = var.service_account_name | ||
service_account_namespace = var.service_account_namespace | ||
service_account_cluster_role_binding = local.service_account_cluster_role_binding_name | ||
} | ||
) | ||
|
||
drain_template = templatefile("${path.module}/scripts/drain.template.sh", {}) | ||
|
||
drain_list_template = templatefile("${path.module}/scripts/drainlist.py", | ||
{ | ||
cluster_id = var.cluster_id | ||
compartment_id = var.compartment_id | ||
region = var.region | ||
pools_to_drain = var.label_prefix == "none" ? trim(join(",", formatlist("'%s'", var.node_pools_to_drain)), "'") : trim(join(",", formatlist("'%s-%s'", var.label_prefix, var.node_pools_to_drain)), "'") | ||
} | ||
) | ||
|
||
generate_kubeconfig_template = templatefile("${path.module}/scripts/generate_kubeconfig.template.sh", | ||
{ | ||
cluster-id = var.cluster_id | ||
region = var.region | ||
} | ||
) | ||
|
||
install_calico_template = templatefile("${path.module}/scripts/install_calico.template.sh", | ||
{ | ||
calico_version = var.calico_version | ||
number_of_nodes = local.total_nodes | ||
pod_cidr = var.pods_cidr | ||
number_of_replicas = min(20, max((local.total_nodes) / 200, 3)) | ||
} | ||
) | ||
|
||
install_helm_template = templatefile("${path.module}/scripts/install_helm.template.sh", {}) | ||
|
||
install_kubectl_template = templatefile("${path.module}/scripts/install_kubectl.template.sh", | ||
{ | ||
ol = var.operator_os_version | ||
} | ||
) | ||
|
||
metric_server_template = templatefile("${path.module}/scripts/install_metricserver.template.sh", | ||
{ | ||
enable_vpa = var.enable_vpa | ||
vpa_version = var.vpa_version | ||
} | ||
) | ||
|
||
secret_template = templatefile("${path.module}/scripts/secret.sh", | ||
{ | ||
compartment_id = var.compartment_id | ||
region = var.region | ||
|
||
email_address = var.email_address | ||
region_registry = var.ocir_urls[var.region] | ||
secret_id = var.secret_id | ||
secret_name = var.secret_name | ||
secret_namespace = var.secret_namespace | ||
tenancy_namespace = data.oci_objectstorage_namespace.object_storage_namespace.namespace | ||
username = var.username | ||
} | ||
) | ||
|
||
set_credentials_template = templatefile("${path.module}/scripts/kubeconfig_set_credentials.template.sh", | ||
{ | ||
cluster-id = var.cluster_id | ||
cluster-id-11 = substr(var.cluster_id, (length(var.cluster_id) - 11), length(var.cluster_id)) | ||
region = var.region | ||
} | ||
) | ||
|
||
token_helper_template = templatefile("${path.module}/scripts/token_helper.template.sh", | ||
{ | ||
cluster-id = var.cluster_id | ||
region = var.region | ||
} | ||
) | ||
|
||
update_dynamic_group_template = templatefile("${path.module}/scripts/update_dynamic_group.template.sh", | ||
{ | ||
dynamic_group_id = var.use_encryption == true ? var.kms_dynamic_group_id : "null" | ||
dynamic_group_rule = local.dynamic_group_rule_this_cluster | ||
home_region = data.oci_identity_regions.home_region.regions[0].name | ||
} | ||
) | ||
|
||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -214,4 +214,6 @@ freeform_tags = { | |
role = "operator", | ||
security = "high" | ||
} | ||
} | ||
} | ||
|
||
debug_mode = false |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters