feat: Relay --watch-namespaces to sveltos-agent - #504
Merged
Conversation
sveltos-agent can now restrict its watches to declared namespaces in agentless mode. A managed cluster can be annotated with `agent.projectsveltos.io/watch-namespaces` (comma-separated namespace list on the Cluster/SveltosCluster). addon-controller already relays this to drift-detection-manager. This PR does the same for sveltos-agent. - New `getAgentWatchNamespaces`: reads `agent.projectsveltos.io/watch-namespaces` off the Cluster/SveltosCluster - Threaded through `prepareSveltosAgentYAML` into the `--watch-namespaces=` placeholder already present in both the in-cluster and agentless sveltos-agent manifests. - Folded into `getCurrentHash` alongside the existing `sveltosAgentPatches`/`sveltosApplierPatches` hashing. Required: the existing Cluster/SveltosCluster predicates already requeue the Classifier on any annotation change for free, but redeploy is gated by a hash comparison (`isConfigSame`). Without folding the value in, a changed annotation would requeue and then silently redeploy nothing.
gianlucam76
force-pushed
the
namespace-scoped
branch
from
September 1, 2026 17:46
df0bba7 to
dcdf397
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
sveltos-agent can now restrict its watches to declared namespaces in agentless mode.
A managed cluster can be annotated with
agent.projectsveltos.io/watch-namespaces(comma-separated namespace list on the Cluster/SveltosCluster). addon-controller already relays this to drift-detection-manager. This PR does the same for sveltos-agent.getAgentWatchNamespaces: readsagent.projectsveltos.io/watch-namespacesoff the Cluster/SveltosClusterprepareSveltosAgentYAMLinto the--watch-namespaces=placeholder already present in both the in-cluster and agentless sveltos-agent manifests.getCurrentHashalongside the existingsveltosAgentPatches/sveltosApplierPatcheshashing. Required: the existing Cluster/SveltosCluster predicates already requeue the Classifier on any annotation change for free, but redeploy is gated by a hash comparison (isConfigSame). Without folding the value in, a changed annotation would requeue and then silently redeploy nothing.