diff --git a/vertical-pod-autoscaler/pkg/target/controller_fetcher/controller_fetcher.go b/vertical-pod-autoscaler/pkg/target/controller_fetcher/controller_fetcher.go index dcbd11ee210d..9346e5f5ab5c 100644 --- a/vertical-pod-autoscaler/pkg/target/controller_fetcher/controller_fetcher.go +++ b/vertical-pod-autoscaler/pkg/target/controller_fetcher/controller_fetcher.go @@ -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() @@ -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) @@ -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")