Skip to content

Commit

Permalink
feat(cor-1103) Add karpenter consolidation and limits
Browse files Browse the repository at this point in the history
  • Loading branch information
mzottola committed Dec 31, 2024
1 parent 020a7bf commit d2b79f0
Show file tree
Hide file tree
Showing 8 changed files with 649 additions and 29 deletions.
1 change: 0 additions & 1 deletion client/cluster.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ package client

import (
"context"

"github.com/qovery/qovery-client-go"

"github.com/qovery/terraform-provider-qovery/client/apierrors"
Expand Down
53 changes: 52 additions & 1 deletion docs/data-sources/cluster.md
Original file line number Diff line number Diff line change
Expand Up @@ -103,8 +103,13 @@ Required:

- `requirements` (Attributes List) List of requirements for the node pool (see [below for nested schema](#nestedatt--features--karpenter--qovery_node_pools--requirements))

Optional:

- `default_override` (Attributes) Defines some overriden options for Qovery default node pool (see [below for nested schema](#nestedatt--features--karpenter--qovery_node_pools--default_override))
- `stable_override` (Attributes) Defines some overriden options for Qovery stable node pool (see [below for nested schema](#nestedatt--features--karpenter--qovery_node_pools--stable_override))

<a id="nestedatt--features--karpenter--qovery_node_pools--requirements"></a>
### Nested Schema for `features.karpenter.qovery_node_pools.requirements`
### Nested Schema for `features.karpenter.qovery_node_pools.stable_override`

Required:

Expand All @@ -113,6 +118,52 @@ Required:
- `values` (List of String) List of values for the requirement


<a id="nestedatt--features--karpenter--qovery_node_pools--default_override"></a>
### Nested Schema for `features.karpenter.qovery_node_pools.stable_override`

Optional:

- `limits` (Attributes) Specifies the limits to apply on the default node pool (see [below for nested schema](#nestedatt--features--karpenter--qovery_node_pools--stable_override--limits))

<a id="nestedatt--features--karpenter--qovery_node_pools--stable_override--limits"></a>
### Nested Schema for `features.karpenter.qovery_node_pools.stable_override.limits`

Required:

- `max_cpu_in_vcpu` (Number)
- `max_memory_in_gibibytes` (Number)



<a id="nestedatt--features--karpenter--qovery_node_pools--stable_override"></a>
### Nested Schema for `features.karpenter.qovery_node_pools.stable_override`

Optional:

- `consolidation` (Attributes) Specifies the period to consolidate nodes (by default, no consolidation happens) (see [below for nested schema](#nestedatt--features--karpenter--qovery_node_pools--stable_override--consolidation))
- `limits` (Attributes) Specifies the limits to apply on the stable node pool (see [below for nested schema](#nestedatt--features--karpenter--qovery_node_pools--stable_override--limits))

<a id="nestedatt--features--karpenter--qovery_node_pools--stable_override--consolidation"></a>
### Nested Schema for `features.karpenter.qovery_node_pools.stable_override.consolidation`

Required:

- `days` (List of String)
- `duration` (String)
- `enabled` (Boolean)
- `start_time` (String)


<a id="nestedatt--features--karpenter--qovery_node_pools--stable_override--limits"></a>
### Nested Schema for `features.karpenter.qovery_node_pools.stable_override.limits`

Required:

- `max_cpu_in_vcpu` (Number)
- `max_memory_in_gibibytes` (Number)






Expand Down
53 changes: 52 additions & 1 deletion docs/resources/cluster.md
Original file line number Diff line number Diff line change
Expand Up @@ -142,8 +142,13 @@ Required:

- `requirements` (Attributes List) List of requirements for the node pool (see [below for nested schema](#nestedatt--features--karpenter--qovery_node_pools--requirements))

Optional:

- `default_override` (Attributes) Defines some overriden options for Qovery default node pool (see [below for nested schema](#nestedatt--features--karpenter--qovery_node_pools--default_override))
- `stable_override` (Attributes) Defines some overriden options for Qovery stable node pool (see [below for nested schema](#nestedatt--features--karpenter--qovery_node_pools--stable_override))

<a id="nestedatt--features--karpenter--qovery_node_pools--requirements"></a>
### Nested Schema for `features.karpenter.qovery_node_pools.requirements`
### Nested Schema for `features.karpenter.qovery_node_pools.stable_override`

Required:

Expand All @@ -152,6 +157,52 @@ Required:
- `values` (List of String) List of values for the requirement


<a id="nestedatt--features--karpenter--qovery_node_pools--default_override"></a>
### Nested Schema for `features.karpenter.qovery_node_pools.stable_override`

Optional:

- `limits` (Attributes) Specifies the limits to apply on the default node pool (see [below for nested schema](#nestedatt--features--karpenter--qovery_node_pools--stable_override--limits))

<a id="nestedatt--features--karpenter--qovery_node_pools--stable_override--limits"></a>
### Nested Schema for `features.karpenter.qovery_node_pools.stable_override.limits`

Required:

- `max_cpu_in_vcpu` (Number)
- `max_memory_in_gibibytes` (Number)



<a id="nestedatt--features--karpenter--qovery_node_pools--stable_override"></a>
### Nested Schema for `features.karpenter.qovery_node_pools.stable_override`

Optional:

- `consolidation` (Attributes) Specifies the period to consolidate nodes (by default, no consolidation happens) (see [below for nested schema](#nestedatt--features--karpenter--qovery_node_pools--stable_override--consolidation))
- `limits` (Attributes) Specifies the limits to apply on the stable node pool (see [below for nested schema](#nestedatt--features--karpenter--qovery_node_pools--stable_override--limits))

<a id="nestedatt--features--karpenter--qovery_node_pools--stable_override--consolidation"></a>
### Nested Schema for `features.karpenter.qovery_node_pools.stable_override.consolidation`

Required:

- `days` (List of String)
- `duration` (String)
- `enabled` (Boolean)
- `start_time` (String)


<a id="nestedatt--features--karpenter--qovery_node_pools--stable_override--limits"></a>
### Nested Schema for `features.karpenter.qovery_node_pools.stable_override.limits`

Required:

- `max_cpu_in_vcpu` (Number)
- `max_memory_in_gibibytes` (Number)






Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ require (
github.com/hashicorp/terraform-plugin-log v0.9.0
github.com/hashicorp/terraform-plugin-sdk/v2 v2.29.0
github.com/pkg/errors v0.9.1
github.com/qovery/qovery-client-go v0.0.0-20241203095515-b7bfff7f6c11
github.com/qovery/qovery-client-go v0.0.0-20241230103349-8c3d9c7232b5
github.com/schollz/progressbar/v3 v3.13.0
github.com/sethvargo/go-envconfig v0.9.0
github.com/stretchr/testify v1.10.0
Expand Down
4 changes: 4 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -169,6 +169,10 @@ github.com/posener/complete v1.2.3 h1:NP0eAhjcjImqslEwo/1hq7gpajME0fTLTezBKDqfXq
github.com/posener/complete v1.2.3/go.mod h1:WZIdtGGp+qx0sLrYKtIRAruyNpv6hFCicSgv7Sy7s/s=
github.com/qovery/qovery-client-go v0.0.0-20241203095515-b7bfff7f6c11 h1:racjGI7jQTgKOZTrYFGwCtceW3aMhfCKQZdpjVENZqM=
github.com/qovery/qovery-client-go v0.0.0-20241203095515-b7bfff7f6c11/go.mod h1:hAMMDu1kk2rNJRf8MiYV0E+07DhDXpvNddj9q8YpbFs=
github.com/qovery/qovery-client-go v0.0.0-20241227140826-136a47d7533e h1:w9D5Z6b/8XpIPwICCbAqctOkFRIMZdI5tNJ6pWOHgYM=
github.com/qovery/qovery-client-go v0.0.0-20241227140826-136a47d7533e/go.mod h1:hAMMDu1kk2rNJRf8MiYV0E+07DhDXpvNddj9q8YpbFs=
github.com/qovery/qovery-client-go v0.0.0-20241230103349-8c3d9c7232b5 h1:ggsdjhn0OYdbanDMJaAMVkuA4JHQYbeOg78enQiGfo4=
github.com/qovery/qovery-client-go v0.0.0-20241230103349-8c3d9c7232b5/go.mod h1:hAMMDu1kk2rNJRf8MiYV0E+07DhDXpvNddj9q8YpbFs=
github.com/rivo/uniseg v0.2.0/go.mod h1:J6wj4VEh+S6ZtnVlnTBMWIodfgj8LQOQFoIToxlJtxc=
github.com/rivo/uniseg v0.4.3 h1:utMvzDsuh3suAEnhH0RdHmoPbU648o6CvXxTx4SBMOw=
github.com/rivo/uniseg v0.4.3/go.mod h1:FN3SvrM+Zdj16jyLfmOkMNblXMcoc8DfTHruCPUcx88=
Expand Down
74 changes: 74 additions & 0 deletions qovery/data_source_cluster.go
Original file line number Diff line number Diff line change
Expand Up @@ -290,6 +290,80 @@ func (r clusterDataSource) Schema(_ context.Context, _ datasource.SchemaRequest,
},
},
},
"stable_override": schema.SingleNestedAttribute{
Description: "Defines some overriden options for Qovery stable node pool",
Optional: true,
Computed: false,
Attributes: map[string]schema.Attribute{
"consolidation": schema.SingleNestedAttribute{
Description: "Specifies the period to consolidate nodes (by default, no consolidation happens)",
Optional: true,
Computed: false,
Attributes: map[string]schema.Attribute{
"enabled": schema.BoolAttribute{
Description: "",
Required: true,
Computed: false,
},
"days": schema.ListAttribute{
Description: "",
Required: true,
Computed: false,
ElementType: types.StringType,
},
"start_time": schema.StringAttribute{
Description: "",
Required: true,
Computed: false,
},
"duration": schema.StringAttribute{
Description: "",
Required: true,
Computed: false,
},
},
},
"limits": schema.SingleNestedAttribute{
Description: "Specifies the limits to apply on the stable node pool",
Optional: true,
Attributes: map[string]schema.Attribute{
"max_cpu_in_vcpu": schema.Int64Attribute{
Description: "",
Required: true,
Computed: false,
},
"max_memory_in_gibibytes": schema.Int64Attribute{
Description: "",
Required: true,
Computed: false,
},
},
},
},
},
"default_override": schema.SingleNestedAttribute{
Description: "Defines some overriden options for Qovery default node pool",
Optional: true,
Computed: false,
Attributes: map[string]schema.Attribute{
"limits": schema.SingleNestedAttribute{
Description: "Specifies the limits to apply on the default node pool",
Optional: true,
Attributes: map[string]schema.Attribute{
"max_cpu_in_vcpu": schema.Int64Attribute{
Description: "",
Required: true,
Computed: false,
},
"max_memory_in_gibibytes": schema.Int64Attribute{
Description: "",
Required: true,
Computed: false,
},
},
},
},
},
},
},
},
Expand Down
74 changes: 74 additions & 0 deletions qovery/resource_cluster.go
Original file line number Diff line number Diff line change
Expand Up @@ -352,6 +352,80 @@ func (r clusterResource) Schema(_ context.Context, _ resource.SchemaRequest, res
},
},
},
"stable_override": schema.SingleNestedAttribute{
Description: "Defines some overriden options for Qovery stable node pool",
Optional: true,
Computed: false,
Attributes: map[string]schema.Attribute{
"consolidation": schema.SingleNestedAttribute{
Description: "Specifies the period to consolidate nodes (by default, no consolidation happens)",
Optional: true,
Computed: false,
Attributes: map[string]schema.Attribute{
"enabled": schema.BoolAttribute{
Description: "",
Required: true,
Computed: false,
},
"days": schema.ListAttribute{
Description: "",
Required: true,
Computed: false,
ElementType: types.StringType,
},
"start_time": schema.StringAttribute{
Description: "",
Required: true,
Computed: false,
},
"duration": schema.StringAttribute{
Description: "",
Required: true,
Computed: false,
},
},
},
"limits": schema.SingleNestedAttribute{
Description: "Specifies the limits to apply on the stable node pool",
Optional: true,
Attributes: map[string]schema.Attribute{
"max_cpu_in_vcpu": schema.Int64Attribute{
Description: "",
Required: true,
Computed: false,
},
"max_memory_in_gibibytes": schema.Int64Attribute{
Description: "",
Required: true,
Computed: false,
},
},
},
},
},
"default_override": schema.SingleNestedAttribute{
Description: "Defines some overriden options for Qovery default node pool",
Optional: true,
Computed: false,
Attributes: map[string]schema.Attribute{
"limits": schema.SingleNestedAttribute{
Description: "Specifies the limits to apply on the default node pool",
Optional: true,
Attributes: map[string]schema.Attribute{
"max_cpu_in_vcpu": schema.Int64Attribute{
Description: "",
Required: true,
Computed: false,
},
"max_memory_in_gibibytes": schema.Int64Attribute{
Description: "",
Required: true,
Computed: false,
},
},
},
},
},
},
},
},
Expand Down
Loading

0 comments on commit d2b79f0

Please sign in to comment.