Skip to content

Commit

Permalink
kubernetes: add support for HA control plane (#480)
Browse files Browse the repository at this point in the history
  • Loading branch information
sunny-b authored Sep 28, 2021
1 parent 7b30c81 commit 66d4176
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 0 deletions.
9 changes: 9 additions & 0 deletions kubernetes.go
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,9 @@ type KubernetesClusterCreateRequest struct {
Tags []string `json:"tags,omitempty"`
VPCUUID string `json:"vpc_uuid,omitempty"`

// Create cluster with highly available control plane
HA bool `json:"ha"`

NodePools []*KubernetesNodePoolCreateRequest `json:"node_pools,omitempty"`

MaintenancePolicy *KubernetesMaintenancePolicy `json:"maintenance_policy"`
Expand All @@ -85,6 +88,9 @@ type KubernetesClusterUpdateRequest struct {
MaintenancePolicy *KubernetesMaintenancePolicy `json:"maintenance_policy,omitempty"`
AutoUpgrade *bool `json:"auto_upgrade,omitempty"`
SurgeUpgrade bool `json:"surge_upgrade,omitempty"`

// Convert cluster to run highly available control plane
HA bool `json:"ha,omitempty"`
}

// KubernetesClusterDeleteSelectiveRequest represents a delete selective request to delete a cluster and it's associated resources.
Expand Down Expand Up @@ -190,6 +196,9 @@ type KubernetesCluster struct {
Tags []string `json:"tags,omitempty"`
VPCUUID string `json:"vpc_uuid,omitempty"`

// Cluster runs a highly available control plane
HA bool `json:"ha,omitempty"`

NodePools []*KubernetesNodePool `json:"node_pools,omitempty"`

MaintenancePolicy *KubernetesMaintenancePolicy `json:"maintenance_policy,omitempty"`
Expand Down
5 changes: 5 additions & 0 deletions kubernetes_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -552,6 +552,7 @@ func TestKubernetesClusters_Create(t *testing.T) {
ServiceSubnet: "10.245.0.0/16",
Tags: []string{"cluster-tag-1", "cluster-tag-2"},
VPCUUID: "880b7f98-f062-404d-b33c-458d545696f6",
HA: true,
SurgeUpgrade: true,
NodePools: []*KubernetesNodePool{
{
Expand All @@ -575,6 +576,7 @@ func TestKubernetesClusters_Create(t *testing.T) {
Tags: want.Tags,
VPCUUID: want.VPCUUID,
SurgeUpgrade: true,
HA: true,
NodePools: []*KubernetesNodePoolCreateRequest{
{
Size: want.NodePools[0].Size,
Expand Down Expand Up @@ -604,6 +606,7 @@ func TestKubernetesClusters_Create(t *testing.T) {
"cluster-tag-2"
],
"vpc_uuid": "880b7f98-f062-404d-b33c-458d545696f6",
"ha": true,
"surge_upgrade": true,
"node_pools": [
{
Expand Down Expand Up @@ -763,6 +766,7 @@ func TestKubernetesClusters_Update(t *testing.T) {
Tags: []string{"cluster-tag-1", "cluster-tag-2"},
VPCUUID: "880b7f98-f062-404d-b33c-458d545696f6",
SurgeUpgrade: true,
HA: true,
NodePools: []*KubernetesNodePool{
{
ID: "8d91899c-0739-4a1a-acc5-deadbeefbb8a",
Expand Down Expand Up @@ -801,6 +805,7 @@ func TestKubernetesClusters_Update(t *testing.T) {
"cluster-tag-2"
],
"vpc_uuid": "880b7f98-f062-404d-b33c-458d545696f6",
"ha": true,
"surge_upgrade": true,
"node_pools": [
{
Expand Down

0 comments on commit 66d4176

Please sign in to comment.