Skip to content

support HPA in vmagent#1980

Open
AndrewChubatiuk wants to merge 1 commit intomasterfrom
distributed-agent-hpa
Open

support HPA in vmagent#1980
AndrewChubatiuk wants to merge 1 commit intomasterfrom
distributed-agent-hpa

Conversation

@AndrewChubatiuk
Copy link
Contributor

@AndrewChubatiuk AndrewChubatiuk commented Mar 17, 2026

fixes #1961


Summary by cubic

Adds HPA support to VMAgent and VMDistributedZoneAgent for automatic scaling of Deployment and StatefulSet workloads. The operator now reconciles and cleans up HorizontalPodAutoscaler objects (including when spec.hpa is removed); fixes #1961.

  • New Features

    • New spec.hpa (EmbeddedHPA) in VMAgentSpec and VMDistributedZoneAgentSpec.
    • In stateful mode, HPA replica changes update spec.shardCount.
    • Validation: disallow hpa with daemonSetMode; validate HPA spec.
    • CRDs and API docs updated; CHANGELOG entry added.
  • Refactors

    • shardCount switched to int32 across APIs, controllers, and tests (VMAgent, VMAnomaly).

Written for commit d4bf72f. Summary will update on new commits.

Copy link
Contributor

@cubic-dev-ai cubic-dev-ai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

3 issues found across 10 files

Prompt for AI agents (unresolved issues)

Check if these issues are valid — if so, understand the root cause of each and fix them. If appropriate, use sub-agents to investigate and fix each issue separately.


<file name="internal/controller/operator/factory/vmagent/vmagent.go">

<violation number="1" location="internal/controller/operator/factory/vmagent/vmagent.go:151">
P1: This adds an HPA, but vmagent reconciliation still overwrites `.spec.replicas`, so HPA scaling will be reverted on the next sync.</violation>

<violation number="2" location="internal/controller/operator/factory/vmagent/vmagent.go:1322">
P1: HPA targets the base vmagent name, which breaks sharded vmagent because the real Deployment/StatefulSet names are shard-suffixed.</violation>
</file>

<file name="config/crd/overlay/crd.descriptionless.yaml">

<violation number="1" location="config/crd/overlay/crd.descriptionless.yaml:4683">
P1: Require `hpa.maxReplicas` in this schema. As added, users can omit it, and the controller will build an invalid HPA with `maxReplicas: 0`.</violation>
</file>

Reply with feedback, questions, or to request a fix. Tag @cubic-dev-ai to re-run a review.

@AndrewChubatiuk AndrewChubatiuk force-pushed the distributed-agent-hpa branch 4 times, most recently from d81f0c0 to 3c3cf20 Compare March 17, 2026 18:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

VMDistributed: allow the enabling of HPA on vmagent

2 participants