Skip to content

Commit

Permalink
feat: add support to configure budgets in NodePool
Browse files Browse the repository at this point in the history
  • Loading branch information
rafatio committed Sep 4, 2024
1 parent 9eb8d1f commit cc79e3d
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 5 deletions.
5 changes: 0 additions & 5 deletions controllers/controlplane/kopscontrolplane_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -233,11 +233,6 @@ func (r *KopsControlPlaneReconciler) PrepareCustomCloudResources(ctx context.Con
"kops.k8s.io/managed-by": "kops-controller",
})

// TODO: remove this after upgrading to Karpenter 0.37
// This is needed because of the mismatch between the current karpenter version 0.32.4
// and the dependency version
nodePool.Spec.Disruption.Budgets = nil

// Create NodePool
if _, err := karpenterResourcesContent.Write([]byte("---\n")); err != nil {
return err
Expand Down
10 changes: 10 additions & 0 deletions controllers/controlplane/kopscontrolplane_controller_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1987,6 +1987,16 @@ func TestPrepareCustomCloudResources(t *testing.T) {
},
Spec: karpenterv1beta1.NodePoolSpec{
Disruption: karpenterv1beta1.Disruption{
Budgets: []karpenterv1beta1.Budget{
{
Nodes: "10%",
},
{
Nodes: "0",
Schedule: helpers.StringPtr("0 * * * *"),
Duration: &metav1.Duration{Duration: 40 * time.Minute},
},
},
ConsolidationPolicy: karpenterv1beta1.ConsolidationPolicyWhenUnderutilized,
},
Template: karpenterv1beta1.NodeClaimTemplate{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,11 @@ metadata:
name: test-node-pool
spec:
disruption:
budgets:
- nodes: 10%
- duration: 40m0s
nodes: "0"
schedule: 0 * * * *
consolidationPolicy: WhenUnderutilized
expireAfter: Never
template:
Expand Down

0 comments on commit cc79e3d

Please sign in to comment.