change username in secret when switching rotation mode #2549
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.
You may want certain users to switch to in-place rotation, but the operator does not set the username when it branches to in-place rotation in the go code. Thus, the username would always stay the same. It needs an extra line
secret.Data["username"] = []byte(secretUsername). Another workaround could be to first opt out with the new option introduced with #2528 and add the user to in-place rotation list afterwards.But, the operator could also be smart enough to detect when the desired username is not a rotation user and allow for immediate rotation. This is what this PR introduces.
It can also work the other way around when switching from in-place rotation to rotation with extra users, like:
Unlike before, this would kick in any initial rotation immediately an not after the rotation period. However, it makes the current unit tests impossible. A rotation can produce a list of retention user which the operator tries to drop from the database. Database connections will fail in the unit test. So in the scenario switching from in-place to users rotation the user will need to wait for the next rotation data which is stored in secret - like it before.