diff --git a/castai/cluster.go b/castai/cluster.go index c8933f90..6780449b 100644 --- a/castai/cluster.go +++ b/castai/cluster.go @@ -17,6 +17,8 @@ import ( const ( FieldDeleteNodesOnDisconnect = "delete_nodes_on_disconnect" FieldClusterCredentialsId = "credentials_id" + FieldClusterID = "cluster_id" + FieldClusterToken = "cluster_token" ) func resourceCastaiClusterDelete(ctx context.Context, data *schema.ResourceData, meta interface{}) diag.Diagnostics { diff --git a/castai/data_source_eks_cluster_id.go b/castai/data_source_eks_cluster_id.go deleted file mode 100644 index 42947390..00000000 --- a/castai/data_source_eks_cluster_id.go +++ /dev/null @@ -1,46 +0,0 @@ -package castai - -import ( - "context" - "errors" - - "github.com/hashicorp/terraform-plugin-sdk/v2/diag" - "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" - "github.com/hashicorp/terraform-plugin-sdk/v2/helper/validation" -) - -const ( - EKSClusterIDFieldAccountId = "account_id" - EKSClusterIDFieldRegion = "region" - EKSClusterIDFieldClusterName = "cluster_name" -) - -// Deprecated. -func dataSourceEKSClusterID() *schema.Resource { - return &schema.Resource{ - DeprecationMessage: `Use castai_eks_clusterid resource instead`, - ReadContext: func(ctx context.Context, data *schema.ResourceData, i interface{}) diag.Diagnostics { - return diag.FromErr(errors.New("use castai_eks_clusterid resource instead")) - }, - Schema: map[string]*schema.Schema{ - EKSClusterIDFieldAccountId: { - Type: schema.TypeString, - Required: true, - ForceNew: true, - ValidateDiagFunc: validation.ToDiagFunc(validation.StringIsNotWhiteSpace), - }, - EKSClusterIDFieldRegion: { - Type: schema.TypeString, - Required: true, - ForceNew: true, - ValidateDiagFunc: validation.ToDiagFunc(validation.StringIsNotWhiteSpace), - }, - EKSClusterIDFieldClusterName: { - Type: schema.TypeString, - Required: true, - ForceNew: true, - ValidateDiagFunc: validation.ToDiagFunc(validation.StringIsNotWhiteSpace), - }, - }, - } -} diff --git a/castai/provider.go b/castai/provider.go index 872daf4a..8215af10 100644 --- a/castai/provider.go +++ b/castai/provider.go @@ -44,16 +44,12 @@ func Provider(version string) *schema.Provider { "castai_rebalancing_job": resourceRebalancingJob(), "castai_node_configuration": resourceNodeConfiguration(), "castai_node_configuration_default": resourceNodeConfigurationDefault(), - // TODO: remove with next major release. - "castai_cluster_token": resourceClusterToken(), }, DataSourcesMap: map[string]*schema.Resource{ "castai_eks_settings": dataSourceEKSSettings(), "castai_eks_user_arn": dataSourceEKSClusterUserARN(), "castai_gke_user_policies": dataSourceGKEPolicies(), - // TODO: remove with next major release. - "castai_eks_clusterid": dataSourceEKSClusterID(), }, ConfigureContextFunc: providerConfigure(version), diff --git a/castai/resource_cluster_token.go b/castai/resource_cluster_token.go deleted file mode 100644 index a30997c8..00000000 --- a/castai/resource_cluster_token.go +++ /dev/null @@ -1,46 +0,0 @@ -package castai - -import ( - "context" - "errors" - - "github.com/hashicorp/terraform-plugin-sdk/v2/diag" - "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" -) - -const ( - FieldClusterID = "cluster_id" - FieldClusterToken = "cluster_token" -) - -// Deprecated. -func resourceClusterToken() *schema.Resource { - return &schema.Resource{ - CreateContext: func(_ context.Context, _ *schema.ResourceData, _ interface{}) diag.Diagnostics { - return diag.FromErr(errors.New("use castai_eks_cluster.cluster_token instead")) - }, - ReadContext: func(_ context.Context, _ *schema.ResourceData, _ interface{}) diag.Diagnostics { - return diag.FromErr(errors.New("use castai_eks_cluster.cluster_token instead")) - }, - DeleteContext: func(_ context.Context, _ *schema.ResourceData, _ interface{}) diag.Diagnostics { - return nil - }, - DeprecationMessage: `Resource "cluster_token" will be deprecated in the next major release in favour of cluster resource attribute.`, - - Schema: map[string]*schema.Schema{ - FieldClusterID: { - Type: schema.TypeString, - Required: true, - ForceNew: true, - Description: "CAST AI cluster id", - }, - FieldClusterToken: { - Type: schema.TypeString, - Description: "computed value to store cluster token", - Computed: true, - Sensitive: true, - Deprecated: `Resource "cluster_token" will be deprecated in the next major release in favour of cluster resource attribute.`, - }, - }, - } -} diff --git a/castai/resource_node_configuration.go b/castai/resource_node_configuration.go index 6b418f6b..3e48d26f 100644 --- a/castai/resource_node_configuration.go +++ b/castai/resource_node_configuration.go @@ -195,7 +195,8 @@ func resourceNodeConfiguration() *schema.Resource { "imds_v1": { Type: schema.TypeBool, Optional: true, - Description: "Allow IMDSv1, the default is true", + Default: true, + Description: "When the value is true both IMDSv1 and IMDSv2 are enabled. Setting the value to false disables permanently IMDSv1 and might affect legacy workloads running on the node created with this configuration. The default is true if the flag isn't provided", }, "imds_hop_limit": { Type: schema.TypeInt, diff --git a/castai/sdk/api.gen.go b/castai/sdk/api.gen.go index f2d399f1..b2f177d3 100644 --- a/castai/sdk/api.gen.go +++ b/castai/sdk/api.gen.go @@ -1493,6 +1493,10 @@ type ScheduledrebalancingV1RebalancingOptions struct { // Defines the conditions which must be met in order to fully execute the plan. ExecutionConditions *ScheduledrebalancingV1ExecutionConditions `json:"executionConditions,omitempty"` + // Defines whether the nodes that failed to get drained until a predefined timeout, will be kept with a + // rebalancing.cast.ai/status=drain-failed annotation instead of forcefully drained. + KeepDrainTimeoutNodes *bool `json:"keepDrainTimeoutNodes"` + // Minimum number of nodes that should be kept in the cluster after rebalancing. MinNodes *int32 `json:"minNodes,omitempty"` } diff --git a/docs/resources/node_configuration.md b/docs/resources/node_configuration.md index 753b6b30..e3e61167 100644 --- a/docs/resources/node_configuration.md +++ b/docs/resources/node_configuration.md @@ -101,7 +101,7 @@ Optional: - `dns_cluster_ip` (String) IP address to use for DNS queries within the cluster - `imds_hop_limit` (Number) Allow configure the IMDSv2 hop limit, the default is 2 -- `imds_v1` (Boolean) Allow IMDSv1, the default is true +- `imds_v1` (Boolean) When the value is true both IMDSv1 and IMDSv2 are enabled. Setting the value to false disables permanently IMDSv1 and might affect legacy workloads running on the node created with this configuration. The default is true if the flag isn't provided - `key_pair_id` (String) AWS key pair ID to be used for CAST provisioned nodes. Has priority over ssh_public_key - `volume_iops` (Number) AWS EBS volume IOPS to be used for CAST provisioned nodes - `volume_throughput` (Number) AWS EBS volume throughput in MiB/s to be used for CAST provisioned nodes