Skip to content

Commit

Permalink
fix VPA controller_fetcher node validation
Browse files Browse the repository at this point in the history
  • Loading branch information
ZihanJiang96 committed Jul 31, 2024
1 parent 45dfba4 commit 78acbde
Showing 1 changed file with 5 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -257,9 +257,6 @@ func (f *controllerFetcher) isWellKnownOrScalable(key *ControllerKeyWithAPIVersi
if f.isWellKnown(key) {
return true
}
if gk, err := key.groupKind(); err != nil && wellKnownController(gk.Kind) == node {
return false
}

//if not well known check if it supports scaling
groupKind, err := key.groupKind()
Expand All @@ -268,6 +265,10 @@ func (f *controllerFetcher) isWellKnownOrScalable(key *ControllerKeyWithAPIVersi
return false
}

if wellKnownController(groupKind.Kind) == node {
return false
}

mappings, err := f.mapper.RESTMappings(groupKind)
if err != nil {
klog.Errorf("Could not find mappings for %s: %v", groupKind, err)
Expand All @@ -286,7 +287,7 @@ func (f *controllerFetcher) isWellKnownOrScalable(key *ControllerKeyWithAPIVersi

func (f *controllerFetcher) getOwnerForScaleResource(groupKind schema.GroupKind, namespace, name string) (*ControllerKeyWithAPIVersion, error) {
if wellKnownController(groupKind.Kind) == node {
// Some pods specify nods as their owners. This causes performance problems
// Some pods specify nodes as their owners. This causes performance problems
// in big clusters when VPA tries to get all nodes. We know nodes aren't
// valid controllers so we can skip trying to fetch them.
return nil, fmt.Errorf("node is not a valid owner")
Expand Down

0 comments on commit 78acbde

Please sign in to comment.