Skip to content

Commit a3aa5be

Browse files
Support tier field for LKE-E (#651)
* Support tier field for LKE-E * Reran fixture for failing test
1 parent 1cfb144 commit a3aa5be

File tree

7 files changed

+910
-66
lines changed

7 files changed

+910
-66
lines changed

lke_clusters.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,9 @@ type LKECluster struct {
2828
K8sVersion string `json:"k8s_version"`
2929
Tags []string `json:"tags"`
3030
ControlPlane LKEClusterControlPlane `json:"control_plane"`
31+
32+
// NOTE: Tier may not currently be available to all users and can only be used with v4beta.
33+
Tier string `json:"tier"`
3134
}
3235

3336
// LKEClusterCreateOptions fields are those accepted by CreateLKECluster
@@ -38,6 +41,9 @@ type LKEClusterCreateOptions struct {
3841
K8sVersion string `json:"k8s_version"`
3942
Tags []string `json:"tags,omitempty"`
4043
ControlPlane *LKEClusterControlPlaneOptions `json:"control_plane,omitempty"`
44+
45+
// NOTE: Tier may not currently be available to all users and can only be used with v4beta.
46+
Tier string `json:"tier,omitempty"`
4147
}
4248

4349
// LKEClusterUpdateOptions fields are those accepted by UpdateLKECluster

regions.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ const (
3737
CapabilityPlacementGroup string = "Placement Group"
3838
CapabilityDiskEncryption string = "Disk Encryption"
3939
CapabilityBlockStorageEncryption string = "Block Storage Encryption"
40+
CapabilityKubernetesEnterprise string = "Kubernetes Enterprise"
4041
)
4142

4243
// Region-related endpoints have a custom expiry time as the

test/integration/fixtures/TestInstance_GetMonthlyTransfer.yaml

Lines changed: 68 additions & 66 deletions
Large diffs are not rendered by default.

test/integration/fixtures/TestLKECluster_Enterprise_smoke.yaml

Lines changed: 496 additions & 0 deletions
Large diffs are not rendered by default.

test/integration/fixtures/TestRegions_kubernetesEnterprise.yaml

Lines changed: 306 additions & 0 deletions
Large diffs are not rendered by default.

test/integration/lke_clusters_test.go

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,25 @@ func TestLKECluster_GetFound_smoke(t *testing.T) {
6363
}
6464
}
6565

66+
func TestLKECluster_Enterprise_smoke(t *testing.T) {
67+
client, lkeCluster, teardown, err := setupLKECluster(t, []clusterModifier{func(createOpts *linodego.LKEClusterCreateOptions) {
68+
createOpts.Tier = "enterprise"
69+
createOpts.Region = "us-lax"
70+
createOpts.K8sVersion = "v1.31.1+lke1"
71+
}}, "fixtures/TestLKECluster_Enterprise_smoke")
72+
defer teardown()
73+
i, err := client.GetLKECluster(context.Background(), lkeCluster.ID)
74+
if err != nil {
75+
t.Errorf("Error getting lkeCluster, expected struct, got %v and error %v", i, err)
76+
}
77+
if i.ID != lkeCluster.ID {
78+
t.Errorf("Expected a specific lkeCluster, but got a different one %v", i)
79+
}
80+
if i.Tier != "enterprise" {
81+
t.Errorf("Expected a lkeCluster to have enterprise tier")
82+
}
83+
}
84+
6685
func TestLKECluster_Update(t *testing.T) {
6786
client, cluster, teardown, err := setupLKECluster(t, []clusterModifier{func(createOpts *linodego.LKEClusterCreateOptions) {
6887
createOpts.Label = "go-lke-test-update"

test/integration/regions_test.go

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,3 +59,17 @@ func TestRegions_blockStorageEncryption(t *testing.T) {
5959
})
6060
require.NotZero(t, regionIdx)
6161
}
62+
63+
func TestRegions_kubernetesEnterprise(t *testing.T) {
64+
client, teardown := createTestClient(t, "fixtures/TestRegions_kubernetesEnterprise")
65+
defer teardown()
66+
67+
regions, err := client.ListRegions(context.Background(), nil)
68+
require.NoError(t, err)
69+
70+
// Filtering is not currently supported on capabilities
71+
regionIdx := slices.IndexFunc(regions, func(region linodego.Region) bool {
72+
return slices.Contains(region.Capabilities, "Kubernetes Enterprise")
73+
})
74+
require.NotZero(t, regionIdx)
75+
}

0 commit comments

Comments
 (0)