diff --git a/account_events.go b/account_events.go index 0f8565d18..b7f18a55d 100644 --- a/account_events.go +++ b/account_events.go @@ -127,6 +127,9 @@ const ( ActionLinodeConfigUpdate EventAction = "linode_config_update" ActionLishBoot EventAction = "lish_boot" ActionLKENodeCreate EventAction = "lke_node_create" + ActionLKEControlPlaneACLCreate EventAction = "lke_control_plane_acl_create" + ActionLKEControlPlaneACLUpdate EventAction = "lke_control_plane_acl_update" + ActionLKEControlPlaneACLDelete EventAction = "lke_control_plane_acl_delete" ActionLongviewClientCreate EventAction = "longviewclient_create" ActionLongviewClientDelete EventAction = "longviewclient_delete" ActionLongviewClientUpdate EventAction = "longviewclient_update" diff --git a/go.work.sum b/go.work.sum index 6298cd966..2bc700c72 100644 --- a/go.work.sum +++ b/go.work.sum @@ -8,6 +8,7 @@ cloud.google.com/go/compute/metadata v0.2.0 h1:nBbNSZyDpkNlo3DepaaLKVuO7ClyifSAm cloud.google.com/go/compute/metadata v0.2.0/go.mod h1:zFmK7XCadkQkj6TtorcaGlCW1hT1fIilQDwofLpJ20k= cloud.google.com/go/compute/metadata v0.2.3 h1:mg4jlk7mCAj6xXp9UJ4fjI9VUI5rubuGBW5aJ7UnBMY= cloud.google.com/go/compute/metadata v0.2.3/go.mod h1:VAV5nSsACxMJvgaAuX6Pk2AawlZn8kiOGuCv6gTkwuA= +cloud.google.com/go/compute/metadata v0.3.0 h1:Tz+eQXMEqDIKRsmY3cHTL6FVaynIjX2QxYC4trgAKZc= cloud.google.com/go/compute/metadata v0.3.0/go.mod h1:zFmK7XCadkQkj6TtorcaGlCW1hT1fIilQDwofLpJ20k= cloud.google.com/go/datastore v1.1.0 h1:/May9ojXjRkPBNVrq+oWLqmWCkr4OU5uRY29bu0mRyQ= cloud.google.com/go/pubsub v1.3.1 h1:ukjixP1wl0LpnZ6LWtZJ0mX5tBmjp1f8Sqer8Z2OMUU= @@ -201,6 +202,7 @@ golang.org/x/crypto v0.18.0/go.mod h1:R0j02AL6hcrfOiy9T4ZYp/rcWeMxM3L6QYxlOuEG1m golang.org/x/crypto v0.21.0 h1:X31++rzVUdKhX5sWmSOFZxx8UW/ldWx55cbf08iNAMA= golang.org/x/crypto v0.22.0 h1:g1v0xeRhjcugydODzvb3mEM9SQ0HGp9s/nh3COQ/C30= golang.org/x/crypto v0.22.0/go.mod h1:vr6Su+7cTlO45qkww3VDJlzDn0ctJvRgYbC2NvXHt+M= +golang.org/x/crypto v0.23.0 h1:dIJU/v2J8Mdglj/8rJ6UUOM3Zc9zLZxVZwwxMooUSAI= golang.org/x/crypto v0.23.0/go.mod h1:CKFgDieR+mRhux2Lsu27y0fO304Db0wZe70UKqHu0v8= golang.org/x/exp v0.0.0-20200224162631-6cc2880d07d6 h1:QE6XYQK6naiK1EPAe1g/ILLxN5RBoH5xkJk3CqlMI/Y= golang.org/x/image v0.0.0-20190802002840-cff245a6509b h1:+qEpEAPhDZ1o0x3tHzZTQDArnOixOzGD9HUJfcg0mb4= @@ -235,8 +237,6 @@ golang.org/x/sys v0.0.0-20191204072324-ce4227a45e2e/go.mod h1:h1NjWce9XRLGQEsW7w golang.org/x/sys v0.7.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.12.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.13.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.20.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= -golang.org/x/term v0.20.0/go.mod h1:8UkIAJTvZgivsXaD6/pH6U9ecQzZ45awqEOzuCvwpFY= golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk= golang.org/x/text v0.12.0/go.mod h1:TvPlkZtksWOMsz7fbANvkp4WM8x/WCo/om8BMLbz+aE= golang.org/x/text v0.13.0/go.mod h1:TvPlkZtksWOMsz7fbANvkp4WM8x/WCo/om8BMLbz+aE= diff --git a/lke_clusters.go b/lke_clusters.go index ff9b67659..7cc6d77a5 100644 --- a/lke_clusters.go +++ b/lke_clusters.go @@ -35,20 +35,20 @@ type LKECluster struct { // LKEClusterCreateOptions fields are those accepted by CreateLKECluster type LKEClusterCreateOptions struct { - NodePools []LKENodePoolCreateOptions `json:"node_pools"` - Label string `json:"label"` - Region string `json:"region"` - K8sVersion string `json:"k8s_version"` - Tags []string `json:"tags,omitempty"` - ControlPlane *LKEClusterControlPlane `json:"control_plane,omitempty"` + NodePools []LKENodePoolCreateOptions `json:"node_pools"` + Label string `json:"label"` + Region string `json:"region"` + K8sVersion string `json:"k8s_version"` + Tags []string `json:"tags,omitempty"` + ControlPlane *LKEClusterControlPlaneOptions `json:"control_plane,omitempty"` } // LKEClusterUpdateOptions fields are those accepted by UpdateLKECluster type LKEClusterUpdateOptions struct { - K8sVersion string `json:"k8s_version,omitempty"` - Label string `json:"label,omitempty"` - Tags *[]string `json:"tags,omitempty"` - ControlPlane *LKEClusterControlPlane `json:"control_plane,omitempty"` + K8sVersion string `json:"k8s_version,omitempty"` + Label string `json:"label,omitempty"` + Tags *[]string `json:"tags,omitempty"` + ControlPlane *LKEClusterControlPlaneOptions `json:"control_plane,omitempty"` } // LKEClusterAPIEndpoint fields are those returned by ListLKEClusterAPIEndpoints @@ -66,11 +66,6 @@ type LKEClusterDashboard struct { URL string `json:"url"` } -// LKEClusterControlPlane fields contained within the `control_plane` attribute of an LKE cluster. -type LKEClusterControlPlane struct { - HighAvailability bool `json:"high_availability"` -} - // LKEVersion fields are those returned by GetLKEVersion type LKEVersion struct { ID string `json:"id"` @@ -110,7 +105,14 @@ func (i LKECluster) GetCreateOptions() (o LKEClusterCreateOptions) { o.Region = i.Region o.K8sVersion = i.K8sVersion o.Tags = i.Tags - o.ControlPlane = &i.ControlPlane + + isHA := i.ControlPlane.HighAvailability + + o.ControlPlane = &LKEClusterControlPlaneOptions{ + HighAvailability: &isHA, + // ACL will not be populated in the control plane response + } + // @TODO copy NodePools? return } @@ -120,7 +122,14 @@ func (i LKECluster) GetUpdateOptions() (o LKEClusterUpdateOptions) { o.K8sVersion = i.K8sVersion o.Label = i.Label o.Tags = &i.Tags - o.ControlPlane = &i.ControlPlane + + isHA := i.ControlPlane.HighAvailability + + o.ControlPlane = &LKEClusterControlPlaneOptions{ + HighAvailability: &isHA, + // ACL will not be populated in the control plane response + } + return } diff --git a/lke_clusters_control_plane.go b/lke_clusters_control_plane.go new file mode 100644 index 000000000..d71da8ab1 --- /dev/null +++ b/lke_clusters_control_plane.go @@ -0,0 +1,94 @@ +package linodego + +import "context" + +// LKEClusterControlPlane fields contained within the `control_plane` attribute of an LKE cluster. +type LKEClusterControlPlane struct { + HighAvailability bool `json:"high_availability"` +} + +// LKEClusterControlPlaneACLAddresses describes the +// allowed IP ranges for an LKE cluster's control plane. +type LKEClusterControlPlaneACLAddresses struct { + IPv4 []string `json:"ipv4"` + IPv6 []string `json:"ipv6"` +} + +// LKEClusterControlPlaneACL describes the ACL configuration +// for an LKE cluster's control plane. +type LKEClusterControlPlaneACL struct { + Enabled bool `json:"enabled"` + Addresses *LKEClusterControlPlaneACLAddresses `json:"addresses"` +} + +// LKEClusterControlPlaneACLAddressesOptions are the options used to +// specify the allowed IP ranges for an LKE cluster's control plane. +type LKEClusterControlPlaneACLAddressesOptions struct { + IPv4 *[]string `json:"ipv4,omitempty"` + IPv6 *[]string `json:"ipv6,omitempty"` +} + +// LKEClusterControlPlaneACLOptions represents the options used when +// configuring an LKE cluster's control plane ACL policy. +type LKEClusterControlPlaneACLOptions struct { + Enabled *bool `json:"enabled,omitempty"` + Addresses *LKEClusterControlPlaneACLAddressesOptions `json:"addresses,omitempty"` +} + +// LKEClusterControlPlaneOptions represents the options used when +// configuring an LKE cluster's control plane. +type LKEClusterControlPlaneOptions struct { + HighAvailability *bool `json:"high_availability,omitempty"` + ACL *LKEClusterControlPlaneACLOptions `json:"acl,omitempty"` +} + +// LKEClusterControlPlaneACLUpdateOptions represents the options +// available when updating the ACL configuration of an LKE cluster's +// control plane. +type LKEClusterControlPlaneACLUpdateOptions struct { + ACL LKEClusterControlPlaneACLOptions `json:"acl"` +} + +// LKEClusterControlPlaneACLResponse represents the response structure +// for the Client.GetLKEClusterControlPlaneACL(...) method. +type LKEClusterControlPlaneACLResponse struct { + ACL LKEClusterControlPlaneACL `json:"acl"` +} + +// GetLKEClusterControlPlaneACL gets the ACL configuration for the +// given cluster's control plane. +func (c *Client) GetLKEClusterControlPlaneACL(ctx context.Context, clusterID int) (*LKEClusterControlPlaneACLResponse, error) { + return doGETRequest[LKEClusterControlPlaneACLResponse]( + ctx, + c, + formatAPIPath("lke/clusters/%d/control_plane_acl", clusterID), + ) +} + +// UpdateLKEClusterControlPlaneACL updates the ACL configuration for the +// given cluster's control plane. +func (c *Client) UpdateLKEClusterControlPlaneACL( + ctx context.Context, + clusterID int, + opts LKEClusterControlPlaneACLUpdateOptions, +) (*LKEClusterControlPlaneACLResponse, error) { + return doPUTRequest[LKEClusterControlPlaneACLResponse]( + ctx, + c, + formatAPIPath("lke/clusters/%d/control_plane_acl", clusterID), + opts, + ) +} + +// DeleteLKEClusterControlPlaneACL deletes the ACL configuration for the +// given cluster's control plane. +func (c *Client) DeleteLKEClusterControlPlaneACL( + ctx context.Context, + clusterID int, +) error { + return doDELETERequest( + ctx, + c, + formatAPIPath("lke/clusters/%d/control_plane_acl", clusterID), + ) +} diff --git a/test/go.mod b/test/go.mod index c537add10..061910eba 100644 --- a/test/go.mod +++ b/test/go.mod @@ -6,6 +6,7 @@ require ( github.com/jarcoal/httpmock v1.3.1 github.com/linode/linodego v1.33.0 github.com/linode/linodego/k8s v0.0.0-00010101000000-000000000000 + github.com/stretchr/testify v1.9.0 golang.org/x/net v0.25.0 golang.org/x/oauth2 v0.20.0 k8s.io/client-go v0.29.4 @@ -31,6 +32,7 @@ require ( github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect github.com/modern-go/reflect2 v1.0.2 // indirect github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 // indirect + github.com/pmezard/go-difflib v1.0.0 // indirect github.com/spf13/pflag v1.0.5 // indirect golang.org/x/sys v0.20.0 // indirect golang.org/x/term v0.20.0 // indirect diff --git a/test/integration/fixtures/TestLKECluster_withACL.yaml b/test/integration/fixtures/TestLKECluster_withACL.yaml new file mode 100644 index 000000000..24d2c2a83 --- /dev/null +++ b/test/integration/fixtures/TestLKECluster_withACL.yaml @@ -0,0 +1,655 @@ +--- +version: 1 +interactions: +- request: + body: "" + form: {} + headers: + Accept: + - application/json + Content-Type: + - application/json + User-Agent: + - linodego/dev https://github.com/linode/linodego + url: https://api.linode.com/v4beta/regions + method: GET + response: + body: '{"data": [{"id": "ap-west", "label": "Mumbai, IN", "country": "in", "capabilities": + ["Linodes", "Backups", "NodeBalancers", "Block Storage", "GPU Linodes", "Kubernetes", + "Cloud Firewall", "Vlans", "Block Storage Migrations", "Managed Databases"], + "status": "ok", "resolvers": {"ipv4": "172.105.34.5, 172.105.35.5, 172.105.36.5, + 172.105.37.5, 172.105.38.5, 172.105.39.5, 172.105.40.5, 172.105.41.5, 172.105.42.5, + 172.105.43.5", "ipv6": "1234::5678, 1234::5678, + 1234::5678, 1234::5678, 1234::5678, + 1234::5678, 1234::5678, 1234::5678, + 1234::5678, 1234::5678"}, "placement_group_limits": + {"maximum_pgs_per_customer": 5, "maximum_linodes_per_pg": 5}, "site_type": "core"}, + {"id": "ca-central", "label": "Toronto, CA", "country": "ca", "capabilities": + ["Linodes", "Backups", "NodeBalancers", "Block Storage", "Kubernetes", "Cloud + Firewall", "Vlans", "Block Storage Migrations", "Managed Databases"], "status": + "ok", "resolvers": {"ipv4": "172.105.0.5, 172.105.3.5, 172.105.4.5, 172.105.5.5, + 172.105.6.5, 172.105.7.5, 172.105.8.5, 172.105.9.5, 172.105.10.5, 172.105.11.5", + "ipv6": "1234::5678, 1234::5678, 1234::5678, + 1234::5678, 1234::5678, 1234::5678, + 1234::5678, 1234::5678, 1234::5678, + 1234::5678"}, "placement_group_limits": {"maximum_pgs_per_customer": + 5, "maximum_linodes_per_pg": 5}, "site_type": "core"}, {"id": "ap-southeast", + "label": "Sydney, AU", "country": "au", "capabilities": ["Linodes", "Backups", + "NodeBalancers", "Block Storage", "Kubernetes", "Cloud Firewall", "Vlans", "Block + Storage Migrations", "Managed Databases"], "status": "ok", "resolvers": {"ipv4": + "172.105.166.5, 172.105.169.5, 172.105.168.5, 172.105.172.5, 172.105.162.5, + 172.105.170.5, 172.105.167.5, 172.105.171.5, 172.105.181.5, 172.105.161.5", + "ipv6": "1234::5678, 1234::5678, 1234::5678, + 1234::5678, 1234::5678, 1234::5678, + 1234::5678, 1234::5678, 1234::5678, + 1234::5678"}, "placement_group_limits": {"maximum_pgs_per_customer": + 5, "maximum_linodes_per_pg": 5}, "site_type": "core"}, {"id": "us-iad", "label": + "Washington, DC", "country": "us", "capabilities": ["Linodes", "Backups", "NodeBalancers", + "Block Storage", "Object Storage", "Kubernetes", "Cloud Firewall", "Vlans", + "VPCs", "Managed Databases", "Metadata", "Premium Plans"], "status": "ok", "resolvers": + {"ipv4": "139.144.192.62, 139.144.192.60, 139.144.192.61, 139.144.192.53, 139.144.192.54, + 139.144.192.67, 139.144.192.69, 139.144.192.66, 139.144.192.52, 139.144.192.68", + "ipv6": "1234::5678, 1234::5678, 1234::5678, + 1234::5678, 1234::5678, 1234::5678, + 1234::5678, 1234::5678, 1234::5678, + 1234::5678"}, "placement_group_limits": {"maximum_pgs_per_customer": + 5, "maximum_linodes_per_pg": 5}, "site_type": "core"}, {"id": "us-ord", "label": + "Chicago, IL", "country": "us", "capabilities": ["Linodes", "Backups", "NodeBalancers", + "Block Storage", "Object Storage", "Kubernetes", "Cloud Firewall", "Vlans", + "VPCs", "Managed Databases", "Metadata", "Premium Plans"], "status": "ok", "resolvers": + {"ipv4": "172.232.0.17, 172.232.0.16, 172.232.0.21, 172.232.0.13, 172.232.0.22, + 172.232.0.9, 172.232.0.19, 172.232.0.20, 172.232.0.15, 172.232.0.18", "ipv6": + "1234::5678, 1234::5678, 1234::5678, + 1234::5678, 1234::5678, 1234::5678, + 1234::5678, 1234::5678, 1234::5678, + 1234::5678"}, "placement_group_limits": {"maximum_pgs_per_customer": + 5, "maximum_linodes_per_pg": 5}, "site_type": "core"}, {"id": "fr-par", "label": + "Paris, FR", "country": "fr", "capabilities": ["Linodes", "Backups", "NodeBalancers", + "Block Storage", "Object Storage", "Kubernetes", "Cloud Firewall", "Vlans", + "VPCs", "Managed Databases", "Metadata", "Premium Plans"], "status": "ok", "resolvers": + {"ipv4": "172.232.32.21, 172.232.32.23, 172.232.32.17, 172.232.32.18, 172.232.32.16, + 172.232.32.22, 172.232.32.20, 172.232.32.14, 172.232.32.11, 172.232.32.12", + "ipv6": "1234::5678, 1234::5678, 1234::5678, + 1234::5678, 1234::5678, 1234::5678, + 1234::5678, 1234::5678, 1234::5678, + 1234::5678"}, "placement_group_limits": {"maximum_pgs_per_customer": + 5, "maximum_linodes_per_pg": 5}, "site_type": "core"}, {"id": "us-sea", "label": + "Seattle, WA", "country": "us", "capabilities": ["Linodes", "Backups", "NodeBalancers", + "Block Storage", "Object Storage", "Kubernetes", "Cloud Firewall", "Vlans", + "VPCs", "Metadata", "Premium Plans"], "status": "ok", "resolvers": {"ipv4": + "172.232.160.19, 172.232.160.21, 172.232.160.17, 172.232.160.15, 172.232.160.18, + 172.232.160.8, 172.232.160.12, 172.232.160.11, 172.232.160.14, 172.232.160.16", + "ipv6": "1234::5678, 1234::5678, 1234::5678, + 1234::5678, 1234::5678, 1234::5678, + 1234::5678, 1234::5678, 1234::5678, + 1234::5678"}, "placement_group_limits": {"maximum_pgs_per_customer": + 5, "maximum_linodes_per_pg": 5}, "site_type": "core"}, {"id": "br-gru", "label": + "Sao Paulo, BR", "country": "br", "capabilities": ["Linodes", "Backups", "NodeBalancers", + "Block Storage", "Object Storage", "Kubernetes", "Cloud Firewall", "Vlans", + "VPCs", "Metadata", "Premium Plans"], "status": "ok", "resolvers": {"ipv4": + "172.233.0.4, 172.233.0.9, 172.233.0.7, 172.233.0.12, 172.233.0.5, 172.233.0.13, + 172.233.0.10, 172.233.0.6, 172.233.0.8, 172.233.0.11", "ipv6": "1234::5678, + 1234::5678, 1234::5678, 1234::5678, + 1234::5678, 1234::5678, 1234::5678, + 1234::5678, 1234::5678, 1234::5678"}, + "placement_group_limits": {"maximum_pgs_per_customer": 5, "maximum_linodes_per_pg": + 5}, "site_type": "core"}, {"id": "nl-ams", "label": "Amsterdam, NL", "country": + "nl", "capabilities": ["Linodes", "Backups", "NodeBalancers", "Block Storage", + "Object Storage", "Kubernetes", "Cloud Firewall", "Vlans", "VPCs", "Metadata", + "Premium Plans"], "status": "ok", "resolvers": {"ipv4": "172.233.33.36, 172.233.33.38, + 172.233.33.35, 172.233.33.39, 172.233.33.34, 172.233.33.33, 172.233.33.31, 172.233.33.30, + 172.233.33.37, 172.233.33.32", "ipv6": "1234::5678, 1234::5678, + 1234::5678, 1234::5678, 1234::5678, + 1234::5678, 1234::5678, 1234::5678, + 1234::5678, 1234::5678"}, "placement_group_limits": + {"maximum_pgs_per_customer": 5, "maximum_linodes_per_pg": 5}, "site_type": "core"}, + {"id": "se-sto", "label": "Stockholm, SE", "country": "se", "capabilities": + ["Linodes", "Backups", "NodeBalancers", "Block Storage", "Object Storage", "Kubernetes", + "Cloud Firewall", "Vlans", "VPCs", "Metadata", "Premium Plans"], "status": "ok", + "resolvers": {"ipv4": "172.232.128.24, 172.232.128.26, 172.232.128.20, 172.232.128.22, + 172.232.128.25, 172.232.128.19, 172.232.128.23, 172.232.128.18, 172.232.128.21, + 172.232.128.27", "ipv6": "1234::5678, 1234::5678, + 1234::5678, 1234::5678, 1234::5678, + 1234::5678, 1234::5678, 1234::5678, + 1234::5678, 1234::5678"}, "placement_group_limits": + {"maximum_pgs_per_customer": 5, "maximum_linodes_per_pg": 5}, "site_type": "core"}, + {"id": "es-mad", "label": "Madrid, ES", "country": "es", "capabilities": ["Linodes", + "Backups", "NodeBalancers", "Block Storage", "Object Storage", "Kubernetes", + "Cloud Firewall", "Vlans", "VPCs", "Metadata", "Premium Plans"], "status": "ok", + "resolvers": {"ipv4": "172.233.111.6, 172.233.111.17, 172.233.111.21, 172.233.111.25, + 172.233.111.19, 172.233.111.12, 172.233.111.26, 172.233.111.16, 172.233.111.18, + 172.233.111.9", "ipv6": "1234::5678, 1234::5678, + 1234::5678, 1234::5678, 1234::5678, + 1234::5678, 1234::5678, 1234::5678, + 1234::5678, 1234::5678"}, "placement_group_limits": + {"maximum_pgs_per_customer": 5, "maximum_linodes_per_pg": 5}, "site_type": "core"}, + {"id": "in-maa", "label": "Chennai, IN", "country": "in", "capabilities": ["Linodes", + "Backups", "NodeBalancers", "Block Storage", "Object Storage", "Kubernetes", + "Cloud Firewall", "Vlans", "VPCs", "Metadata", "Premium Plans"], "status": "ok", + "resolvers": {"ipv4": "172.232.96.17, 172.232.96.26, 172.232.96.19, 172.232.96.20, + 172.232.96.25, 172.232.96.21, 172.232.96.18, 172.232.96.22, 172.232.96.23, 172.232.96.24", + "ipv6": "1234::5678, 1234::5678, 1234::5678, + 1234::5678, 1234::5678, 1234::5678, + 1234::5678, 1234::5678, 1234::5678, + 1234::5678"}, "placement_group_limits": {"maximum_pgs_per_customer": + 5, "maximum_linodes_per_pg": 5}, "site_type": "core"}, {"id": "jp-osa", "label": + "Osaka, JP", "country": "jp", "capabilities": ["Linodes", "Backups", "NodeBalancers", + "Block Storage", "Object Storage", "Kubernetes", "Cloud Firewall", "Vlans", + "VPCs", "Metadata", "Premium Plans"], "status": "ok", "resolvers": {"ipv4": + "172.233.64.44, 172.233.64.43, 172.233.64.37, 172.233.64.40, 172.233.64.46, + 172.233.64.41, 172.233.64.39, 172.233.64.42, 172.233.64.45, 172.233.64.38", + "ipv6": "1234::5678, 1234::5678, 1234::5678, + 1234::5678, 1234::5678, 1234::5678, + 1234::5678, 1234::5678, 1234::5678, + 1234::5678"}, "placement_group_limits": {"maximum_pgs_per_customer": + 5, "maximum_linodes_per_pg": 5}, "site_type": "core"}, {"id": "it-mil", "label": + "Milan, IT", "country": "it", "capabilities": ["Linodes", "Backups", "NodeBalancers", + "Block Storage", "Object Storage", "Kubernetes", "Cloud Firewall", "Vlans", + "VPCs", "Metadata", "Premium Plans"], "status": "ok", "resolvers": {"ipv4": + "172.232.192.19, 172.232.192.18, 172.232.192.16, 172.232.192.20, 172.232.192.24, + 172.232.192.21, 172.232.192.22, 172.232.192.17, 172.232.192.15, 172.232.192.23", + "ipv6": "1234::5678, 1234::5678, 1234::5678, + 1234::5678, 1234::5678, 1234::5678, + 1234::5678, 1234::5678, 1234::5678, + 1234::5678"}, "placement_group_limits": {"maximum_pgs_per_customer": + 5, "maximum_linodes_per_pg": 5}, "site_type": "core"}, {"id": "us-mia", "label": + "Miami, FL", "country": "us", "capabilities": ["Linodes", "Backups", "NodeBalancers", + "Block Storage", "Object Storage", "Kubernetes", "Cloud Firewall", "Vlans", + "VPCs", "Metadata", "Premium Plans"], "status": "ok", "resolvers": {"ipv4": + "172.233.160.34, 172.233.160.27, 172.233.160.30, 172.233.160.29, 172.233.160.32, + 172.233.160.28, 172.233.160.33, 172.233.160.26, 172.233.160.25, 172.233.160.31", + "ipv6": "1234::5678, 1234::5678, 1234::5678, + 1234::5678, 1234::5678, 1234::5678, + 1234::5678, 1234::5678, 1234::5678, + 1234::5678"}, "placement_group_limits": {"maximum_pgs_per_customer": + 5, "maximum_linodes_per_pg": 5}, "site_type": "core"}, {"id": "id-cgk", "label": + "Jakarta, ID", "country": "id", "capabilities": ["Linodes", "Backups", "NodeBalancers", + "Block Storage", "Object Storage", "Kubernetes", "Cloud Firewall", "Vlans", + "VPCs", "Metadata", "Premium Plans"], "status": "ok", "resolvers": {"ipv4": + "172.232.224.23, 172.232.224.32, 172.232.224.26, 172.232.224.27, 172.232.224.21, + 172.232.224.24, 172.232.224.22, 172.232.224.20, 172.232.224.31, 172.232.224.28", + "ipv6": "1234::5678, 1234::5678, 1234::5678, + 1234::5678, 1234::5678, 1234::5678, + 1234::5678, 1234::5678, 1234::5678, + 1234::5678"}, "placement_group_limits": {"maximum_pgs_per_customer": + 5, "maximum_linodes_per_pg": 5}, "site_type": "core"}, {"id": "us-lax", "label": + "Los Angeles, CA", "country": "us", "capabilities": ["Linodes", "Backups", "NodeBalancers", + "Block Storage", "Object Storage", "Kubernetes", "Cloud Firewall", "Vlans", + "VPCs", "Metadata", "Premium Plans"], "status": "ok", "resolvers": {"ipv4": + "172.233.128.45, 172.233.128.38, 172.233.128.53, 172.233.128.37, 172.233.128.34, + 172.233.128.36, 172.233.128.33, 172.233.128.39, 172.233.128.43, 172.233.128.44", + "ipv6": "1234::5678, 1234::5678, 1234::5678, + 1234::5678, 1234::5678, 1234::5678, + 1234::5678, 1234::5678, 1234::5678, + 1234::5678"}, "placement_group_limits": {"maximum_pgs_per_customer": + 5, "maximum_linodes_per_pg": 5}, "site_type": "core"}, {"id": "us-central", + "label": "Dallas, TX", "country": "us", "capabilities": ["Linodes", "Backups", + "NodeBalancers", "Block Storage", "Kubernetes", "Cloud Firewall", "Vlans", "Block + Storage Migrations", "Managed Databases"], "status": "ok", "resolvers": {"ipv4": + "72.14.179.5, 72.14.188.5, 173.255.199.5, 66.228.53.5, 96.126.122.5, 96.126.124.5, + 96.126.127.5, 198.58.107.5, 198.58.111.5, 23.239.24.5", "ipv6": "1234::5678, + 1234::5678, 1234::5678, 1234::5678, 1234::5678, 1234::5678, 1234::5678, + 1234::5678, 1234::5678, 1234::5678"}, "placement_group_limits": {"maximum_pgs_per_customer": + 5, "maximum_linodes_per_pg": 5}, "site_type": "core"}, {"id": "us-west", "label": + "Fremont, CA", "country": "us", "capabilities": ["Linodes", "Backups", "NodeBalancers", + "Block Storage", "Kubernetes", "Cloud Firewall", "Vlans", "Block Storage Migrations", + "Managed Databases"], "status": "ok", "resolvers": {"ipv4": "173.230.145.5, + 173.230.147.5, 173.230.155.5, 173.255.212.5, 173.255.219.5, 173.255.241.5, 173.255.243.5, + 173.255.244.5, 74.207.241.5, 74.207.242.5", "ipv6": "1234::5678, 1234::5678, + 1234::5678, 1234::5678, 1234::5678, 1234::5678, 1234::5678, 1234::5678, + 1234::5678, 1234::5678"}, "placement_group_limits": {"maximum_pgs_per_customer": + 5, "maximum_linodes_per_pg": 5}, "site_type": "core"}, {"id": "us-southeast", + "label": "Atlanta, GA", "country": "us", "capabilities": ["Linodes", "Backups", + "NodeBalancers", "Block Storage", "Object Storage", "GPU Linodes", "Kubernetes", + "Cloud Firewall", "Vlans", "Block Storage Migrations", "Managed Databases"], + "status": "ok", "resolvers": {"ipv4": "74.207.231.5, 173.230.128.5, 173.230.129.5, + 173.230.136.5, 173.230.140.5, 66.228.59.5, 66.228.62.5, 50.116.35.5, 50.116.41.5, + 23.239.18.5", "ipv6": "1234::5678, 1234::5678, 1234::5678, 1234::5678, + 1234::5678, 1234::5678, 1234::5678, 1234::5678, 1234::5678, 1234::5678"}, + "placement_group_limits": {"maximum_pgs_per_customer": 5, "maximum_linodes_per_pg": + 5}, "site_type": "core"}, {"id": "us-east", "label": "Newark, NJ", "country": + "us", "capabilities": ["Linodes", "Backups", "NodeBalancers", "Block Storage", + "Object Storage", "GPU Linodes", "Kubernetes", "Cloud Firewall", "Vlans", "Block + Storage Migrations", "Managed Databases"], "status": "ok", "resolvers": {"ipv4": + "66.228.42.5, 96.126.106.5, 50.116.53.5, 50.116.58.5, 50.116.61.5, 50.116.62.5, + 66.175.211.5, 97.107.133.4, 207.192.69.4, 207.192.69.5", "ipv6": "1234::5678, + 1234::5678, 1234::5678, 1234::5678, 1234::5678, 1234::5678, 1234::5678, + 1234::5678, 1234::5678, 1234::5678"}, "placement_group_limits": {"maximum_pgs_per_customer": + 5, "maximum_linodes_per_pg": 5}, "site_type": "core"}, {"id": "eu-west", "label": + "London, UK", "country": "gb", "capabilities": ["Linodes", "Backups", "NodeBalancers", + "Block Storage", "Kubernetes", "Cloud Firewall", "Vlans", "Block Storage Migrations", + "Managed Databases"], "status": "ok", "resolvers": {"ipv4": "178.79.182.5, 176.58.107.5, + 176.58.116.5, 176.58.121.5, 151.236.220.5, 212.71.252.5, 212.71.253.5, 109.74.192.20, + 109.74.193.20, 109.74.194.20", "ipv6": "1234::5678, 1234::5678, 1234::5678, + 1234::5678, 1234::5678, 1234::5678, 1234::5678, 1234::5678, 1234::5678, + 1234::5678"}, "placement_group_limits": {"maximum_pgs_per_customer": 5, "maximum_linodes_per_pg": + 5}, "site_type": "core"}, {"id": "ap-south", "label": "Singapore, SG", "country": + "sg", "capabilities": ["Linodes", "Backups", "NodeBalancers", "Block Storage", + "Object Storage", "GPU Linodes", "Kubernetes", "Cloud Firewall", "Vlans", "Block + Storage Migrations", "Managed Databases"], "status": "ok", "resolvers": {"ipv4": + "139.162.11.5, 139.162.13.5, 139.162.14.5, 139.162.15.5, 139.162.16.5, 139.162.21.5, + 139.162.27.5, 103.3.60.18, 103.3.60.19, 103.3.60.20", "ipv6": "1234::5678, + 1234::5678, 1234::5678, 1234::5678, 1234::5678, 1234::5678, 1234::5678, + 1234::5678, 1234::5678, 1234::5678"}, "placement_group_limits": {"maximum_pgs_per_customer": + 5, "maximum_linodes_per_pg": 5}, "site_type": "core"}, {"id": "eu-central", + "label": "Frankfurt, DE", "country": "de", "capabilities": ["Linodes", "Backups", + "NodeBalancers", "Block Storage", "Object Storage", "GPU Linodes", "Kubernetes", + "Cloud Firewall", "Vlans", "Block Storage Migrations", "Managed Databases"], + "status": "ok", "resolvers": {"ipv4": "139.162.130.5, 139.162.131.5, 139.162.132.5, + 139.162.133.5, 139.162.134.5, 139.162.135.5, 139.162.136.5, 139.162.137.5, 139.162.138.5, + 139.162.139.5", "ipv6": "1234::5678, 1234::5678, 1234::5678, 1234::5678, + 1234::5678, 1234::5678, 1234::5678, 1234::5678, 1234::5678, 1234::5678"}, + "placement_group_limits": {"maximum_pgs_per_customer": 5, "maximum_linodes_per_pg": + 5}, "site_type": "core"}, {"id": "ap-northeast", "label": "Tokyo, JP", "country": + "jp", "capabilities": ["Linodes", "Backups", "NodeBalancers", "Block Storage", + "Kubernetes", "Cloud Firewall", "Vlans", "Block Storage Migrations", "Managed + Databases"], "status": "ok", "resolvers": {"ipv4": "139.162.66.5, 139.162.67.5, + 139.162.68.5, 139.162.69.5, 139.162.70.5, 139.162.71.5, 139.162.72.5, 139.162.73.5, + 139.162.74.5, 139.162.75.5", "ipv6": "1234::5678, 1234::5678, 1234::5678, + 1234::5678, 1234::5678, 1234::5678, 1234::5678, 1234::5678, 1234::5678, + 1234::5678"}, "placement_group_limits": {"maximum_pgs_per_customer": 5, "maximum_linodes_per_pg": + 5}, "site_type": "core"}], "page": 1, "pages": 1, "results": 25}' + headers: + Access-Control-Allow-Credentials: + - "true" + Access-Control-Allow-Headers: + - Authorization, Origin, X-Requested-With, Content-Type, Accept, X-Filter + Access-Control-Allow-Methods: + - HEAD, GET, OPTIONS, POST, PUT, DELETE + Access-Control-Allow-Origin: + - '*' + Access-Control-Expose-Headers: + - X-OAuth-Scopes, X-Accepted-OAuth-Scopes, X-Status + Cache-Control: + - max-age=0, no-cache, no-store + Connection: + - keep-alive + Content-Security-Policy: + - default-src 'none' + Content-Type: + - application/json + Expires: + - Mon, 29 Apr 2024 17:28:41 GMT + Pragma: + - no-cache + Strict-Transport-Security: + - max-age=31536000 + Vary: + - Authorization, X-Filter + - Authorization, X-Filter + - Accept-Encoding + X-Accepted-Oauth-Scopes: + - '*' + X-Content-Type-Options: + - nosniff + X-Frame-Options: + - DENY + - DENY + X-Oauth-Scopes: + - '*' + X-Ratelimit-Limit: + - "400" + X-Xss-Protection: + - 1; mode=block + status: 200 OK + code: 200 + duration: "" +- request: + body: '{"node_pools":[{"count":1,"type":"g6-standard-2","disks":null,"tags":["test"]}],"label":"go-test-def","region":"ap-west","k8s_version":"1.29","tags":["testing"],"control_plane":{"acl":{"enabled":true,"addresses":{"ipv4":["10.0.0.1/32"],"ipv6":["1234::5678"]}}}}' + form: {} + headers: + Accept: + - application/json + Content-Type: + - application/json + User-Agent: + - linodego/dev https://github.com/linode/linodego + url: https://api.linode.com/v4beta/lke/clusters + method: POST + response: + body: '{"id": 173796, "status": "ready", "created": "2018-01-02T03:04:05", "updated": + "2018-01-02T03:04:05", "label": "go-test-def", "region": "ap-west", "k8s_version": + "1.29", "control_plane": {"high_availability": false}, "tags": ["testing"]}' + headers: + Access-Control-Allow-Credentials: + - "true" + Access-Control-Allow-Headers: + - Authorization, Origin, X-Requested-With, Content-Type, Accept, X-Filter + Access-Control-Allow-Methods: + - HEAD, GET, OPTIONS, POST, PUT, DELETE + Access-Control-Allow-Origin: + - '*' + Access-Control-Expose-Headers: + - X-OAuth-Scopes, X-Accepted-OAuth-Scopes, X-Status + Cache-Control: + - max-age=0, no-cache, no-store + Connection: + - keep-alive + Content-Length: + - "237" + Content-Security-Policy: + - default-src 'none' + Content-Type: + - application/json + Expires: + - Mon, 29 Apr 2024 17:29:09 GMT + Pragma: + - no-cache + Strict-Transport-Security: + - max-age=31536000 + Vary: + - Authorization, X-Filter + X-Accepted-Oauth-Scopes: + - lke:read_write + X-Content-Type-Options: + - nosniff + X-Frame-Options: + - DENY + - DENY + X-Oauth-Scopes: + - '*' + X-Ratelimit-Limit: + - "400" + X-Xss-Protection: + - 1; mode=block + status: 200 OK + code: 200 + duration: "" +- request: + body: "" + form: {} + headers: + Accept: + - application/json + Content-Type: + - application/json + User-Agent: + - linodego/dev https://github.com/linode/linodego + url: https://api.linode.com/v4beta/lke/clusters/173796/control_plane_acl + method: GET + response: + body: '{"acl": {"enabled": true, "addresses": {"ipv4": ["10.0.0.1/32"], "ipv6": + ["1234::5678/128"]}}}' + headers: + Access-Control-Allow-Credentials: + - "true" + Access-Control-Allow-Headers: + - Authorization, Origin, X-Requested-With, Content-Type, Accept, X-Filter + Access-Control-Allow-Methods: + - HEAD, GET, OPTIONS, POST, PUT, DELETE + Access-Control-Allow-Origin: + - '*' + Access-Control-Expose-Headers: + - X-OAuth-Scopes, X-Accepted-OAuth-Scopes, X-Status + Cache-Control: + - max-age=0, no-cache, no-store + Connection: + - keep-alive + Content-Length: + - "94" + Content-Security-Policy: + - default-src 'none' + Content-Type: + - application/json + Expires: + - Mon, 29 Apr 2024 17:29:10 GMT + Pragma: + - no-cache + Strict-Transport-Security: + - max-age=31536000 + Vary: + - Authorization, X-Filter + - Authorization, X-Filter + X-Accepted-Oauth-Scopes: + - lke:read_only + X-Content-Type-Options: + - nosniff + X-Frame-Options: + - DENY + - DENY + X-Oauth-Scopes: + - '*' + X-Ratelimit-Limit: + - "400" + X-Xss-Protection: + - 1; mode=block + status: 200 OK + code: 200 + duration: "" +- request: + body: '{"acl":{"enabled":true,"addresses":{"ipv4":["10.0.0.2/32"]}}}' + form: {} + headers: + Accept: + - application/json + Content-Type: + - application/json + User-Agent: + - linodego/dev https://github.com/linode/linodego + url: https://api.linode.com/v4beta/lke/clusters/173796/control_plane_acl + method: PUT + response: + body: '{"acl": {"enabled": true, "addresses": {"ipv4": ["10.0.0.2/32"]}}}' + headers: + Access-Control-Allow-Credentials: + - "true" + Access-Control-Allow-Headers: + - Authorization, Origin, X-Requested-With, Content-Type, Accept, X-Filter + Access-Control-Allow-Methods: + - HEAD, GET, OPTIONS, POST, PUT, DELETE + Access-Control-Allow-Origin: + - '*' + Access-Control-Expose-Headers: + - X-OAuth-Scopes, X-Accepted-OAuth-Scopes, X-Status + Cache-Control: + - max-age=0, no-cache, no-store + Connection: + - keep-alive + Content-Length: + - "66" + Content-Security-Policy: + - default-src 'none' + Content-Type: + - application/json + Expires: + - Mon, 29 Apr 2024 17:29:13 GMT + Pragma: + - no-cache + Strict-Transport-Security: + - max-age=31536000 + Vary: + - Authorization, X-Filter + X-Accepted-Oauth-Scopes: + - lke:read_write + X-Content-Type-Options: + - nosniff + X-Frame-Options: + - DENY + - DENY + X-Oauth-Scopes: + - '*' + X-Ratelimit-Limit: + - "400" + X-Xss-Protection: + - 1; mode=block + status: 200 OK + code: 200 + duration: "" +- request: + body: "" + form: {} + headers: + Accept: + - application/json + Content-Type: + - application/json + User-Agent: + - linodego/dev https://github.com/linode/linodego + url: https://api.linode.com/v4beta/lke/clusters/173796/control_plane_acl + method: DELETE + response: + body: '{}' + headers: + Access-Control-Allow-Credentials: + - "true" + Access-Control-Allow-Headers: + - Authorization, Origin, X-Requested-With, Content-Type, Accept, X-Filter + Access-Control-Allow-Methods: + - HEAD, GET, OPTIONS, POST, PUT, DELETE + Access-Control-Allow-Origin: + - '*' + Access-Control-Expose-Headers: + - X-OAuth-Scopes, X-Accepted-OAuth-Scopes, X-Status + Cache-Control: + - max-age=0, no-cache, no-store + Connection: + - keep-alive + Content-Length: + - "2" + Content-Security-Policy: + - default-src 'none' + Content-Type: + - application/json + Expires: + - Mon, 29 Apr 2024 17:29:15 GMT + Pragma: + - no-cache + Strict-Transport-Security: + - max-age=31536000 + Vary: + - Authorization, X-Filter + X-Accepted-Oauth-Scopes: + - lke:read_write + X-Content-Type-Options: + - nosniff + X-Frame-Options: + - DENY + - DENY + X-Oauth-Scopes: + - '*' + X-Ratelimit-Limit: + - "400" + X-Xss-Protection: + - 1; mode=block + status: 200 OK + code: 200 + duration: "" +- request: + body: "" + form: {} + headers: + Accept: + - application/json + Content-Type: + - application/json + User-Agent: + - linodego/dev https://github.com/linode/linodego + url: https://api.linode.com/v4beta/lke/clusters/173796/control_plane_acl + method: GET + response: + body: '{"acl": {"enabled": false, "addresses": null}}' + headers: + Access-Control-Allow-Credentials: + - "true" + Access-Control-Allow-Headers: + - Authorization, Origin, X-Requested-With, Content-Type, Accept, X-Filter + Access-Control-Allow-Methods: + - HEAD, GET, OPTIONS, POST, PUT, DELETE + Access-Control-Allow-Origin: + - '*' + Access-Control-Expose-Headers: + - X-OAuth-Scopes, X-Accepted-OAuth-Scopes, X-Status + Cache-Control: + - max-age=0, no-cache, no-store + Connection: + - keep-alive + Content-Length: + - "46" + Content-Security-Policy: + - default-src 'none' + Content-Type: + - application/json + Expires: + - Mon, 29 Apr 2024 17:29:16 GMT + Pragma: + - no-cache + Strict-Transport-Security: + - max-age=31536000 + Vary: + - Authorization, X-Filter + - Authorization, X-Filter + X-Accepted-Oauth-Scopes: + - lke:read_only + X-Content-Type-Options: + - nosniff + X-Frame-Options: + - DENY + - DENY + X-Oauth-Scopes: + - '*' + X-Ratelimit-Limit: + - "400" + X-Xss-Protection: + - 1; mode=block + status: 200 OK + code: 200 + duration: "" +- request: + body: "" + form: {} + headers: + Accept: + - application/json + Content-Type: + - application/json + User-Agent: + - linodego/dev https://github.com/linode/linodego + url: https://api.linode.com/v4beta/lke/clusters/173796 + method: DELETE + response: + body: '{}' + headers: + Access-Control-Allow-Credentials: + - "true" + Access-Control-Allow-Headers: + - Authorization, Origin, X-Requested-With, Content-Type, Accept, X-Filter + Access-Control-Allow-Methods: + - HEAD, GET, OPTIONS, POST, PUT, DELETE + Access-Control-Allow-Origin: + - '*' + Access-Control-Expose-Headers: + - X-OAuth-Scopes, X-Accepted-OAuth-Scopes, X-Status + Cache-Control: + - max-age=0, no-cache, no-store + Connection: + - keep-alive + Content-Length: + - "2" + Content-Security-Policy: + - default-src 'none' + Content-Type: + - application/json + Expires: + - Mon, 29 Apr 2024 17:29:38 GMT + Pragma: + - no-cache + Strict-Transport-Security: + - max-age=31536000 + Vary: + - Authorization, X-Filter + X-Accepted-Oauth-Scopes: + - lke:read_write + X-Content-Type-Options: + - nosniff + X-Frame-Options: + - DENY + - DENY + X-Oauth-Scopes: + - '*' + X-Ratelimit-Limit: + - "400" + X-Xss-Protection: + - 1; mode=block + status: 200 OK + code: 200 + duration: "" diff --git a/test/integration/lke_clusters_acl_test.go b/test/integration/lke_clusters_acl_test.go new file mode 100644 index 000000000..6d85b74bf --- /dev/null +++ b/test/integration/lke_clusters_acl_test.go @@ -0,0 +1,69 @@ +package integration + +import ( + "context" + "testing" + + "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" + + "github.com/linode/linodego" +) + +func TestLKECluster_withACL(t *testing.T) { + valueTrue := true + + client, cluster, teardown, err := setupLKECluster( + t, + []clusterModifier{ + func(options *linodego.LKEClusterCreateOptions) { + options.ControlPlane = &linodego.LKEClusterControlPlaneOptions{ + ACL: &linodego.LKEClusterControlPlaneACLOptions{ + Enabled: &valueTrue, + Addresses: &linodego.LKEClusterControlPlaneACLAddressesOptions{ + IPv4: &[]string{"10.0.0.1/32"}, + IPv6: &[]string{"1234::5678"}, + }, + }, + } + }, + }, + "fixtures/TestLKECluster_withACL", + ) + require.NoError(t, err) + defer teardown() + + acl, err := client.GetLKEClusterControlPlaneACL(context.Background(), cluster.ID) + assert.NoError(t, err) + + require.Equal(t, true, acl.ACL.Enabled) + require.Equal(t, "10.0.0.1/32", acl.ACL.Addresses.IPv4[0]) + require.Equal(t, "1234::5678/128", acl.ACL.Addresses.IPv6[0]) + + acl, err = client.UpdateLKEClusterControlPlaneACL( + context.Background(), + cluster.ID, + linodego.LKEClusterControlPlaneACLUpdateOptions{ + ACL: linodego.LKEClusterControlPlaneACLOptions{ + Enabled: &valueTrue, + Addresses: &linodego.LKEClusterControlPlaneACLAddressesOptions{ + IPv4: &[]string{"10.0.0.2/32"}, + IPv6: &[]string{}, + }, + }, + }, + ) + require.NoError(t, err) + + require.Equal(t, true, acl.ACL.Enabled) + require.Equal(t, "10.0.0.2/32", acl.ACL.Addresses.IPv4[0]) + require.Equal(t, 0, len(acl.ACL.Addresses.IPv6)) + + err = client.DeleteLKEClusterControlPlaneACL(context.Background(), cluster.ID) + require.NoError(t, err) + + acl, err = client.GetLKEClusterControlPlaneACL(context.Background(), cluster.ID) + assert.NoError(t, err) + + assert.Equal(t, false, acl.ACL.Enabled) +} diff --git a/test/integration/lke_clusters_test.go b/test/integration/lke_clusters_test.go index 0e4e6a1f4..244ffdcd6 100644 --- a/test/integration/lke_clusters_test.go +++ b/test/integration/lke_clusters_test.go @@ -75,7 +75,10 @@ func TestLKECluster_Update(t *testing.T) { updatedTags := []string{"test=true"} updatedLabel := cluster.Label + "-updated" updatedK8sVersion := "1.23" - updatedControlPlane := &linodego.LKEClusterControlPlane{HighAvailability: true} + isHA := true + + updatedControlPlane := &linodego.LKEClusterControlPlaneOptions{HighAvailability: &isHA} + updatedCluster, err := client.UpdateLKECluster(context.TODO(), cluster.ID, linodego.LKEClusterUpdateOptions{ Tags: &updatedTags, Label: updatedLabel, @@ -98,7 +101,7 @@ func TestLKECluster_Update(t *testing.T) { t.Errorf("expected tags to be updated to %#v; got %#v", updatedTags, updatedCluster.Tags) } - if !reflect.DeepEqual(*updatedControlPlane, updatedCluster.ControlPlane) { + if !reflect.DeepEqual(*updatedControlPlane.HighAvailability, updatedCluster.ControlPlane.HighAvailability) { t.Errorf("expected control plane to be updated to %#v; got %#v", updatedControlPlane, updatedCluster.ControlPlane) } } @@ -254,7 +257,7 @@ func setupLKECluster(t *testing.T, clusterModifiers []clusterModifier, fixturesY createOpts := linodego.LKEClusterCreateOptions{ Label: label, Region: getRegionsWithCaps(t, client, []string{"Kubernetes"})[0], - K8sVersion: "1.23", + K8sVersion: "1.29", Tags: []string{"testing"}, NodePools: []linodego.LKENodePoolCreateOptions{{Count: 1, Type: "g6-standard-2", Tags: []string{"test"}}}, }