From 7b0ae390d9cf0d18f4217d04f6c2b6c251c001a5 Mon Sep 17 00:00:00 2001 From: Ingo Gottwald Date: Tue, 24 Sep 2024 17:30:35 +0200 Subject: [PATCH 1/2] DOKS: add custom CIDR fields This exposes the new create requests fields that allow to set custom CIDRs for the cluster and service subnets. --- kubernetes.go | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/kubernetes.go b/kubernetes.go index 8ef9d24..9b3bcfa 100644 --- a/kubernetes.go +++ b/kubernetes.go @@ -65,11 +65,13 @@ type KubernetesServiceOp struct { // KubernetesClusterCreateRequest represents a request to create a Kubernetes cluster. type KubernetesClusterCreateRequest struct { - Name string `json:"name,omitempty"` - RegionSlug string `json:"region,omitempty"` - VersionSlug string `json:"version,omitempty"` - Tags []string `json:"tags,omitempty"` - VPCUUID string `json:"vpc_uuid,omitempty"` + Name string `json:"name,omitempty"` + RegionSlug string `json:"region,omitempty"` + VersionSlug string `json:"version,omitempty"` + Tags []string `json:"tags,omitempty"` + VPCUUID string `json:"vpc_uuid,omitempty"` + ClusterSubnet string `json:"cluster_subnet,omitempty"` + ServiceSubnet string `json:"service_subnet,omitempty"` // Create cluster with highly available control plane HA bool `json:"ha"` From 48555e9b3b7f019147a34662d657261c0b3adf9b Mon Sep 17 00:00:00 2001 From: Ingo Gottwald Date: Wed, 25 Sep 2024 20:15:49 +0200 Subject: [PATCH 2/2] doks: include custom CIDR in create test --- kubernetes_test.go | 24 +++++++++++++----------- 1 file changed, 13 insertions(+), 11 deletions(-) diff --git a/kubernetes_test.go b/kubernetes_test.go index 1ad02af..32b8f4f 100644 --- a/kubernetes_test.go +++ b/kubernetes_test.go @@ -549,8 +549,8 @@ func TestKubernetesClusters_Create(t *testing.T) { Name: "antoine-test-cluster", RegionSlug: "s2r1", VersionSlug: "1.10.0-gen0", - ClusterSubnet: "10.244.0.0/16", - ServiceSubnet: "10.245.0.0/16", + ClusterSubnet: "192.168.0.0/16", + ServiceSubnet: "192.169.0.0/16", Tags: []string{"cluster-tag-1", "cluster-tag-2"}, VPCUUID: "880b7f98-f062-404d-b33c-458d545696f6", HA: true, @@ -577,13 +577,15 @@ func TestKubernetesClusters_Create(t *testing.T) { }, } createRequest := &KubernetesClusterCreateRequest{ - Name: want.Name, - RegionSlug: want.RegionSlug, - VersionSlug: want.VersionSlug, - Tags: want.Tags, - VPCUUID: want.VPCUUID, - SurgeUpgrade: true, - HA: true, + Name: want.Name, + RegionSlug: want.RegionSlug, + VersionSlug: want.VersionSlug, + Tags: want.Tags, + VPCUUID: want.VPCUUID, + ClusterSubnet: want.ClusterSubnet, + ServiceSubnet: want.ServiceSubnet, + SurgeUpgrade: true, + HA: true, NodePools: []*KubernetesNodePoolCreateRequest{ { Size: want.NodePools[0].Size, @@ -606,8 +608,8 @@ func TestKubernetesClusters_Create(t *testing.T) { "name": "antoine-test-cluster", "region": "s2r1", "version": "1.10.0-gen0", - "cluster_subnet": "10.244.0.0/16", - "service_subnet": "10.245.0.0/16", + "cluster_subnet": "192.168.0.0/16", + "service_subnet": "192.169.0.0/16", "tags": [ "cluster-tag-1", "cluster-tag-2"