Skip to content

FlexibleEngineCloud/terraform-flexibleengine-cce

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

98 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Flexible Engine CCE2 Cluster Terraform Module

Terraform module for deploying a CCEv2 cluster.

Module Version

Terraform format

module "cce2_cluster" {
    source = "FlexibleEngineCloud/cce/flexibleengine"
    version = "2.3.0"
 
    cluster_name  = "cluster-test"
    cluster_desc = " Cluster for testing purpose"

    cluster_flavor = "cce.s1.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"

    node_os      = "CentOS 7.5" // Can be "EulerOS 2.5" or "CentOS 7.5"
    node_runtime = "containerd // Valid values are docker and containerd"
    key_pair     = "my-key"

    annotations  = { "cluster.install.addons.external/install": "[{\"addonTemplateName\":\"icagent\"}]" }
 
    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             = []
      },
      {
        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 = {
          type = "extra-node"
        }
        vm_tags = {
          Owner = "Me"
          Env = "Prod"
        }
        postinstall_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
        scale_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"
          }
        ]
      }
    ]

}

Terragrunt format

################################
### Terragrunt Configuration ###
################################

terraform {
    source  = "FlexibleEngineCloud/cce/flexibleengine"
    version = "2.3.0"
}

include {
  path = find_in_parent_folders()
}

##################
### Parameters ###
##################

inputs = {
  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"
  node_runtime    = "containerd // Valid values are docker and containerd"
  key_pair        = "my-key"

  nodes_list = [
    {
      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
      tainst             = []
    },
    {
      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 = {
        type = "extra-node"
      }
      vm_tags = {
        Owner = "Me"
        Env = "Prod"
      }
      postinstall_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
      scale_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 >= 1.17

Inputs

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_type Cluster Type, possible values are VirtualMachine and BareMetal string VirtualMachine no
cluster_version Version of the cluster string n/a yes
container_network_type Network type of the container string overlay_l2 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
node_pool_list Nodes poool list of the CCE2 Cluster
list(object({
node_pool_index = string
node_pool_name = string
node_flavor = string
availability_zone = string
initial_node_count = number
scale_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
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
}))
[] no
nodes_list Nodes list of the CCE2 Cluster
list(object({
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
}))
[] 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 nodes IP adresses
nodes_list List of nodes
cce_certificate_clusters Cluster certificate data and keys
cce_certificate_users User certificate data and keys

About

Terraform module which creates CCE resources on Flexible Engine

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages