Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PLT-587-0.11.x: node interval support for libvirt and edge vsphere. #347

Merged
merged 5 commits into from
Sep 21, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 6 additions & 21 deletions docs/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,7 @@ terraform {

provider "spectrocloud" {
host = var.sc_host # Spectro Cloud endpoint (defaults to api.spectrocloud.com)
username = var.sc_username # Username of the user (or specify with SPECTROCLOUD_USERNAME env var)
password = var.sc_password # Password (or specify with SPECTROCLOUD_PASSWORD env var)
api_key = var.sc_api_key # API key (or specify with SPECTROCLOUD_APIKEY env var)
project_name = var.sc_project_name # Project name (e.g: Default)
}
```
Expand All @@ -57,7 +56,7 @@ sc_project_name = "{enter Spectro Cloud project Name}" #e.g: Default
```

->
Be sure to populate the `username`, `password`, and other terraform vars.
Be sure to populate the `sc_host`, `sc_api_key`, and other terraform vars.

Copy one of the resource configuration files (e.g: spectrocloud_cluster_profile) from the _Resources_ documentation. Be sure to specify
all required parameters.
Expand All @@ -75,28 +74,14 @@ For an end-to-end example of provisioning Spectro Cloud resources, visit:

Credentials and other configurations can be provided through environment variables. The following environment variables are availabe.

- `SPECTROCLOUD_HOST`
- `SPECTROCLOUD_USERNAME`
- `SPECTROCLOUD_PASSWORD`
- `SPECTROCLOUD_HOST`
- `SPECTROCLOUD_APIKEY`
- `SPECTROCLOUD_TRACE`
- `SPECTROCLOUD_RETRY_ATTEMPTS`


## Authentication
You can use the environment variables to authenticate with Spectro Cloud with your username and password.

-> **Note:** The API key takes precendence over the username and password authentication flow.

```shell
export SPECTROCLOUD_USERNAME=myUserName
export SPECTROCLOUD_PASSWORD=myPassword
```
```hcl
provider "spectrocloud" {}
```

Alternatively, you may use an API key to authenticate with Spectro Cloud. Visit the User Management API Key [documentation](https://docs.spectrocloud.com/user-management/user-authentication/#usingapikey) to learn more about Spectro Cloud API keys.
You can use an API key to authenticate with Spectro Cloud. Visit the User Management API Key [documentation](https://docs.spectrocloud.com/user-management/user-authentication/#usingapikey) to learn more about Spectro Cloud API keys.
```shell
export SPECTROCLOUD_APIKEY=5b7aad.........
```
Expand All @@ -117,8 +102,8 @@ provider GitHub [discussion board](https://github.com/spectrocloud/terraform-pro
- `api_key` (String, Sensitive) The Spectro Cloud API key. Can also be set with the `SPECTROCLOUD_API_KEY` environment variable.
- `host` (String) The Spectro Cloud API host url. Can also be set with the `SPECTROCLOUD_HOST` environment variable. Defaults to https://api.spectrocloud.com
- `ignore_insecure_tls_error` (Boolean) Ignore insecure TLS errors for Spectro Cloud API endpoints. Defaults to false.
- `password` (String, Sensitive) The Spectro Cloud user password. Can also be set with the `SPECTROCLOUD_PASSWORD` environment variable.
- `password` (String, Sensitive, Deprecated) The Spectro Cloud user password. Can also be set with the `SPECTROCLOUD_PASSWORD` environment variable.
- `project_name` (String) The Spectro Cloud project name.
- `retry_attempts` (Number) Number of retry attempts. Can also be set with the `SPECTROCLOUD_RETRY_ATTEMPTS` environment variable. Defaults to 10.
- `trace` (Boolean) Enable HTTP request tracing. Can also be set with the `SPECTROCLOUD_TRACE` environment variable. To enable Terraform debug logging, set `TF_LOG=DEBUG`. Visit the Terraform documentation to learn more about Terraform [debugging](https://developer.hashicorp.com/terraform/plugin/log/managing).
- `username` (String) The Spectro Cloud username. Can also be set with the `SPECTROCLOUD_USERNAME` environment variable.
- `username` (String, Deprecated) The Spectro Cloud username. Can also be set with the `SPECTROCLOUD_USERNAME` environment variable.
3 changes: 3 additions & 0 deletions docs/resources/cluster_aws.md
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,10 @@ Optional:
- `control_plane` (Boolean)
- `control_plane_as_worker` (Boolean)
- `disk_size_gb` (Number)
- `max` (Number) Maximum number of nodes in the machine pool. This is used for autoscaling the machine pool.
- `max_price` (String)
- `min` (Number) Minimum number of nodes in the machine pool. This is used for autoscaling the machine pool.
- `node_repave_interval` (Number) Minimum number of seconds node should be Ready, before the next node is selected for repave. Default value is `0`, Applicable only for worker pools.
- `taints` (Block List) (see [below for nested schema](#nestedblock--machine_pool--taints))
- `update_strategy` (String)

Expand Down
1 change: 1 addition & 0 deletions docs/resources/cluster_azure.md
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,7 @@ Optional:
- `control_plane` (Boolean)
- `control_plane_as_worker` (Boolean)
- `disk` (Block List, Max: 1) (see [below for nested schema](#nestedblock--machine_pool--disk))
- `node_repave_interval` (Number) Minimum number of seconds node should be Ready, before the next node is selected for repave. Default value is `0`, Applicable only for worker pools.
- `os_type` (String)
- `taints` (Block List) (see [below for nested schema](#nestedblock--machine_pool--taints))
- `update_strategy` (String)
Expand Down
1 change: 1 addition & 0 deletions docs/resources/cluster_gcp.md
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,7 @@ Optional:
- `control_plane` (Boolean)
- `control_plane_as_worker` (Boolean)
- `disk_size_gb` (Number)
- `node_repave_interval` (Number) Minimum number of seconds node should be Ready, before the next node is selected for repave. Default value is `0`, Applicable only for worker pools.
- `taints` (Block List) (see [below for nested schema](#nestedblock--machine_pool--taints))
- `update_strategy` (String)

Expand Down
5 changes: 4 additions & 1 deletion docs/resources/cluster_maas.md
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ Required:
Required:

- `azs` (Set of String)
- `count` (Number)
- `count` (Number) Number of nodes in the machine pool.
- `instance_type` (Block List, Min: 1, Max: 1) (see [below for nested schema](#nestedblock--machine_pool--instance_type))
- `name` (String)
- `placement` (Block List, Min: 1) (see [below for nested schema](#nestedblock--machine_pool--placement))
Expand All @@ -147,6 +147,9 @@ Optional:
- `additional_labels` (Map of String)
- `control_plane` (Boolean)
- `control_plane_as_worker` (Boolean)
- `max` (Number) Maximum number of nodes in the machine pool. This is used for autoscaling the machine pool.
- `min` (Number) Minimum number of nodes in the machine pool. This is used for autoscaling the machine pool.
- `node_repave_interval` (Number) Minimum number of seconds node should be Ready, before the next node is selected for repave. Default value is `0`, Applicable only for worker pools.
- `taints` (Block List) (see [below for nested schema](#nestedblock--machine_pool--taints))
- `update_strategy` (String)

Expand Down
1 change: 1 addition & 0 deletions docs/resources/cluster_openstack.md
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,7 @@ Optional:
- `azs` (Set of String)
- `control_plane` (Boolean)
- `control_plane_as_worker` (Boolean)
- `node_repave_interval` (Number) Minimum number of seconds node should be Ready, before the next node is selected for repave. Default value is `0`, Applicable only for worker pools.
- `subnet_id` (String)
- `taints` (Block List) (see [below for nested schema](#nestedblock--machine_pool--taints))
- `update_strategy` (String)
Expand Down
69 changes: 68 additions & 1 deletion docs/resources/cluster_vsphere.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,73 @@ description: |-




## Example Usage

```terraform
data "spectrocloud_cluster_profile" "vmware_profile" {
name = "vsphere-picard-2"
version = "1.0.0"
context = "tenant"
}
data "spectrocloud_cloudaccount_vsphere" "vmware_account" {
name = var.shared_vmware_cloud_account_name
}


resource "spectrocloud_cluster_vsphere" "cluster" {
name = "vsphere-picard-3"
cloud_account_id = data.spectrocloud_cloudaccount_vsphere.vmware_account.id
cluster_profile {
id = data.spectrocloud_cluster_profile.vmware_profile.id
}
cloud_config {
ssh_key = var.cluster_ssh_public_key

datacenter = var.vsphere_datacenter
folder = var.vsphere_folder
// For Dynamic DNS (network_type & network_search_domain value should set for DDNS)
network_type = "DDNS"
network_search_domain = var.cluster_network_search
// For Static (By Default static_ip is false, for static provisioning, it is set to be true. Not required to specify network_type & network_search_domain)
# static_ip = true
}

machine_pool {
control_plane = true
control_plane_as_worker = true
name = "master-pool"
count = 1
placement {
cluster = var.vsphere_cluster
resource_pool = var.vsphere_resource_pool
datastore = var.vsphere_datastore
network = var.vsphere_network
}
instance_type {
disk_size_gb = 40
memory_mb = 4096
cpu = 2
}
}

machine_pool {
name = "worker-basic"
count = 1
node_repave_interval = 30
placement {
cluster = var.vsphere_cluster
resource_pool = var.vsphere_resource_pool
datastore = var.vsphere_datastore
network = var.vsphere_network
}
instance_type {
disk_size_gb = 40
memory_mb = 8192
cpu = 4
}
}
}
```

<!-- schema generated by tfplugindocs -->
## Schema
Expand Down Expand Up @@ -79,6 +145,7 @@ Optional:
- `additional_labels` (Map of String)
- `control_plane` (Boolean)
- `control_plane_as_worker` (Boolean)
- `node_repave_interval` (Number) Minimum number of seconds node should be Ready, before the next node is selected for repave. Default value is `0`, Applicable only for worker pools.
- `taints` (Block List) (see [below for nested schema](#nestedblock--machine_pool--taints))
- `update_strategy` (String)

Expand Down
3 changes: 1 addition & 2 deletions examples/provider/provider.tf
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ terraform {

provider "spectrocloud" {
host = var.sc_host # Spectro Cloud endpoint (defaults to api.spectrocloud.com)
username = var.sc_username # Username of the user (or specify with SPECTROCLOUD_USERNAME env var)
password = var.sc_password # Password (or specify with SPECTROCLOUD_PASSWORD env var)
api_key = var.sc_api_key # API key (or specify with SPECTROCLOUD_APIKEY env var)
project_name = var.sc_project_name # Project name (e.g: Default)
}
63 changes: 63 additions & 0 deletions examples/resources/spectrocloud_cluster_vsphere/resource.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
data "spectrocloud_cluster_profile" "vmware_profile" {
name = "vsphere-picard-2"
version = "1.0.0"
context = "tenant"
}
data "spectrocloud_cloudaccount_vsphere" "vmware_account" {
name = var.shared_vmware_cloud_account_name
}


resource "spectrocloud_cluster_vsphere" "cluster" {
name = "vsphere-picard-3"
cloud_account_id = data.spectrocloud_cloudaccount_vsphere.vmware_account.id
cluster_profile {
id = data.spectrocloud_cluster_profile.vmware_profile.id
}
cloud_config {
ssh_key = var.cluster_ssh_public_key

datacenter = var.vsphere_datacenter
folder = var.vsphere_folder
// For Dynamic DNS (network_type & network_search_domain value should set for DDNS)
network_type = "DDNS"
network_search_domain = var.cluster_network_search
// For Static (By Default static_ip is false, for static provisioning, it is set to be true. Not required to specify network_type & network_search_domain)
# static_ip = true
}

machine_pool {
control_plane = true
control_plane_as_worker = true
name = "master-pool"
count = 1
placement {
cluster = var.vsphere_cluster
resource_pool = var.vsphere_resource_pool
datastore = var.vsphere_datastore
network = var.vsphere_network
}
instance_type {
disk_size_gb = 40
memory_mb = 4096
cpu = 2
}
}

machine_pool {
name = "worker-basic"
count = 1
node_repave_interval = 30
placement {
cluster = var.vsphere_cluster
resource_pool = var.vsphere_resource_pool
datastore = var.vsphere_datastore
network = var.vsphere_network
}
instance_type {
disk_size_gb = 40
memory_mb = 8192
cpu = 4
}
}
}
59 changes: 31 additions & 28 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -5,26 +5,29 @@ go 1.18
require (
github.com/go-openapi/runtime v0.19.28
github.com/go-openapi/strfmt v0.20.1
github.com/google/go-cmp v0.5.9
github.com/hashicorp/go-cty v1.4.1-0.20200414143053-d3edf31b6320
github.com/hashicorp/terraform-plugin-docs v0.13.0
github.com/hashicorp/terraform-plugin-sdk/v2 v2.24.1
github.com/hashicorp/terraform-plugin-sdk/v2 v2.29.0
github.com/pkg/errors v0.9.1
github.com/robfig/cron v1.2.0
github.com/spectrocloud/hapi v1.14.1-0.20230904110035-ed2b1df599dc
github.com/spectrocloud/hapi v1.14.1-0.20230915073348-759e2eb74641
github.com/stretchr/testify v1.7.2
)

require (
github.com/Masterminds/goutils v1.1.1 // indirect
github.com/Masterminds/semver/v3 v3.1.1 // indirect
github.com/Masterminds/sprig/v3 v3.2.2 // indirect
github.com/ProtonMail/go-crypto v0.0.0-20230717121422-5aa5874ade95 // indirect
github.com/PuerkitoBio/purell v1.1.1 // indirect
github.com/PuerkitoBio/urlesc v0.0.0-20170810143723-de5bf2ad4578 // indirect
github.com/agext/levenshtein v1.2.2 // indirect
github.com/apparentlymart/go-textseg/v13 v13.0.0 // indirect
github.com/apparentlymart/go-textseg/v15 v15.0.0 // indirect
github.com/armon/go-radix v1.0.0 // indirect
github.com/asaskevich/govalidator v0.0.0-20200907205600-7a23bdc65eef // indirect
github.com/bgentry/speakeasy v0.1.0 // indirect
github.com/cloudflare/circl v1.3.3 // indirect
github.com/davecgh/go-spew v1.1.1 // indirect
github.com/fatih/color v1.13.0 // indirect
github.com/go-errors/errors v1.4.0 // indirect
Expand All @@ -37,35 +40,34 @@ require (
github.com/go-openapi/swag v0.19.14 // indirect
github.com/go-openapi/validate v0.20.2 // indirect
github.com/go-stack/stack v1.8.0 // indirect
github.com/golang/protobuf v1.5.2 // indirect
github.com/google/go-cmp v0.5.9 // indirect
github.com/golang/protobuf v1.5.3 // indirect
github.com/google/uuid v1.3.0 // indirect
github.com/hashicorp/errwrap v1.1.0 // indirect
github.com/hashicorp/go-checkpoint v0.5.0 // indirect
github.com/hashicorp/go-cleanhttp v0.5.2 // indirect
github.com/hashicorp/go-hclog v1.2.1 // indirect
github.com/hashicorp/go-hclog v1.5.0 // indirect
github.com/hashicorp/go-multierror v1.1.1 // indirect
github.com/hashicorp/go-plugin v1.4.6 // indirect
github.com/hashicorp/go-plugin v1.5.1 // indirect
github.com/hashicorp/go-uuid v1.0.3 // indirect
github.com/hashicorp/go-version v1.6.0 // indirect
github.com/hashicorp/hc-install v0.4.0 // indirect
github.com/hashicorp/hcl/v2 v2.15.0 // indirect
github.com/hashicorp/hc-install v0.6.0 // indirect
github.com/hashicorp/hcl/v2 v2.18.0 // indirect
github.com/hashicorp/logutils v1.0.0 // indirect
github.com/hashicorp/terraform-exec v0.17.3 // indirect
github.com/hashicorp/terraform-json v0.14.0 // indirect
github.com/hashicorp/terraform-plugin-go v0.14.1 // indirect
github.com/hashicorp/terraform-plugin-log v0.7.0 // indirect
github.com/hashicorp/terraform-registry-address v0.0.0-20220623143253-7d51757b572c // indirect
github.com/hashicorp/terraform-svchost v0.0.0-20200729002733-f050f53b9734 // indirect
github.com/hashicorp/terraform-exec v0.19.0 // indirect
github.com/hashicorp/terraform-json v0.17.1 // indirect
github.com/hashicorp/terraform-plugin-go v0.19.0 // indirect
github.com/hashicorp/terraform-plugin-log v0.9.0 // indirect
github.com/hashicorp/terraform-registry-address v0.2.2 // indirect
github.com/hashicorp/terraform-svchost v0.1.1 // indirect
github.com/hashicorp/yamux v0.0.0-20181012175058-2f1d1f20f75d // indirect
github.com/huandu/xstrings v1.3.2 // indirect
github.com/imdario/mergo v0.3.13 // indirect
github.com/imdario/mergo v0.3.15 // indirect
github.com/josharian/intern v1.0.0 // indirect
github.com/konsorten/go-windows-terminal-sequences v1.0.3 // indirect
github.com/mailru/easyjson v0.7.6 // indirect
github.com/mattn/go-colorable v0.1.12 // indirect
github.com/mattn/go-isatty v0.0.14 // indirect
github.com/mitchellh/cli v1.1.4 // indirect
github.com/mitchellh/cli v1.1.5 // indirect
github.com/mitchellh/copystructure v1.2.0 // indirect
github.com/mitchellh/go-testing-interface v1.14.1 // indirect
github.com/mitchellh/go-wordwrap v1.0.0 // indirect
Expand All @@ -82,18 +84,19 @@ require (
github.com/spectrocloud/gomi v1.14.1-0.20230412095143-b0595c6c6f08 // indirect
github.com/spf13/cast v1.5.0 // indirect
github.com/vmihailenco/msgpack v4.0.4+incompatible // indirect
github.com/vmihailenco/msgpack/v4 v4.3.12 // indirect
github.com/vmihailenco/tagparser v0.1.1 // indirect
github.com/zclconf/go-cty v1.12.1 // indirect
github.com/vmihailenco/msgpack/v5 v5.3.5 // indirect
github.com/vmihailenco/tagparser/v2 v2.0.0 // indirect
github.com/zclconf/go-cty v1.14.0 // indirect
go.mongodb.org/mongo-driver v1.5.1 // indirect
golang.org/x/crypto v0.5.0 // indirect
golang.org/x/net v0.5.0 // indirect
golang.org/x/sys v0.4.0 // indirect
golang.org/x/text v0.6.0 // indirect
google.golang.org/appengine v1.6.6 // indirect
google.golang.org/genproto v0.0.0-20200711021454-869866162049 // indirect
google.golang.org/grpc v1.50.1 // indirect
google.golang.org/protobuf v1.28.1 // indirect
golang.org/x/crypto v0.13.0 // indirect
golang.org/x/mod v0.12.0 // indirect
golang.org/x/net v0.13.0 // indirect
golang.org/x/sys v0.12.0 // indirect
golang.org/x/text v0.13.0 // indirect
google.golang.org/appengine v1.6.7 // indirect
google.golang.org/genproto/googleapis/rpc v0.0.0-20230525234030-28d5490b6b19 // indirect
google.golang.org/grpc v1.57.0 // indirect
google.golang.org/protobuf v1.31.0 // indirect
gopkg.in/yaml.v2 v2.4.0 // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect
)
Expand Down
Loading