Skip to content

feat: Relay --watch-namespaces to sveltos-agent - #504

Merged
gianlucam76 merged 1 commit into
projectsveltos:mainfrom
gianlucam76:namespace-scoped
Sep 1, 2026
Merged

feat: Relay --watch-namespaces to sveltos-agent#504
gianlucam76 merged 1 commit into
projectsveltos:mainfrom
gianlucam76:namespace-scoped

Conversation

@gianlucam76

Copy link
Copy Markdown
Member

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.

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
gianlucam76 merged commit 7d44692 into projectsveltos:main Sep 1, 2026
9 checks passed
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.

1 participant