diff --git a/README.md b/README.md index 6ef3510..e6bf003 100644 --- a/README.md +++ b/README.md @@ -2,42 +2,18 @@ Terraform module for deploying a CCEv2 cluster. -## TF version : 0.13 - ## Module Version -> **Important Notes regarding new module version (as of v2.1.0)** - -> **Note #1** -> -> Two additionnal parameters: -> - `vm_tags`: Tag at Flexible Engine level -> - `node_label`: Kubernetes Node Label (to apply a Pod placement constraint with the NodeSelector setting in Kubernetes manifest for instance) -> -> These two parameters are mandatory but can be empty with this module -> -> Please add these two parameters to each of the node in the `nodes_list` parameters as shown bellow. -> -> Add `vm_tags` does not recreate the node -> -> Add `node_labels` recreate the node so even if the current nodes does not have any labels, please do not forget to add `node_labels` set it empty like the bellow example. - -> **Note #2** -> -> CCE Node SSH Key pair is now a global parameter (was a specific node configuratin parameter before) -> -> Please comment out the `key_pair` parameters of the existing nodes and declare `key_pair` parameter as a global as shown in the examples bellow. - -> **Important Note regarding new module version (as of v2.2.0)** - -> Now you need to add two parameters on the node configuration `postinstall_script` and `preinstall_script`. If you don't use this parameters, set the value to null as the example below. +- v2.3.0: please read carrefuly the release note https://github.com/FlexibleEngineCloud/terraform-flexibleengine-cce/releases/tag/v2.3.0 +- v2.2.0: please read carrefuly the release note https://github.com/FlexibleEngineCloud/terraform-flexibleengine-cce/releases/tag/v2.2.0 +- v2.1.0: please read carrefuly the release note https://github.com/FlexibleEngineCloud/terraform-flexibleengine-cce/releases/tag/v2.1.0 ## Terraform format ```hcl module "cce2_cluster" { source = "FlexibleEngineCloud/cce/flexibleengine" - version = "2.2.0" + version = "2.3.0" cluster_name = "cluster-test" cluster_desc = " Cluster for testing purpose" @@ -53,38 +29,99 @@ module "cce2_cluster" { nodes_list = [ { - node_name = "existing-node1" - node_flavor = "s3.large.2" - availability_zone = "eu-west-0a" - # key_pair = "my-key" # Key pair parameter moved to global parameter - root_volume_type = "SATA" - root_volume_size = 40 - data_volume_type = "SATA" - data_volume_size = 100 - node_labels = {} # this paramters si to be set empty for an existing node - vm_tags = {} # this parameters can added to an existing node + node_index = "node0" + node_name = "cce-node1" + node_flavor = "s3.large.2" + availability_zone = "eu-west-0a" + root_volume_type = "SATA" + root_volume_size = 40 + data_volume_type = "SATA" + data_volume_size = 100 + node_labels = {} + vm_tags = {} postinstall_script = null - preinstall_script = null + preinstall_script = null + taints = [] }, { - node_name = "new-node2" - node_flavor = "s3.large.2" + node_index = "node1" + node_name = "cce-node2" + node_flavor = "s3.large.2" availability_zone = "eu-west-0b" - root_volume_type = "SATA" - root_volume_size = 40 - data_volume_type = "SATA" - data_volume_size = 100 - node_labels = { + root_volume_type = "SATA" + root_volume_size = 40 + data_volume_type = "SATA" + data_volume_size = 100 + node_labels = { type = "extra-node" } - vm_tags = { + vm_tags = { Owner = "Me" Env = "Prod" } postinstall_script = null - preinstall_script = null + preinstall_script = null + taints = [ + { + key = "key1" + value = "value1" + effect = "NoSchedule" + }, + { + key = "key1" + value = "value1" + effect = "NoExecute" + }, + { + key = "key2" + value = "value2" + effect = "NoSchedule" + } + ] } ] + + node_pool_list = [ + { + node_pool_index = "nodepool0" + node_pool_name = "cce-nodepool-test" + node_flavor = "s3.large.2" + availability_zone = null + initial_node_count = 1 + scall_enable = true + min_node_count = 1 + max_node_count = 3 + scale_down_cooldown_time = null + priority = null + root_volume_type = "SATA" + root_volume_size = 40 + data_volume_type = "SATA" + data_volume_size = 100 + node_labels = { + taints = "test-taint" + } + preinstall_script = null + postinstall_script = null + taints = [ + { + key = "key1" + value = "value1" + effect = "NoSchedule" + }, + { + key = "key1" + value = "value1" + effect = "NoExecute" + }, + { + key = "key2" + value = "value2" + effect = "NoSchedule" + } + ] + } + ] + } ``` @@ -95,8 +132,8 @@ module "cce2_cluster" { ################################ terraform { - source = "FlexibleEngineCloud/cce/flexibleengine" - version = "2.1.0" + source = "FlexibleEngineCloud/cce/flexibleengine" + version = "2.3.0" } include { @@ -108,61 +145,122 @@ include { ################## inputs = { - cluster_name = "cluster-test" - cluster_desc = "Cluster for testing purpose" - cluster_flavor = "cce.s1.small" + cluster_name = "cluster-test" + cluster_desc = "Cluster for testing purpose" + cluster_flavor = "cce.s1.small" cluster_version = "v1.15.6-r1" - node_os = "CentOS 7.5" // Can be "EulerOS 2.5" or "CentOS 7.5" - key_pair = "my-key" + node_os = "CentOS 7.5" // Can be "EulerOS 2.5" or "CentOS 7.5" + key_pair = "my-key" nodes_list = [ { - node_name = "existing-node-1" - node_flavor = "s3.xlarge.2" - availability_zone = "eu-west-0a" - # key_pair = "my-key" # Key pair parameter moved to global parameter - root_volume_type = "SATA" - root_volume_size = 40 - data_volume_type = "SATA" - data_volume_size = 100 - node_labels = {} # this paramters si to be set empty for an existing node - vm_tags = {} # this parameters can added to an existing node + node_index = "node0" + node_name = "existing-node-1" + node_flavor = "s3.xlarge.2" + availability_zone = "eu-west-0a" + root_volume_type = "SATA" + root_volume_size = 40 + data_volume_type = "SATA" + data_volume_size = 100 + node_labels = {} + vm_tags = {} postinstall_script = null - preinstall_script = null + preinstall_script = null + tainst = [] }, { - node_name = "new-node-2" - node_flavor = "s3.xlarge.2" + node_index = "node1" + node_name = "cce-node-2" + node_flavor = "s3.xlarge.2" availability_zone = "eu-west-0a" - root_volume_type = "SATA" - root_volume_size = 40 - data_volume_type = "SATA" - data_volume_size = 100 - node_labels = { + root_volume_type = "SATA" + root_volume_size = 40 + data_volume_type = "SATA" + data_volume_size = 100 + node_labels = { type = "extra-node" } - vm_tags = { + vm_tags = { Owner = "Me" Env = "Prod" } postinstall_script = null - preinstall_script = null + preinstall_script = null + taints = [ + { + key = "key1" + value = "value1" + effect = "NoSchedule" + }, + { + key = "key1" + value = "value1" + effect = "NoExecute" + }, + { + key = "key2" + value = "value2" + effect = "NoSchedule" + } + ] + } + ] + + node_pool_list = [ + { + node_pool_index = "nodepool0" + node_pool_name = "cce-nodepool-test" + node_flavor = "s3.large.2" + availability_zone = null + initial_node_count = 1 + scall_enable = true + min_node_count = 1 + max_node_count = 3 + scale_down_cooldown_time = null + priority = null + root_volume_type = "SATA" + root_volume_size = 40 + data_volume_type = "SATA" + data_volume_size = 100 + node_labels = { + taints = "test-taint" + } + preinstall_script = null + postinstall_script = null + taints = [ + { + key = "key1" + value = "value1" + effect = "NoSchedule" + }, + { + key = "key1" + value = "value1" + effect = "NoExecute" + }, + { + key = "key2" + value = "value2" + effect = "NoSchedule" + } + ] } ] + } ``` - ## Requirements | Name | Version | |------|---------| | terraform | >= 0.13 | +| flexibleengine | >= 1.17 | ## Providers | Name | Version | |------|---------| -| flexibleengine | n/a | +| flexibleengine | >= 1.17 | ## Inputs @@ -170,13 +268,15 @@ inputs = { |------|-------------|------|---------|:--------:| | availability\_zone | Availability Zone used to deploy | `string` | `"eu-west-0a"` | no | | cluster\_desc | Description of the cluster | `string` | n/a | yes | +| cluster\_eip | EIP of the cluster | `string` | `null` | no | | cluster\_flavor | Flavor of the CCE2 Cluster | `string` | n/a | yes | | cluster\_name | Name of the cluster | `string` | n/a | yes | | cluster\_version | Version of the cluster | `string` | n/a | yes | | key\_pair | Name of the SSH key pair | `string` | n/a | yes | | network\_id | ID of the Network | `string` | n/a | yes | | node\_os | Operating System of the CCE Worker Node | `string` | n/a | yes | -| nodes\_list | Nodes list of the CCE2 Cluster |
list(object({| `[]` | no | +| node\_pool\_list | Nodes poool list of the CCE2 Cluster |
node_name = string
node_flavor = string
availability_zone = string
root_volume_size = number
root_volume_type = string
data_volume_size = number
data_volume_type = string
node_labels = map(string)
vm_tags = map(string)
postinstall_script= string
preinstall_script = string
}))
list(object({| `[]` | no | +| nodes\_list | Nodes list of the CCE2 Cluster |
node_pool_index = string
node_pool_name = string
node_flavor = string
availability_zone = string
initial_node_count = number
scall_enable = bool
min_node_count = number
max_node_count = number
scale_down_cooldown_time = number
priority = number
root_volume_size = number
root_volume_type = string
data_volume_size = number
data_volume_type = string
node_labels = map(string)
taints = list(object({
key = string
value = string
effect = string
}))
postinstall_script = string
preinstall_script = string
}))
list(object({| `[]` | no | | vpc\_id | ID of the VPC | `string` | n/a | yes | ## Outputs @@ -184,5 +284,5 @@ inputs = { | Name | Description | |------|-------------| | cluster\_id | ID of the Cluster created | -| nodes\_ip | List of IP nodes | +| nodes\_ip | List of nodes IP adresses | | nodes\_list | List of nodes | diff --git a/main.tf b/main.tf index 91a9680..db9a46b 100644 --- a/main.tf +++ b/main.tf @@ -23,16 +23,16 @@ locals { resource "flexibleengine_cce_node_v3" "cce_cluster_node" { for_each = local.nodes_list_map - cluster_id = flexibleengine_cce_cluster_v3.cce_cluster.id - name = each.value.node_name - flavor_id = each.value.node_flavor - os = var.node_os + cluster_id = flexibleengine_cce_cluster_v3.cce_cluster.id + name = each.value.node_name + flavor_id = each.value.node_flavor + os = var.node_os availability_zone = each.value.availability_zone key_pair = var.key_pair - postinstall = each.value.postinstall_script - preinstall = each.value.preinstall_script + postinstall = each.value.postinstall_script + preinstall = each.value.preinstall_script labels = each.value.node_labels tags = each.value.vm_tags diff --git a/outputs.tf b/outputs.tf index 8a73875..758bc7b 100644 --- a/outputs.tf +++ b/outputs.tf @@ -5,12 +5,11 @@ output "cluster_id" { output "nodes_list" { description = "List of nodes" - # value = flexibleengine_cce_node_v3.cce_cluster_node.* value = [for node in flexibleengine_cce_node_v3.cce_cluster_node : node] } output "nodes_ip" { - description = "List of nodes IP" + description = "List of nodes IP addresses" value = [for node in flexibleengine_cce_node_v3.cce_cluster_node : node.private_ip] }
node_index = string
node_name = string
node_flavor = string
availability_zone = string
root_volume_size = number
root_volume_type = string
data_volume_size = number
data_volume_type = string
node_labels = map(string)
vm_tags = map(string)
taints = list(object({
key = string
value = string
effect = string
}))
postinstall_script = string
preinstall_script = string
}))