Skip to content

VPA: Improve Custom Resource Traversal in the Ownership Chain #9072

@iamzili

Description

@iamzili

Which component are you using?

/area vertical-pod-autoscaler

Is your feature request designed to solve a problem? If so describe the problem this feature should solve:

Using the latest VPA code, the updater and the admission controller do not work for Pods when the ownerReferences chain has the following shape:

ParentObject (implements /scale)
  -> IntermediateObject (does NOT implement the /scale subresource)
    -> Pods

When the VPA object sets targetRef to the topmost object (the ParentObject), the updater and the admission controller cannot resolve the parent object starting from a Pod. In the source code, this object is referred to as controllingVpa (updater, admission controller).

The current logic requires every object in the ownership chain to implement the /scale subresource. Because of this requirement, the following ownership chains works:

ParentObject (implements /scale)
    -> Pods

or:

ParentObject (implements /scale)
  -> IntermediateObject (implements /scale)
    -> Pods

However, the logic fails when the intermediate object (or the parent) does not implement /scale.

The following two recently opened issues report this problem when the intermediate object does not implement the /scale subresource:

Describe the solution you'd like:

At the moment, I can see two possible solutions:

  1. Require /scale only on the topmost object: This option changes the code so that only the topmost (parent) object must implement the /scale subresource, i.e. intermediate objects do not need to implement /scale.The related code path is here. When the code traverses the ownerReferences chain starting from a Pod, it returns a nil owner and a NotFound error if an intermediate object does not implement /scale.

  2. Re-evaluate the need to require /scale resources in VPA: This option may investigates why VPA needs to fetch /scale resources at all. VPA does not read the replica count and does not modify that field. I can imagine that there are some ownerReferences chains in which /scale is not used and VPA is still desired (though I'm not sure how common this is). In this case, even if we implement the first option, VPA would not work in their setup.

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions