You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Embedded spec.vpa on VMAgent generates a VerticalPodAutoscaler targeting the operator-owned Deployment. The VPA admission/recommender rejects that target because of its topmost-controller rule: it walks ownership from the Deployment up to the VMAgent CR, whose CRD declares a scale subresource with specReplicasPath: .spec.shardCount. Both possible states fail:
type: ConfigUnsupported
message: 'Error checking if target apps/v1.Deployment/vmagent-staging-vmagent
is a topmost well-known or scalable controller: unhandled targetRef
operator.victoriametrics.com/v1beta1 / VMAgent / staging-vmagent,
last error Internal error occurred: the spec replicas field
".spec.shardCount" does not exist'
type: NoPodsMatched # → no recommendations, VPA permanently inert
shardCount set — /scale resolves, so the VMAgent CR is recognized as a scalable controller, which makes the targeted Deployment by definition not topmost → VPA likewise reports ConfigUnsupported ("pods should be managed by the topmost controller").
So the embedded-VPA feature can never produce a functional VPA for VMAgent (and presumably VMAnomaly, which shares the sharding/scale machinery). A standalone VPA with targetRef pointing at the VMAgent CR itself (plus shardCount set so /scale works) is accepted by VPA and works — which suggests the fix.
Expected behavior
For CRDs that declare a scale subresource, the operator-generated VPA should set targetRef to the CR (operator.victoriametrics.com/v1beta1 / VMAgent / <name>), not the owned workload — that is the topmost scalable controller VPA requires. For sharded deployments this likely means one VPA targeting the CR rather than per-shard workload-targeted VPAs, or per-shard label-based matching via a different mechanism.
Related: GET /scale erroring when spec.shardCount is unset (follow-up to #2229) is what forces users to set shardCount: 1 explicitly even for non-sharded agents; fixing that would make the CR-targeted shape work out of the box.
To Reproduce
Operator v0.73.1 with VM_VPA_API_ENABLED=true and VPA RBAC granted.
VMAgent without shardCount, with any valid spec.vpa (updatePolicy + resourcePolicy).
Operator logs creating VPA=<ns>/vmagent-<name> targeting the Deployment; the VPA object goes ConfigUnsupported / NoPodsMatched and never emits recommendations.
Version
operator v0.73.1 (chart 0.66.2), Kubernetes v1.35.2, vertical-pod-autoscaler 1.5.1. Embedded VPAs on VMCluster roles (vmstorage/vmselect/vminsert) work correctly in the same setup — those workloads' CRD owner has no scale subresource, so the workload passes the topmost check.
Describe the bug
Embedded
spec.vpaonVMAgentgenerates aVerticalPodAutoscalertargeting the operator-owned Deployment. The VPA admission/recommender rejects that target because of its topmost-controller rule: it walks ownership from the Deployment up to theVMAgentCR, whose CRD declares a scale subresource withspecReplicasPath: .spec.shardCount. Both possible states fail:shardCountunset —GET /scaleon the CR returns an apiserver error (the spec replicas field ".spec.shardCount" does not exist; VMAgent + VPA: scale subresource lookup fails when .spec.shardCount is unset (follow-up to #693) #2229's v0.71 fix only defaults.status.shards), so the ownership walk errors out. Observed status on the generated VPA (operator v0.73.1, K8s v1.35.2, VPA 1.5.1):shardCountset —/scaleresolves, so theVMAgentCR is recognized as a scalable controller, which makes the targeted Deployment by definition not topmost → VPA likewise reportsConfigUnsupported("pods should be managed by the topmost controller").So the embedded-VPA feature can never produce a functional VPA for
VMAgent(and presumablyVMAnomaly, which shares the sharding/scale machinery). A standalone VPA withtargetRefpointing at theVMAgentCR itself (plusshardCountset so/scaleworks) is accepted by VPA and works — which suggests the fix.Expected behavior
For CRDs that declare a scale subresource, the operator-generated VPA should set
targetRefto the CR (operator.victoriametrics.com/v1beta1 / VMAgent / <name>), not the owned workload — that is the topmost scalable controller VPA requires. For sharded deployments this likely means one VPA targeting the CR rather than per-shard workload-targeted VPAs, or per-shard label-based matching via a different mechanism.Related:
GET /scaleerroring whenspec.shardCountis unset (follow-up to #2229) is what forces users to setshardCount: 1explicitly even for non-sharded agents; fixing that would make the CR-targeted shape work out of the box.To Reproduce
VM_VPA_API_ENABLED=trueand VPA RBAC granted.VMAgentwithoutshardCount, with any validspec.vpa(updatePolicy + resourcePolicy).creating VPA=<ns>/vmagent-<name>targeting the Deployment; the VPA object goesConfigUnsupported/NoPodsMatchedand never emits recommendations.Version
operator v0.73.1 (chart 0.66.2), Kubernetes v1.35.2, vertical-pod-autoscaler 1.5.1. Embedded VPAs on
VMClusterroles (vmstorage/vmselect/vminsert) work correctly in the same setup — those workloads' CRD owner has no scale subresource, so the workload passes the topmost check.