Skip to content
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

fix: rke2 registration token generated twice #236

Conversation

salasberryfin
Copy link
Contributor

@salasberryfin salasberryfin commented Jan 12, 2024

What this PR does / why we need it:

The RKE2 Config controller is creating the registration token twice (intermittently) and updating the secret that contains the token so different nodes are trying to get registered with different tokens and failing to do so.

We must ensure this secret is created once and its value remains unedited so that nodes can be registered to the cluster.

This initial proposal suggests detecting if the secret exists and skip token creation if it does.

Which issue(s) this PR fixes (optional, in fixes #<issue number>(, fixes #<issue_number>, ...) format, will close the issue(s) when PR gets merged):
Fixes #233

Special notes for your reviewer:

We should add test cases that cover the logic of this controller: ##235 tracks this follow-up issue.

Checklist:

  • squashed commits into logical changes
  • includes documentation
  • adds unit tests
  • adds or updates e2e tests

@salasberryfin salasberryfin added the kind/bug Something isn't working label Jan 12, 2024
@salasberryfin salasberryfin force-pushed the fix-rke2-registration-token-created-twice branch from 4f52666 to 1f6bccd Compare January 12, 2024 16:31
@salasberryfin salasberryfin changed the title WIP: fix: rke2 registration token generated twice fix: rke2 registration token generated twice Jan 15, 2024
@salasberryfin salasberryfin force-pushed the fix-rke2-registration-token-created-twice branch from 1f6bccd to f77363a Compare January 16, 2024 10:44
Signed-off-by: Carlos Salas <carlos.salas@suse.com>
@salasberryfin salasberryfin force-pushed the fix-rke2-registration-token-created-twice branch from f77363a to 4f5c993 Compare January 16, 2024 11:28
@salasberryfin
Copy link
Contributor Author

PR is now updated based on review feedback. Current logic will:

  • Try to create secret and store registration token.
  • If secret already exists, retrieve registration token value.

Copy link
Contributor

@Danil-Grigorev Danil-Grigorev left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

Copy link
Contributor

@richardcase richardcase left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tested this locally and i didn't see the same duplicate token creation.

@alexander-demicev alexander-demicev merged commit d2c8165 into rancher:main Jan 17, 2024
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

RKE2 registration token inconsistency between 1st CP and following nodes
5 participants