Skip to content

Commit

Permalink
Merge pull request #8 from FlexibleEngineCloud/osa_extendparam
Browse files Browse the repository at this point in the history
Osa extendparam
  • Loading branch information
osaluden authored Jan 28, 2021
2 parents a114153 + 974e72b commit 23050ed
Show file tree
Hide file tree
Showing 9 changed files with 88 additions and 46 deletions.
4 changes: 3 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ module "cce2_cluster" {
cluster_name = "cluster-test"
cluster_desc = " Cluster for testing purpose"
availability_zone = "eu-west-0a"
cluster_flavor = "cce.s1.small"
vpc_id = "<VPC_ID>"
Expand Down Expand Up @@ -264,6 +263,8 @@ inputs = {

## Inputs

## Inputs

| Name | Description | Type | Default | Required |
|------|-------------|------|---------|:--------:|
| availability\_zone | Availability Zone used to deploy | `string` | `"eu-west-0a"` | no |
Expand All @@ -272,6 +273,7 @@ inputs = {
| 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 |
| extend\_param | Extended Parameters | `map(string)` | `{}` | no |
| 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 |
Expand Down
12 changes: 12 additions & 0 deletions examples/ha-cluster/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# CCE Cluster in HA mode with Multi AZs MAsters


# Usage

Fill the parameters in the main.tf and provider.tf files, and run the Terraform commands:

```bash
$ terraform init
$ terraform plan
$ terraform apply
```
37 changes: 37 additions & 0 deletions examples/ha-cluster/main.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
module "cce2_cluster" {
source = "FlexibleEngineCloud/cce/flexibleengine"
version = "2.3.1"

cluster_name = "cluster-test"
cluster_desc = " Cluster for testing purpose"

cluster_flavor = "cce.s2.small"
vpc_id = "<VPC_ID>"
network_id = "<NETWORK_ID>" //Caution here, you have to use NETWORK_ID even if argument is "subnet_id". Will be fixed soon
cluster_version = "v1.15.6-r1"
extend_param = {
clusterAZ = "multi_az"
}


node_os = "CentOS 7.5" // Can be "EulerOS 2.5" or "CentOS 7.5"
key_pair = "<SSH_KEY_NAME>"

nodes_list = [
{
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
taints = []
}
]
}
4 changes: 4 additions & 0 deletions examples/ha-cluster/provider.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
provider "flexibleengine" {
auth_url = "https://iam.eu-west-0.prod-cloud-ocb.orange-business.com/v3"
region = "eu-west-0"
}
8 changes: 8 additions & 0 deletions examples/ha-cluster/versions.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
terraform {
required_providers {
flexibleengine = {
source = "FlexibleEngineCloud/flexibleengine"
}
}
required_version = ">= 0.13"
}
11 changes: 11 additions & 0 deletions examples/postinstall-script/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# CCE Cluster with Post Install Script provide to a Node

# Usage

Fill the parameters in the main.tf and provider.tf files, and run the Terraform commands:

```bash
$ terraform init
$ terraform plan
$ terraform apply
```
10 changes: 6 additions & 4 deletions examples/postinstall-script/main.tf
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
module "cce2_cluster" {
source = "FlexibleEngineCloud/cce/flexibleengine"
version = "2.2.0"
version = "2.3.1"

cluster_name = "cluster-test"
cluster_desc = " Cluster for testing purpose"
Expand All @@ -16,17 +16,19 @@ module "cce2_cluster" {

nodes_list = [
{
node_name = "new-node1"
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 = null # this paramters si to be set empty for an existing node
vm_tags = null # this parameters can added to an existing node
node_labels = {}
vm_tags = {}
postinstall_script = data.template_file.test.rendered
preinstall_script = null
taints = []
}
]
}
42 changes: 1 addition & 41 deletions main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ resource "flexibleengine_cce_cluster_v3" "cce_cluster" {
container_network_type = "overlay_l2"
eip = var.cluster_eip
description = var.cluster_desc
extend_param = var.extend_param
}

locals {
Expand Down Expand Up @@ -62,47 +63,6 @@ resource "flexibleengine_cce_node_v3" "cce_cluster_node" {
}
}

# resource "flexibleengine_cce_node_v3" "cce_cluster_node" {
# count = length(var.nodes_list)
# cluster_id = flexibleengine_cce_cluster_v3.cce_cluster.id
# name = var.nodes_list[count.index]["node_name"]
# flavor_id = var.nodes_list[count.index]["node_flavor"]
# os = var.node_os
# availability_zone = var.nodes_list[count.index]["availability_zone"]
# key_pair = var.key_pair
# postinstall = var.nodes_list[count.index]["postinstall_script"]
# preinstall = var.nodes_list[count.index]["preinstall_script"]

# labels = var.nodes_list[count.index]["node_labels"]
# tags = var.nodes_list[count.index]["vm_tags"]

# root_volume {
# size = var.nodes_list[count.index]["root_volume_size"]
# volumetype = var.nodes_list[count.index]["root_volume_type"]
# }

# data_volumes {
# size = var.nodes_list[count.index]["data_volume_size"]
# volumetype = var.nodes_list[count.index]["data_volume_type"]
# }

# dynamic "taints" {
# for_each = var.nodes_list[count.index]["taints"]
# content {
# key = taints.value.key
# value = taints.value.value
# effect = taints.value.effect
# }
# }

# lifecycle {
# create_before_destroy = true
# ignore_changes = [annotations, labels]
# }
# }



resource "flexibleengine_cce_node_pool_v3" "cce_node_pool" {
for_each = local.node_pool_list_map

Expand Down
6 changes: 6 additions & 0 deletions variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,12 @@ variable "key_pair" {
type = string
}

variable "extend_param" {
description = "Extended Parameters"
type = map(string)
default = {}
}

variable "nodes_list" {
description = "Nodes list of the CCE2 Cluster"
default = []
Expand Down

0 comments on commit 23050ed

Please sign in to comment.