Skip to content

Commit

Permalink
fix isUnavailable
Browse files Browse the repository at this point in the history
Signed-off-by: Vacant2333 <vacant2333@gmail.com>
  • Loading branch information
Vacant2333 committed Dec 30, 2024
1 parent 9fb2451 commit b54522b
Show file tree
Hide file tree
Showing 4 changed files with 5,898 additions and 635 deletions.
10 changes: 0 additions & 10 deletions pkg/cache/unavailableofferings.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,6 @@ import (

"github.com/patrickmn/go-cache"
"knative.dev/pkg/logging"
karpv1 "sigs.k8s.io/karpenter/pkg/apis/v1"
)

var (
spotKey = key("", "", karpv1.CapacityTypeSpot)
)

// UnavailableOfferings stores any offerings that return ICE (insufficient capacity errors) when
Expand Down Expand Up @@ -56,11 +51,6 @@ func NewUnavailableOfferings() *UnavailableOfferings {

// IsUnavailable returns true if the offering appears in the cache
func (u *UnavailableOfferings) IsUnavailable(instanceType, zone, capacityType string) bool {
if capacityType == karpv1.CapacityTypeSpot {
if _, found := u.cache.Get(spotKey); found {
return true
}
}
_, found := u.cache.Get(key(instanceType, zone, capacityType))
return found
}
Expand Down
2 changes: 1 addition & 1 deletion pkg/controllers/interruption/controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ func (c *Controller) Reconcile(ctx context.Context, node *corev1.Node) (reconcil
return reconcile.Result{}, nil
}

func (c *Controller) Register(ctx context.Context, m manager.Manager) error {
func (c *Controller) Register(_ context.Context, m manager.Manager) error {
return controllerruntime.NewControllerManagedBy(m).
Named("interruption").
For(&corev1.Node{}).
Expand Down
7 changes: 4 additions & 3 deletions pkg/controllers/nodeclaim/garbagecollection/controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,9 +39,10 @@ import (
)

type Controller struct {
kubeClient client.Client
cloudProvider cloudprovider.CloudProvider
successfulCount uint64 // keeps track of successful reconciles for more aggressive requeueing near the start of the controller
kubeClient client.Client
cloudProvider cloudprovider.CloudProvider
// Keeps track of successful reconciles for more aggressive requeueing near the start of the controller.
successfulCount uint64
}

func NewController(kubeClient client.Client, cloudProvider cloudprovider.CloudProvider) *Controller {
Expand Down
Loading

0 comments on commit b54522b

Please sign in to comment.