Skip to content

Commit

Permalink
Add documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
osaluden committed Dec 23, 2020
1 parent 54172c4 commit 273f8c0
Show file tree
Hide file tree
Showing 3 changed files with 186 additions and 87 deletions.
258 changes: 179 additions & 79 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand All @@ -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"
}
]
}
]
}
```

Expand All @@ -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 {
Expand All @@ -108,81 +145,144 @@ 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

| Name | Description | Type | Default | Required |
|------|-------------|------|---------|:--------:|
| 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 | <pre>list(object({<br> node_name = string<br> node_flavor = string<br> availability_zone = string<br> root_volume_size = number<br> root_volume_type = string<br> data_volume_size = number<br> data_volume_type = string<br> node_labels = map(string)<br> vm_tags = map(string)<br> postinstall_script= string<br> preinstall_script = string<br> }))</pre> | `[]` | no |
| node\_pool\_list | Nodes poool list of the CCE2 Cluster | <pre>list(object({<br> node_pool_index = string<br> node_pool_name = string<br> node_flavor = string<br> availability_zone = string<br> initial_node_count = number<br> scall_enable = bool<br> min_node_count = number<br> max_node_count = number<br> scale_down_cooldown_time = number<br> priority = number<br> root_volume_size = number<br> root_volume_type = string<br> data_volume_size = number<br> data_volume_type = string<br> node_labels = map(string)<br> taints = list(object({<br> key = string<br> value = string<br> effect = string<br> }))<br> postinstall_script = string<br> preinstall_script = string<br> }))</pre> | `[]` | no |
| nodes\_list | Nodes list of the CCE2 Cluster | <pre>list(object({<br> node_index = string<br> node_name = string<br> node_flavor = string<br> availability_zone = string<br> root_volume_size = number<br> root_volume_type = string<br> data_volume_size = number<br> data_volume_type = string<br> node_labels = map(string)<br> vm_tags = map(string)<br> taints = list(object({<br> key = string<br> value = string<br> effect = string<br> }))<br> postinstall_script = string<br> preinstall_script = string<br> }))</pre> | `[]` | no |
| vpc\_id | ID of the VPC | `string` | n/a | yes |

## Outputs

| 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 |
12 changes: 6 additions & 6 deletions main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
3 changes: 1 addition & 2 deletions outputs.tf
Original file line number Diff line number Diff line change
Expand Up @@ -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]
}

0 comments on commit 273f8c0

Please sign in to comment.