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

Add HA support to digitalocean_kubernetes_cluster #718

Merged
merged 5 commits into from Oct 7, 2021
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
5 changes: 5 additions & 0 deletions digitalocean/datasource_digitalocean_kubernetes_cluster.go
Expand Up @@ -43,6 +43,11 @@ func dataSourceDigitalOceanKubernetesCluster() *schema.Resource {
Computed: true,
},

"ha": {
Type: schema.TypeBool,
Computed: true,
},

"vpc_uuid": {
Type: schema.TypeString,
Computed: true,
Expand Down
9 changes: 9 additions & 0 deletions digitalocean/resource_digitalocean_kubernetes_cluster.go
Expand Up @@ -52,6 +52,13 @@ func resourceDigitalOceanKubernetesCluster() *schema.Resource {
Default: true,
},

"ha": {
Type: schema.TypeBool,
Optional: true,
Default: false,
bentranter marked this conversation as resolved.
Show resolved Hide resolved
ForceNew: true,
},

"version": {
Type: schema.TypeString,
Required: true,
Expand Down Expand Up @@ -249,6 +256,7 @@ func resourceDigitalOceanKubernetesClusterCreate(ctx context.Context, d *schema.
RegionSlug: d.Get("region").(string),
VersionSlug: d.Get("version").(string),
SurgeUpgrade: d.Get("surge_upgrade").(bool),
HA: d.Get("ha").(bool),
Tags: expandTags(d.Get("tags").(*schema.Set).List()),
NodePools: poolCreateRequests,
}
Expand Down Expand Up @@ -312,6 +320,7 @@ func digitaloceanKubernetesClusterRead(
d.Set("region", cluster.RegionSlug)
d.Set("version", cluster.VersionSlug)
d.Set("surge_upgrade", cluster.SurgeUpgrade)
d.Set("ha", cluster.HA)
d.Set("cluster_subnet", cluster.ClusterSubnet)
d.Set("service_subnet", cluster.ServiceSubnet)
d.Set("ipv4_address", cluster.IPv4)
Expand Down
4 changes: 4 additions & 0 deletions digitalocean/resource_digitalocean_kubernetes_cluster_test.go
Expand Up @@ -77,6 +77,7 @@ func TestAccDigitalOceanKubernetesCluster_Basic(t *testing.T) {
resource.TestCheckResourceAttr("digitalocean_kubernetes_cluster.foobar", "name", rName),
resource.TestCheckResourceAttr("digitalocean_kubernetes_cluster.foobar", "region", "lon1"),
resource.TestCheckResourceAttr("digitalocean_kubernetes_cluster.foobar", "surge_upgrade", "true"),
resource.TestCheckResourceAttr("digitalocean_kubernetes_cluster.foobar", "ha", "true"),
resource.TestCheckResourceAttrPair("digitalocean_kubernetes_cluster.foobar", "version", "data.digitalocean_kubernetes_versions.test", "latest_version"),
resource.TestCheckResourceAttrSet("digitalocean_kubernetes_cluster.foobar", "ipv4_address"),
resource.TestCheckResourceAttrSet("digitalocean_kubernetes_cluster.foobar", "cluster_subnet"),
Expand Down Expand Up @@ -639,6 +640,7 @@ resource "digitalocean_kubernetes_cluster" "foobar" {
region = "lon1"
version = data.digitalocean_kubernetes_versions.test.latest_version
surge_upgrade = true
ha = true
tags = ["foo","bar", "one"]

%s
Expand Down Expand Up @@ -669,6 +671,7 @@ resource "digitalocean_kubernetes_cluster" "foobar" {
region = "lon1"
version = data.digitalocean_kubernetes_versions.test.latest_version
surge_upgrade = true
ha = true
tags = ["foo","bar"]

node_pool {
Expand Down Expand Up @@ -711,6 +714,7 @@ resource "digitalocean_kubernetes_cluster" "foobar" {
name = "%s"
region = "lon1"
surge_upgrade = true
ha = true
version = data.digitalocean_kubernetes_versions.test.latest_version
tags = ["one","two"]

Expand Down
1 change: 1 addition & 0 deletions docs/resources/kubernetes_cluster.md
Expand Up @@ -148,6 +148,7 @@ The following arguments are supported:
* `vpc_uuid` - (Optional) The ID of the VPC where the Kubernetes cluster will be located.
* `auto_upgrade` - (Optional) A boolean value indicating whether the cluster will be automatically upgraded to new patch releases during its maintenance window.
* `surge_upgrade` - (Optional) Enable/disable surge upgrades for a cluster. Default: false
* `ha` - (Optional) Enable/disable the high availability control plane for a cluster. Default: false
bentranter marked this conversation as resolved.
Show resolved Hide resolved
* `node_pool` - (Required) A block representing the cluster's default node pool. Additional node pools may be added to the cluster using the `digitalocean_kubernetes_node_pool` resource. The following arguments may be specified:
- `name` - (Required) A name for the node pool.
- `size` - (Required) The slug identifier for the type of Droplet to be used as workers in the node pool.
Expand Down
6 changes: 3 additions & 3 deletions go.mod
Expand Up @@ -2,7 +2,7 @@ module github.com/digitalocean/terraform-provider-digitalocean

require (
github.com/aws/aws-sdk-go v1.25.4
github.com/digitalocean/godo v1.66.0
github.com/digitalocean/godo v1.69.1
github.com/golang/protobuf v1.5.2 // indirect
github.com/google/go-querystring v1.1.0 // indirect
github.com/hashicorp/go-version v1.3.0
Expand All @@ -11,8 +11,8 @@ require (
github.com/mitchellh/hashstructure/v2 v2.0.1
github.com/stretchr/testify v1.7.0
golang.org/x/crypto v0.0.0-20210421170649-83a5a9bb288b
golang.org/x/net v0.0.0-20210805182204-aaa1db679c0d // indirect
golang.org/x/oauth2 v0.0.0-20210805134026-6f1e6394065a
golang.org/x/net v0.0.0-20211006190231-62292e806868 // indirect
golang.org/x/oauth2 v0.0.0-20211005180243-6b3c2da341f1
google.golang.org/appengine v1.6.7 // indirect
google.golang.org/protobuf v1.27.1 // indirect
gopkg.in/yaml.v2 v2.3.0
Expand Down
6 changes: 6 additions & 0 deletions go.sum
Expand Up @@ -83,6 +83,8 @@ github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/digitalocean/godo v1.66.0 h1:uEi/+ioAEvI/PnFmumXDEQeaXaL8cUyw4cGePVXFbGI=
github.com/digitalocean/godo v1.66.0/go.mod h1:epPuOzTOOJujNo0nduDj2D5O1zu8cSpp9R+DdN0W9I0=
github.com/digitalocean/godo v1.69.1 h1:aCyfwth8R3DeOaWB9J9E8v7cjlDIlF19eXTt8R3XhTE=
github.com/digitalocean/godo v1.69.1/go.mod h1:epPuOzTOOJujNo0nduDj2D5O1zu8cSpp9R+DdN0W9I0=
github.com/emirpasic/gods v1.12.0 h1:QAUIPSaCu4G+POclxeqb3F+WPpdKqFGlw36+yOzGlrg=
github.com/emirpasic/gods v1.12.0/go.mod h1:YfzfFFoVP/catgzJb4IKIqXjX78Ha8FMSDh3ymbK86o=
github.com/envoyproxy/go-control-plane v0.9.0/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4=
Expand Down Expand Up @@ -402,13 +404,17 @@ golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v
golang.org/x/net v0.0.0-20210326060303-6b1517762897/go.mod h1:uSPa2vr4CLtc/ILN5odXGNXS6mhrKVzTaCXzk9m6W3k=
golang.org/x/net v0.0.0-20210805182204-aaa1db679c0d h1:20cMwl2fHAzkJMEA+8J4JgqBQcQGzbisXo31MIeenXI=
golang.org/x/net v0.0.0-20210805182204-aaa1db679c0d/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y=
golang.org/x/net v0.0.0-20211006190231-62292e806868 h1:KlOXYy8wQWTUJYFgkUI40Lzr06ofg5IRXUK5C7qZt1k=
golang.org/x/net v0.0.0-20211006190231-62292e806868/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y=
golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U=
golang.org/x/oauth2 v0.0.0-20190226205417-e64efc72b421/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw=
golang.org/x/oauth2 v0.0.0-20190604053449-0f29369cfe45/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw=
golang.org/x/oauth2 v0.0.0-20191202225959-858c2ad4c8b6/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw=
golang.org/x/oauth2 v0.0.0-20200107190931-bf48bf16ab8d/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw=
golang.org/x/oauth2 v0.0.0-20210805134026-6f1e6394065a h1:4Kd8OPUx1xgUwrHDaviWZO8MsgoZTZYC3g+8m16RBww=
golang.org/x/oauth2 v0.0.0-20210805134026-6f1e6394065a/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A=
golang.org/x/oauth2 v0.0.0-20211005180243-6b3c2da341f1 h1:B333XXssMuKQeBwiNODx4TupZy7bf4sxFZnN2ZOcvUE=
golang.org/x/oauth2 v0.0.0-20211005180243-6b3c2da341f1/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A=
golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sync v0.0.0-20181108010431-42b317875d0f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sync v0.0.0-20181221193216-37e7f081c4d4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
Expand Down
17 changes: 17 additions & 0 deletions vendor/github.com/digitalocean/godo/CHANGELOG.md

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion vendor/github.com/digitalocean/godo/godo.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

11 changes: 9 additions & 2 deletions vendor/github.com/digitalocean/godo/kubernetes.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

100 changes: 57 additions & 43 deletions vendor/github.com/digitalocean/godo/load_balancers.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

20 changes: 0 additions & 20 deletions vendor/golang.org/x/net/http2/README

This file was deleted.