Skip to content

Commit

Permalink
Merge pull request kubernetes#7101 from ZihanJiang96/fix-vpa-gk
Browse files Browse the repository at this point in the history
fix VPA controller_fetcher node validation
  • Loading branch information
k8s-ci-robot authored Sep 10, 2024
2 parents cecb34c + 78acbde commit 2800c70
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(ctx context.Context, key *Cont
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(ctx context.Context, key *Cont
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(ctx context.Context, key *Cont

func (f *controllerFetcher) getOwnerForScaleResource(ctx context.Context, 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 2800c70

Please sign in to comment.