-
Notifications
You must be signed in to change notification settings - Fork 188
vmagent and vmanomaly: create PDB per shard #1554
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
0596368 to
b6f202e
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't like this change for the following reasons:
- it's intrusive change with a lot of refactoring and not necessary changes. It's hard to read.
- commit message doesn't have any motivation of this change.
- It moves shard template feature out of scope for the current implementation. If templating is supported by PBD, why it's not supported by
ServiceSpec,ServiceScrapeSpec,HPA? What is the boundaries of it? I'd like to keep it as simple as possible and isolated.
|
cc @vrutkovs |
|
this PR doesn't add templating support for PDB, it creates PDB per shard with additional
PDB applies policy for pods, that match provided selector, and in case of multiple deployments there's no guarantee that pods will be rotated properly during upgrade. HPA is not supported by VMAgent, one ServiceScrapeSpec is enough to scrape metrics properly from all pods. For Service maybe it makes sense to have one per shard for scenario, when vmagent shards are configured as remote write destination, but in our case sharding is needed for scraping first of all and Service is mostly used for scraping as well |
f887281 to
8de82d2
Compare
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Lets move ginkgo and golangci bumps in a separate commits - this would make it easier to revert if needed
c5a666d to
f8b8cf7
Compare
|
updated PR |
86a833d to
18219fd
Compare
8caa9cc to
91448eb
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, few suggestions
a38d2f9 to
dc0c5b9
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR refactors the sharding implementation for VMAgent and VMAnomaly to create per-shard PodDisruptionBudgets (PDBs), ensuring proper application protection in sharded deployments. The key changes include:
- Consolidation of shard-related logic into a new
build/shard.gopackage - Refactoring PDB creation to support per-shard PDBs instead of a single global PDB
- Introduction of unified orphaned resource removal that supports Deployments, StatefulSets, and PDBs
- Removal of placeholder-based string templating in favor of structured shard handling
Reviewed Changes
Copilot reviewed 10 out of 10 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
internal/controller/operator/factory/build/shard.go |
New package consolidating shard iteration, naming, labeling, and rendering logic |
internal/controller/operator/factory/build/shard_test.go |
Tests for the new shard iterator function |
internal/controller/operator/factory/build/pdb.go |
Extended to support per-shard PDB creation |
internal/controller/operator/factory/vmagent/vmagent.go |
Refactored to use new shard abstractions and create per-shard PDBs |
internal/controller/operator/factory/vmagent/vmagent_test.go |
Added test coverage for per-shard PDB creation |
internal/controller/operator/factory/vmanomaly/statefulset.go |
Refactored to use new shard abstractions and create per-shard PDBs |
internal/controller/operator/factory/finalize/orphaned.go |
Unified orphaned resource removal using unstructured API |
internal/controller/operator/factory/finalize/orphaned_test.go |
Refactored tests to use a helper function pattern |
api/operator/v1beta1/vmagent_types.go |
Added GetShardCount() helper method |
docs/CHANGELOG.md |
Documented the bugfix |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
dc0c5b9 to
9d47842
Compare
…cation protection, before there was a single PDB, which could lead to unpredicted application disruptions. fixes #1548
9d47842 to
15d1b83
Compare
fixes #1548