From 0193bab9581dac1e902f7f3354d7df991c9034c8 Mon Sep 17 00:00:00 2001 From: Lachezar Tsonov Date: Thu, 27 Jun 2024 10:56:53 +0300 Subject: [PATCH] Use proper field when converting AKS config for OsDiskType (#346) * Use proper field when converting AKS config for OsDiskType * Update sdk to latest --- castai/resource_node_configuration.go | 2 +- castai/sdk/api.gen.go | 63 ++++++++++----------------- 2 files changed, 25 insertions(+), 40 deletions(-) diff --git a/castai/resource_node_configuration.go b/castai/resource_node_configuration.go index 5c8e6716..cb4e260f 100644 --- a/castai/resource_node_configuration.go +++ b/castai/resource_node_configuration.go @@ -816,7 +816,7 @@ func flattenAKSConfig(config *sdk.NodeconfigV1AKSConfig) []map[string]interface{ m["max_pods_per_node"] = *config.MaxPodsPerNode } - if v := config.MaxPodsPerNode; v != nil { + if v := config.OsDiskType; v != nil { m["os_disk_type"] = fromAKSDiskType(config.OsDiskType) } diff --git a/castai/sdk/api.gen.go b/castai/sdk/api.gen.go index e4f00acd..4bd337e4 100644 --- a/castai/sdk/api.gen.go +++ b/castai/sdk/api.gen.go @@ -160,16 +160,15 @@ const ( NodeconfigV1ContainerRuntimeUnspecified NodeconfigV1ContainerRuntime = "unspecified" ) -// Defines values for NodeconfigV1ImageFamily. +// Defines values for NodeconfigV1EKSConfigImageFamily. const ( - AL2 NodeconfigV1ImageFamily = "AL2" - AL2023 NodeconfigV1ImageFamily = "AL2023" - Al2 NodeconfigV1ImageFamily = "al2" - Al2023 NodeconfigV1ImageFamily = "al2023" - BOTTLEROCKET NodeconfigV1ImageFamily = "BOTTLEROCKET" - Bottlerocket NodeconfigV1ImageFamily = "bottlerocket" - FAMILYUNSPECIFIED NodeconfigV1ImageFamily = "FAMILY_UNSPECIFIED" - FamilyUnspecified NodeconfigV1ImageFamily = "family_unspecified" + FAMILYAL2 NodeconfigV1EKSConfigImageFamily = "FAMILY_AL2" + FAMILYAL2023 NodeconfigV1EKSConfigImageFamily = "FAMILY_AL2023" + FAMILYBOTTLEROCKET NodeconfigV1EKSConfigImageFamily = "FAMILY_BOTTLEROCKET" + FAMILYUNSPECIFIED NodeconfigV1EKSConfigImageFamily = "FAMILY_UNSPECIFIED" + FamilyAl2 NodeconfigV1EKSConfigImageFamily = "family_al2" + FamilyAl2023 NodeconfigV1EKSConfigImageFamily = "family_al2023" + FamilyBottlerocket NodeconfigV1EKSConfigImageFamily = "family_bottlerocket" ) // Defines values for NodetemplatesV1AvailableInstanceTypeOs. @@ -1955,8 +1954,15 @@ type NodeconfigV1DeleteConfigurationResponse = map[string]interface{} type NodeconfigV1EKSConfig struct { // IP address to use for DNS queries within the cluster. Defaults to 10.100.0.10 or 172.20.0.10 based on the IP address of the primary interface. DnsClusterIp *string `json:"dnsClusterIp"` - ImdsHopLimit *int32 `json:"imdsHopLimit"` - ImdsV1 *bool `json:"imdsV1"` + + // List of supported image families (OSes) for EKS. + // + // - FAMILY_AL2: Amazon Linux 2 (https://aws.amazon.com/amazon-linux-2/), EKS-specific. + // - FAMILY_AL2023: Amazon Linux 2023 (https://aws.amazon.com/linux/amazon-linux-2023/), EKS-specific. + // - FAMILY_BOTTLEROCKET: Bottlerocket (https://aws.amazon.com/bottlerocket/), EKS-specific. + ImageFamily *NodeconfigV1EKSConfigImageFamily `json:"imageFamily,omitempty"` + ImdsHopLimit *int32 `json:"imdsHopLimit"` + ImdsV1 *bool `json:"imdsV1"` // Cluster's instance profile ARN used for CAST provisioned nodes. InstanceProfileArn string `json:"instanceProfileArn"` @@ -1983,6 +1989,13 @@ type NodeconfigV1EKSConfig struct { VolumeType *string `json:"volumeType"` } +// List of supported image families (OSes) for EKS. +// +// - FAMILY_AL2: Amazon Linux 2 (https://aws.amazon.com/amazon-linux-2/), EKS-specific. +// - FAMILY_AL2023: Amazon Linux 2023 (https://aws.amazon.com/linux/amazon-linux-2023/), EKS-specific. +// - FAMILY_BOTTLEROCKET: Bottlerocket (https://aws.amazon.com/bottlerocket/), EKS-specific. +type NodeconfigV1EKSConfigImageFamily string + // NodeconfigV1GKEConfig defines model for nodeconfig.v1.GKEConfig. type NodeconfigV1GKEConfig struct { // Type of boot disk attached to the node. For available types please read official GCP docs(https://cloud.google.com/compute/docs/disks#pdspecs). @@ -2009,13 +2022,6 @@ type NodeconfigV1GetSuggestedConfigurationResponse struct { Subnets *[]NodeconfigV1SubnetDetails `json:"subnets,omitempty"` } -// List of supported image families to choose from. Values might be applicable to a specific cloud provider and will be rejected if the value is not supported. -// -// - AL2: Amazon Linux 2 (https://aws.amazon.com/amazon-linux-2/), EKS-specific. -// - AL2023: Amazon Linux 2023 (https://aws.amazon.com/linux/amazon-linux-2023/), EKS-specific. -// - BOTTLEROCKET: Bottlerocket (https://aws.amazon.com/bottlerocket/), EKS-specific. -type NodeconfigV1ImageFamily string - // NodeconfigV1KOPSConfig defines model for nodeconfig.v1.KOPSConfig. type NodeconfigV1KOPSConfig struct { // AWS key pair ID to be used for provisioned nodes. Has priority over sshPublicKey. @@ -2055,13 +2061,6 @@ type NodeconfigV1NewNodeConfiguration struct { // If both image and image family are empty, the latest image from a default family will be used, depending on the cloud provider. Image *string `json:"image"` - // List of supported image families to choose from. Values might be applicable to a specific cloud provider and will be rejected if the value is not supported. - // - // - AL2: Amazon Linux 2 (https://aws.amazon.com/amazon-linux-2/), EKS-specific. - // - AL2023: Amazon Linux 2023 (https://aws.amazon.com/linux/amazon-linux-2023/), EKS-specific. - // - BOTTLEROCKET: Bottlerocket (https://aws.amazon.com/bottlerocket/), EKS-specific. - ImageFamily *NodeconfigV1ImageFamily `json:"imageFamily,omitempty"` - // Init script to be run on your instance at launch. Should not contain any sensitive data. Value should be base64 encoded. InitScript *string `json:"initScript"` Kops *NodeconfigV1KOPSConfig `json:"kops,omitempty"` @@ -2122,13 +2121,6 @@ type NodeconfigV1NodeConfiguration struct { // If both image and image family are empty, the latest image from a default family will be used, depending on the cloud provider. Image *string `json:"image"` - // List of supported image families to choose from. Values might be applicable to a specific cloud provider and will be rejected if the value is not supported. - // - // - AL2: Amazon Linux 2 (https://aws.amazon.com/amazon-linux-2/), EKS-specific. - // - AL2023: Amazon Linux 2023 (https://aws.amazon.com/linux/amazon-linux-2023/), EKS-specific. - // - BOTTLEROCKET: Bottlerocket (https://aws.amazon.com/bottlerocket/), EKS-specific. - ImageFamily *NodeconfigV1ImageFamily `json:"imageFamily,omitempty"` - // Base64 encoded init script to be run on your instance at launch. InitScript *string `json:"initScript"` Kops *NodeconfigV1KOPSConfig `json:"kops,omitempty"` @@ -2186,13 +2178,6 @@ type NodeconfigV1NodeConfigurationUpdate struct { // If both image and image family are empty, the latest image from a default family will be used, depending on the cloud provider. Image *string `json:"image"` - // List of supported image families to choose from. Values might be applicable to a specific cloud provider and will be rejected if the value is not supported. - // - // - AL2: Amazon Linux 2 (https://aws.amazon.com/amazon-linux-2/), EKS-specific. - // - AL2023: Amazon Linux 2023 (https://aws.amazon.com/linux/amazon-linux-2023/), EKS-specific. - // - BOTTLEROCKET: Bottlerocket (https://aws.amazon.com/bottlerocket/), EKS-specific. - ImageFamily *NodeconfigV1ImageFamily `json:"imageFamily,omitempty"` - // Init script to be run on your instance at launch. Should not contain any sensitive data. Value should be base64 encoded. InitScript *string `json:"initScript"` Kops *NodeconfigV1KOPSConfig `json:"kops,omitempty"`