Skip to content

Commit

Permalink
Merge pull request #105 from jwcesign/fix-flannel
Browse files Browse the repository at this point in the history
fix: fix capacity limitation
  • Loading branch information
helen-frank authored Nov 8, 2024
2 parents 0408a76 + 414de62 commit 7484c52
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 4 deletions.
2 changes: 1 addition & 1 deletion pkg/controllers/nodeclaim/garbagecollection/controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ func (c *Controller) Reconcile(ctx context.Context) (reconcile.Result, error) {
return reconcile.Result{}, err
}
c.successfulCount++
return reconcile.Result{RequeueAfter: lo.Ternary(c.successfulCount <= 20, time.Second*10, time.Minute*2)}, nil
return reconcile.Result{RequeueAfter: lo.Ternary(c.successfulCount <= 20, time.Second*10, time.Minute)}, nil
}

func (c *Controller) garbageCollect(ctx context.Context, nodeClaim *karpv1.NodeClaim, nodeList *corev1.NodeList) error {
Expand Down
14 changes: 11 additions & 3 deletions pkg/providers/instancetype/instancetype.go
Original file line number Diff line number Diff line change
Expand Up @@ -145,9 +145,17 @@ func (p *DefaultProvider) List(ctx context.Context, kc *v1alpha1.KubeletConfigur
)

if item, ok := p.instanceTypesCache.Get(key); ok {
// Ensure what's returned from this function is a shallow-copy of the slice (not a deep-copy of the data itself)
// so that modifications to the ordering of the data don't affect the original
return append([]*cloudprovider.InstanceType{}, item.([]*cloudprovider.InstanceType)...), nil
// TODO: some place changes the Capacity filed, we should find it out and fix it, same with aws provider
return lo.Map(item.([]*cloudprovider.InstanceType),
func(item *cloudprovider.InstanceType, _ int) *cloudprovider.InstanceType {
return &cloudprovider.InstanceType{
Name: item.Name,
Requirements: item.Requirements,
Offerings: item.Offerings,
Capacity: item.Capacity.DeepCopy(),
Overhead: item.Overhead,
}
}), nil
}

// Get all zones across all offerings
Expand Down

0 comments on commit 7484c52

Please sign in to comment.