Skip to content

feat: add --token option for pull-mode cluster registration - #450

Merged
gianlucam76 merged 1 commit into
projectsveltos:mainfrom
gianlucam76:pullmode-token
Sep 15, 2026
Merged

gianlucam76 merged 1 commit into
projectsveltos:mainfrom
gianlucam76:pullmode-token

Conversation

@gianlucam76

Copy link
Copy Markdown
Member

Pull-mode clusters registered today get a long-lived, non-renewing Secret of type kubernetes.io/service-account-token. This PR adds an opt-in alternative for register cluster --pullmode: a short-lived token that sveltoscluster-manager renews automatically going forward, bringing pull mode to parity with what push-mode registration already does by default.

New flags, only meaningful with --pullmode:

  • --token: use TokenRequest instead of the static SA-token Secret, and configure the SveltosCluster's TokenRequestRenewalOption so sveltoscluster-manager renews it (1h interval, 24h token duration).
  • --management-cluster-url=<url>: required with --token. The management cluster's externally reachable API server address (e.g. https://:), including scheme. sveltoscluster-manager runs in-cluster, so its own view of that address is typically an internal one (the kubernetes.default.svc ClusterIP) the managed cluster can't reach, and on at least one provider (Civo) its in-cluster CA doesn't validate the external endpoint's certificate either. This command already has a working connection to the right endpoint (it's what registration itself uses), so it persists both the address and its own ambient CA data into a ConfigMap (server / ca.crt) for sveltoscluster-manager to read back on every renewal instead of guessing.
  • --sveltos-namespace=<name>: where sveltoscluster-manager itself is installed (defaults to "projectsveltos"). Used to scope the RBAC grant below to the right identity.

Also creates a namespace-scoped Role/RoleBinding per cluster, granting sveltoscluster-manager's own ServiceAccount create on serviceaccounts/token, restricted via resourceNames to that one cluster's ServiceAccount — not a blanket grant on sveltoscluster-manager's own ClusterRole, so it can only ever renew tokens for clusters actually registered with --token.

deregisterSveltosCluster cleans up the new Role/RoleBinding and ConfigMap alongside the existing pull-mode resources.

Pull-mode clusters registered today get a long-lived, non-renewing Secret of type
kubernetes.io/service-account-token. This PR adds an opt-in alternative for `register cluster
--pullmode`: a short-lived token that sveltoscluster-manager renews automatically going
forward, bringing pull mode to parity with what push-mode registration already does by default.

New flags, only meaningful with --pullmode:

- `--token`: use TokenRequest instead of the static SA-token Secret, and configure the
  SveltosCluster's TokenRequestRenewalOption so sveltoscluster-manager renews it (1h interval,
  24h token duration).
- `--management-cluster-url=<url>`: required with --token. The management cluster's externally
  reachable API server address (e.g. https://<host>:<port>), including scheme. sveltoscluster-manager
  runs in-cluster, so its own view of that address is typically an internal one (the
  kubernetes.default.svc ClusterIP) the managed cluster can't reach, and on at least one provider
  (Civo) its in-cluster CA doesn't validate the external endpoint's certificate either. This
  command already has a working connection to the right endpoint (it's what registration itself
  uses), so it persists both the address and its own ambient CA data into a ConfigMap
  (server / ca.crt) for sveltoscluster-manager to read back on every renewal instead of guessing.
- `--sveltos-namespace=<name>`: where sveltoscluster-manager itself is installed (defaults to
  "projectsveltos"). Used to scope the RBAC grant below to the right identity.

Also creates a namespace-scoped Role/RoleBinding per cluster, granting sveltoscluster-manager's
own ServiceAccount `create` on `serviceaccounts/token`, restricted via resourceNames to that one
cluster's ServiceAccount — not a blanket grant on sveltoscluster-manager's own ClusterRole, so it
can only ever renew tokens for clusters actually registered with --token.

deregisterSveltosCluster cleans up the new Role/RoleBinding and ConfigMap alongside the existing
pull-mode resources.
@gianlucam76
gianlucam76 merged commit db30356 into projectsveltos:main Sep 15, 2026
4 checks passed
@gianlucam76
gianlucam76 deleted the pullmode-token branch September 15, 2026 15:27
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