Skip to content

Commit

Permalink
Support tier field for LKE-E (#651)
Browse files Browse the repository at this point in the history
* Support tier field for LKE-E

* Reran fixture for failing test
  • Loading branch information
ezilber-akamai authored Jan 13, 2025
1 parent 1cfb144 commit a3aa5be
Show file tree
Hide file tree
Showing 7 changed files with 910 additions and 66 deletions.
6 changes: 6 additions & 0 deletions lke_clusters.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,9 @@ type LKECluster struct {
K8sVersion string `json:"k8s_version"`
Tags []string `json:"tags"`
ControlPlane LKEClusterControlPlane `json:"control_plane"`

// NOTE: Tier may not currently be available to all users and can only be used with v4beta.
Tier string `json:"tier"`
}

// LKEClusterCreateOptions fields are those accepted by CreateLKECluster
Expand All @@ -38,6 +41,9 @@ type LKEClusterCreateOptions struct {
K8sVersion string `json:"k8s_version"`
Tags []string `json:"tags,omitempty"`
ControlPlane *LKEClusterControlPlaneOptions `json:"control_plane,omitempty"`

// NOTE: Tier may not currently be available to all users and can only be used with v4beta.
Tier string `json:"tier,omitempty"`
}

// LKEClusterUpdateOptions fields are those accepted by UpdateLKECluster
Expand Down
1 change: 1 addition & 0 deletions regions.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ const (
CapabilityPlacementGroup string = "Placement Group"
CapabilityDiskEncryption string = "Disk Encryption"
CapabilityBlockStorageEncryption string = "Block Storage Encryption"
CapabilityKubernetesEnterprise string = "Kubernetes Enterprise"
)

// Region-related endpoints have a custom expiry time as the
Expand Down
134 changes: 68 additions & 66 deletions test/integration/fixtures/TestInstance_GetMonthlyTransfer.yaml

Large diffs are not rendered by default.

496 changes: 496 additions & 0 deletions test/integration/fixtures/TestLKECluster_Enterprise_smoke.yaml

Large diffs are not rendered by default.

306 changes: 306 additions & 0 deletions test/integration/fixtures/TestRegions_kubernetesEnterprise.yaml

Large diffs are not rendered by default.

19 changes: 19 additions & 0 deletions test/integration/lke_clusters_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,25 @@ func TestLKECluster_GetFound_smoke(t *testing.T) {
}
}

func TestLKECluster_Enterprise_smoke(t *testing.T) {
client, lkeCluster, teardown, err := setupLKECluster(t, []clusterModifier{func(createOpts *linodego.LKEClusterCreateOptions) {
createOpts.Tier = "enterprise"
createOpts.Region = "us-lax"
createOpts.K8sVersion = "v1.31.1+lke1"
}}, "fixtures/TestLKECluster_Enterprise_smoke")
defer teardown()
i, err := client.GetLKECluster(context.Background(), lkeCluster.ID)
if err != nil {
t.Errorf("Error getting lkeCluster, expected struct, got %v and error %v", i, err)
}
if i.ID != lkeCluster.ID {
t.Errorf("Expected a specific lkeCluster, but got a different one %v", i)
}
if i.Tier != "enterprise" {
t.Errorf("Expected a lkeCluster to have enterprise tier")
}
}

func TestLKECluster_Update(t *testing.T) {
client, cluster, teardown, err := setupLKECluster(t, []clusterModifier{func(createOpts *linodego.LKEClusterCreateOptions) {
createOpts.Label = "go-lke-test-update"
Expand Down
14 changes: 14 additions & 0 deletions test/integration/regions_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -59,3 +59,17 @@ func TestRegions_blockStorageEncryption(t *testing.T) {
})
require.NotZero(t, regionIdx)
}

func TestRegions_kubernetesEnterprise(t *testing.T) {
client, teardown := createTestClient(t, "fixtures/TestRegions_kubernetesEnterprise")
defer teardown()

regions, err := client.ListRegions(context.Background(), nil)
require.NoError(t, err)

// Filtering is not currently supported on capabilities
regionIdx := slices.IndexFunc(regions, func(region linodego.Region) bool {
return slices.Contains(region.Capabilities, "Kubernetes Enterprise")
})
require.NotZero(t, regionIdx)
}

0 comments on commit a3aa5be

Please sign in to comment.