diff --git a/castai/sdk/api.gen.go b/castai/sdk/api.gen.go index f9080d74..64a0ef74 100644 --- a/castai/sdk/api.gen.go +++ b/castai/sdk/api.gen.go @@ -490,17 +490,6 @@ type CastaiInventoryV1beta1StorageInfoDevice struct { // - hdd: HDD. type CastaiInventoryV1beta1StorageInfoDeviceType string -// CastaiMetricsV1beta1ClusterMetrics defines model for castai.metrics.v1beta1.ClusterMetrics. -type CastaiMetricsV1beta1ClusterMetrics struct { - CpuAllocatableCores *float32 `json:"cpuAllocatableCores,omitempty"` - CpuRequestedCores *float32 `json:"cpuRequestedCores,omitempty"` - MemoryAllocatableGib *float32 `json:"memoryAllocatableGib,omitempty"` - MemoryRequestedGib *float32 `json:"memoryRequestedGib,omitempty"` - OnDemandNodesCount *int32 `json:"onDemandNodesCount,omitempty"` - SpotFallbackNodesCount *int32 `json:"spotFallbackNodesCount,omitempty"` - SpotNodesCount *int32 `json:"spotNodesCount,omitempty"` -} - // Operation object. type CastaiOperationsV1beta1Operation struct { // Operation creation timestamp in RFC3339Nano format. @@ -923,8 +912,7 @@ type ExternalclusterV1Cluster struct { KubernetesVersion *string `json:"kubernetesVersion"` // Method used to onboard the cluster, eg.: console, terraform. - ManagedBy *string `json:"managedBy,omitempty"` - Metrics *CastaiMetricsV1beta1ClusterMetrics `json:"metrics,omitempty"` + ManagedBy *string `json:"managedBy,omitempty"` // The name of the external cluster. Name *string `json:"name,omitempty"` @@ -1472,8 +1460,8 @@ type NodeconfigV1GKEConfig struct { DiskType *string `json:"diskType"` // Maximum number of pods that can be run on a node, which affects how many IP addresses you will need for each node. Defaults to 110. - // For Standard GKE clusters, you can run a maximum of 256 Pods on a node with a /23 range, not 512 as you might expect. This provides a buffer so that Pods don't become unschedulable due to a transient lack of IP addresses in the Pod IP range for a given node. - // For all ranges, at most half as many Pods can be scheduled as IP addresses in the range. + // For Standard GKE clusters, you can run a maximum of 256 Pods on a node with a /23 range, not 512 as you might expect. This provides a buffer so that Pods don't become unschedulable due to a + // transient lack of IP addresses in the Pod IP range for a given node. For all ranges, at most half as many Pods can be scheduled as IP addresses in the range. MaxPodsPerNode *int32 `json:"maxPodsPerNode,omitempty"` // Network tags to be added on a VM. Each tag must be 1-63 characters long, start with a lowercase letter and end with either a number or a lowercase letter. @@ -1881,7 +1869,8 @@ type NodetemplatesV1TemplateConstraints struct { // toleration. Spot *bool `json:"spot"` - // Allowed node configuration price increase when diversifying instance types. E.g. if the value is 10%, then the overall price of diversified instance types can be 10% higher than the price of the optimal configuration. + // Allowed node configuration price increase when diversifying instance types. E.g. if the value is 10%, then the overall price of diversified instance types can be 10% higher than the price of the + // optimal configuration. SpotDiversityPriceIncreaseLimitPercent *int32 `json:"spotDiversityPriceIncreaseLimitPercent"` // Enable/disable spot interruption predictions. @@ -2372,12 +2361,6 @@ type ScheduledRebalancingAPIUpdateRebalancingJobJSONBody = ScheduledrebalancingV // ScheduledRebalancingAPIPreviewRebalancingScheduleJSONBody defines parameters for ScheduledRebalancingAPIPreviewRebalancingSchedule. type ScheduledRebalancingAPIPreviewRebalancingScheduleJSONBody = ScheduledrebalancingV1RebalancingScheduleUpdate -// ExternalClusterAPIListClustersParams defines parameters for ExternalClusterAPIListClusters. -type ExternalClusterAPIListClustersParams struct { - // Include metrics with cluster response. - IncludeMetrics *bool `form:"includeMetrics,omitempty" json:"includeMetrics,omitempty"` -} - // ExternalClusterAPIRegisterClusterJSONBody defines parameters for ExternalClusterAPIRegisterCluster. type ExternalClusterAPIRegisterClusterJSONBody = ExternalclusterV1RegisterClusterRequest diff --git a/castai/sdk/client.gen.go b/castai/sdk/client.gen.go index 85a90ac5..b2ffd674 100644 --- a/castai/sdk/client.gen.go +++ b/castai/sdk/client.gen.go @@ -215,7 +215,7 @@ type ClientInterface interface { ScheduledRebalancingAPIPreviewRebalancingSchedule(ctx context.Context, clusterId string, body ScheduledRebalancingAPIPreviewRebalancingScheduleJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error) // ExternalClusterAPIListClusters request - ExternalClusterAPIListClusters(ctx context.Context, params *ExternalClusterAPIListClustersParams, reqEditors ...RequestEditorFn) (*http.Response, error) + ExternalClusterAPIListClusters(ctx context.Context, reqEditors ...RequestEditorFn) (*http.Response, error) // ExternalClusterAPIRegisterCluster request with any body ExternalClusterAPIRegisterClusterWithBody(ctx context.Context, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error) @@ -957,8 +957,8 @@ func (c *Client) ScheduledRebalancingAPIPreviewRebalancingSchedule(ctx context.C return c.Client.Do(req) } -func (c *Client) ExternalClusterAPIListClusters(ctx context.Context, params *ExternalClusterAPIListClustersParams, reqEditors ...RequestEditorFn) (*http.Response, error) { - req, err := NewExternalClusterAPIListClustersRequest(c.Server, params) +func (c *Client) ExternalClusterAPIListClusters(ctx context.Context, reqEditors ...RequestEditorFn) (*http.Response, error) { + req, err := NewExternalClusterAPIListClustersRequest(c.Server) if err != nil { return nil, err } @@ -3167,7 +3167,7 @@ func NewScheduledRebalancingAPIPreviewRebalancingScheduleRequestWithBody(server } // NewExternalClusterAPIListClustersRequest generates requests for ExternalClusterAPIListClusters -func NewExternalClusterAPIListClustersRequest(server string, params *ExternalClusterAPIListClustersParams) (*http.Request, error) { +func NewExternalClusterAPIListClustersRequest(server string) (*http.Request, error) { var err error serverURL, err := url.Parse(server) @@ -3185,26 +3185,6 @@ func NewExternalClusterAPIListClustersRequest(server string, params *ExternalClu return nil, err } - queryValues := queryURL.Query() - - if params.IncludeMetrics != nil { - - if queryFrag, err := runtime.StyleParamWithLocation("form", true, "includeMetrics", runtime.ParamLocationQuery, *params.IncludeMetrics); err != nil { - return nil, err - } else if parsed, err := url.ParseQuery(queryFrag); err != nil { - return nil, err - } else { - for k, v := range parsed { - for _, v2 := range v { - queryValues.Add(k, v2) - } - } - } - - } - - queryURL.RawQuery = queryValues.Encode() - req, err := http.NewRequest("GET", queryURL.String(), nil) if err != nil { return nil, err @@ -5508,7 +5488,7 @@ type ClientWithResponsesInterface interface { ScheduledRebalancingAPIPreviewRebalancingScheduleWithResponse(ctx context.Context, clusterId string, body ScheduledRebalancingAPIPreviewRebalancingScheduleJSONRequestBody) (*ScheduledRebalancingAPIPreviewRebalancingScheduleResponse, error) // ExternalClusterAPIListClusters request - ExternalClusterAPIListClustersWithResponse(ctx context.Context, params *ExternalClusterAPIListClustersParams) (*ExternalClusterAPIListClustersResponse, error) + ExternalClusterAPIListClustersWithResponse(ctx context.Context) (*ExternalClusterAPIListClustersResponse, error) // ExternalClusterAPIRegisterCluster request with any body ExternalClusterAPIRegisterClusterWithBodyWithResponse(ctx context.Context, contentType string, body io.Reader) (*ExternalClusterAPIRegisterClusterResponse, error) @@ -8625,8 +8605,8 @@ func (c *ClientWithResponses) ScheduledRebalancingAPIPreviewRebalancingScheduleW } // ExternalClusterAPIListClustersWithResponse request returning *ExternalClusterAPIListClustersResponse -func (c *ClientWithResponses) ExternalClusterAPIListClustersWithResponse(ctx context.Context, params *ExternalClusterAPIListClustersParams) (*ExternalClusterAPIListClustersResponse, error) { - rsp, err := c.ExternalClusterAPIListClusters(ctx, params) +func (c *ClientWithResponses) ExternalClusterAPIListClustersWithResponse(ctx context.Context) (*ExternalClusterAPIListClustersResponse, error) { + rsp, err := c.ExternalClusterAPIListClusters(ctx) if err != nil { return nil, err } diff --git a/castai/sdk/mock/client.go b/castai/sdk/mock/client.go index 3cbf15b7..efd57f72 100644 --- a/castai/sdk/mock/client.go +++ b/castai/sdk/mock/client.go @@ -696,9 +696,9 @@ func (mr *MockClientInterfaceMockRecorder) ExternalClusterAPIHandleCloudEventWit } // ExternalClusterAPIListClusters mocks base method. -func (m *MockClientInterface) ExternalClusterAPIListClusters(ctx context.Context, params *sdk.ExternalClusterAPIListClustersParams, reqEditors ...sdk.RequestEditorFn) (*http.Response, error) { +func (m *MockClientInterface) ExternalClusterAPIListClusters(ctx context.Context, reqEditors ...sdk.RequestEditorFn) (*http.Response, error) { m.ctrl.T.Helper() - varargs := []interface{}{ctx, params} + varargs := []interface{}{ctx} for _, a := range reqEditors { varargs = append(varargs, a) } @@ -709,9 +709,9 @@ func (m *MockClientInterface) ExternalClusterAPIListClusters(ctx context.Context } // ExternalClusterAPIListClusters indicates an expected call of ExternalClusterAPIListClusters. -func (mr *MockClientInterfaceMockRecorder) ExternalClusterAPIListClusters(ctx, params interface{}, reqEditors ...interface{}) *gomock.Call { +func (mr *MockClientInterfaceMockRecorder) ExternalClusterAPIListClusters(ctx interface{}, reqEditors ...interface{}) *gomock.Call { mr.mock.ctrl.T.Helper() - varargs := append([]interface{}{ctx, params}, reqEditors...) + varargs := append([]interface{}{ctx}, reqEditors...) return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ExternalClusterAPIListClusters", reflect.TypeOf((*MockClientInterface)(nil).ExternalClusterAPIListClusters), varargs...) } @@ -2864,18 +2864,18 @@ func (mr *MockClientWithResponsesInterfaceMockRecorder) ExternalClusterAPIHandle } // ExternalClusterAPIListClustersWithResponse mocks base method. -func (m *MockClientWithResponsesInterface) ExternalClusterAPIListClustersWithResponse(ctx context.Context, params *sdk.ExternalClusterAPIListClustersParams) (*sdk.ExternalClusterAPIListClustersResponse, error) { +func (m *MockClientWithResponsesInterface) ExternalClusterAPIListClustersWithResponse(ctx context.Context) (*sdk.ExternalClusterAPIListClustersResponse, error) { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "ExternalClusterAPIListClustersWithResponse", ctx, params) + ret := m.ctrl.Call(m, "ExternalClusterAPIListClustersWithResponse", ctx) ret0, _ := ret[0].(*sdk.ExternalClusterAPIListClustersResponse) ret1, _ := ret[1].(error) return ret0, ret1 } // ExternalClusterAPIListClustersWithResponse indicates an expected call of ExternalClusterAPIListClustersWithResponse. -func (mr *MockClientWithResponsesInterfaceMockRecorder) ExternalClusterAPIListClustersWithResponse(ctx, params interface{}) *gomock.Call { +func (mr *MockClientWithResponsesInterfaceMockRecorder) ExternalClusterAPIListClustersWithResponse(ctx interface{}) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ExternalClusterAPIListClustersWithResponse", reflect.TypeOf((*MockClientWithResponsesInterface)(nil).ExternalClusterAPIListClustersWithResponse), ctx, params) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ExternalClusterAPIListClustersWithResponse", reflect.TypeOf((*MockClientWithResponsesInterface)(nil).ExternalClusterAPIListClustersWithResponse), ctx) } // ExternalClusterAPIListNodesWithResponse mocks base method. diff --git a/docs/index.md b/docs/index.md index f88f98d3..e4febcfb 100644 --- a/docs/index.md +++ b/docs/index.md @@ -47,12 +47,12 @@ provider "helm" { kubernetes { host = module.eks.cluster_endpoint cluster_ca_certificate = base64decode(module.eks.cluster_certificate_authority_data) - exec { - api_version = "client.authentication.k8s.io/v1beta1" - command = "aws" - # This requires the awscli to be installed locally where Terraform is executed. - args = ["eks", "get-token", "--cluster-name", module.eks.cluster_name, "--region", var.cluster_region] - } + exec { + api_version = "client.authentication.k8s.io/v1beta1" + command = "aws" + # This requires the awscli to be installed locally where Terraform is executed. + args = ["eks", "get-token", "--cluster-name", module.eks.cluster_name, "--region", var.cluster_region] + } } } diff --git a/docs/resources/node_configuration.md b/docs/resources/node_configuration.md index 3cd7728d..81979527 100644 --- a/docs/resources/node_configuration.md +++ b/docs/resources/node_configuration.md @@ -31,7 +31,7 @@ resource "castai_node_configuration" "default" { min_disk_size = 133 subnets = aws_subnet.test[*].id init_script = base64encode(var.init_script) - docker_config = jsonencode({ + docker_config = jsonencode({ "insecure-registries" = ["registry.com:5000"], "max-concurrent-downloads" = 10 }) @@ -40,7 +40,7 @@ resource "castai_node_configuration" "default" { "registryPullQPS" : 10 }) container_runtime = "dockerd" - tags = { + tags = { env = "development" } eks { diff --git a/docs/resources/rebalancing_job.md b/docs/resources/rebalancing_job.md index 9f18f5e6..d886d06c 100644 --- a/docs/resources/rebalancing_job.md +++ b/docs/resources/rebalancing_job.md @@ -14,9 +14,9 @@ Job assigns a rebalancing schedule to a cluster. ```terraform resource "castai_rebalancing_job" "spots" { - cluster_id = castai_eks_cluster.test.id - rebalancing_schedule_id = castai_rebalancing_schedule.spots.id - enabled = true + cluster_id = castai_eks_cluster.test.id + rebalancing_schedule_id = castai_rebalancing_schedule.spots.id + enabled = true } ``` diff --git a/docs/resources/rebalancing_schedule.md b/docs/resources/rebalancing_schedule.md index 527b3084..a9dedc2d 100644 --- a/docs/resources/rebalancing_schedule.md +++ b/docs/resources/rebalancing_schedule.md @@ -14,34 +14,34 @@ CAST AI rebalancing schedule resource to manage rebalancing schedules. ```terraform resource "castai_rebalancing_schedule" "spots" { - name = "rebalance spots at every 30th minute" - schedule { - cron = "*/30 * * * *" - } - trigger_conditions { - savings_percentage = 20 - } - launch_configuration { - # only consider instances older than 5 minutes - node_ttl_seconds = 300 - num_targeted_nodes = 3 - rebalancing_min_nodes = 2 - keep_drain_timeout_nodes = false - selector = jsonencode({ - nodeSelectorTerms = [{ - matchExpressions = [ - { - key = "scheduling.cast.ai/spot" - operator = "Exists" - } - ] - }] - }) - execution_conditions { - enabled = true - achieved_savings_percentage = 10 - } - } + name = "rebalance spots at every 30th minute" + schedule { + cron = "*/30 * * * *" + } + trigger_conditions { + savings_percentage = 20 + } + launch_configuration { + # only consider instances older than 5 minutes + node_ttl_seconds = 300 + num_targeted_nodes = 3 + rebalancing_min_nodes = 2 + keep_drain_timeout_nodes = false + selector = jsonencode({ + nodeSelectorTerms = [{ + matchExpressions = [ + { + key = "scheduling.cast.ai/spot" + operator = "Exists" + } + ] + }] + }) + execution_conditions { + enabled = true + achieved_savings_percentage = 10 + } + } } ```