Skip to content

Conversation

gianlucam76
Copy link
Member

When a cluster is registered with Sveltos, a Secret containing the cluster's kubeconfig is created.
The kubeconfig is stored under the key kubeconfig within this Secret.

If Sveltos renews the token, the key is updated to re-kubeconfig, and the SveltosCluster.Spec.KubeconfigKeyName is updated to reflect this change.

If you run the sveltosctl register cluster command again, the Secret's data is reset, and the cluster's kubeconfig is once again stored under the kubeconfig key.

Previously, this would cause issues because the SveltosCluster.Spec.KubeconfigKeyName was not updated back to kubeconfig.
This PR resolves that problem by ensuring that SveltosCluster.Spec.KubeconfigKeyName is correctly updated to match the key in the Secret, preventing Sveltos components from failing to find the cluster's kubeconfig.

Fixes 1323

When a cluster is registered with Sveltos, a Secret containing the cluster's
kubeconfig is created.
The kubeconfig is stored under the key __kubeconfig__ within this Secret.

If Sveltos renews the token, the key is updated to __re-kubeconfig__, and
the `SveltosCluster.Spec.KubeconfigKeyName` is updated to reflect this change.

If you run the `sveltosctl register cluster` command again, the Secret's data
is reset, and the cluster's kubeconfig is once again stored under the __kubeconfig__ key.

Previously, this would cause issues because the `SveltosCluster.Spec.KubeconfigKeyName`
was not updated back to __kubeconfig__.
This PR resolves that problem by ensuring that `SveltosCluster.Spec.KubeconfigKeyName`
is correctly updated to match the key in the Secret, preventing Sveltos components from
failing to find the cluster's kubeconfig.
@gianlucam76 gianlucam76 merged commit f51a2b4 into projectsveltos:main Aug 12, 2025
2 checks passed
@gianlucam76 gianlucam76 deleted the token-renewal branch August 12, 2025 20:31
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.

BUG: After SA token renewal the register cluster command overwrites the secret, addon-controller looking for re-kubeconfig key
1 participant