Skip to content

user: implement password mutability via passwordRef#725

Merged
mandre merged 1 commit intok-orc:mainfrom
shiftstack:mutable-password
Mar 31, 2026
Merged

user: implement password mutability via passwordRef#725
mandre merged 1 commit intok-orc:mainfrom
shiftstack:mutable-password

Conversation

@mandre
Copy link
Copy Markdown
Collaborator

@mandre mandre commented Mar 30, 2026

Make the passwordRef field mutable so users can update passwords by pointing to a different Secret. Track the applied password reference in a new status field (appliedPasswordRef) to detect when an update is needed.

The reconciler compares spec.resource.passwordRef with status.resource.appliedPasswordRef. On first reconcile after creation, it sets the status field without calling UpdateUser (CreateResource already set the initial password). On subsequent changes, it reads the new Secret, calls UpdateUser, and updates the status field via a MergePatch that coexists with the main SSA status update.

Fixes #723.

Make the passwordRef field mutable so users can update passwords by
pointing to a different Secret. Track the applied password reference
in a new status field (appliedPasswordRef) to detect when an update
is needed.

The reconciler compares spec.resource.passwordRef with
status.resource.appliedPasswordRef. On first reconcile after creation,
it sets the status field without calling UpdateUser (CreateResource
already set the initial password). On subsequent changes, it reads the
new Secret, calls UpdateUser, and updates the status field via a
MergePatch that coexists with the main SSA status update.
@github-actions github-actions bot added the semver:minor Backwards-compatible change label Mar 30, 2026
Copy link
Copy Markdown
Contributor

@dlaw4608 dlaw4608 left a comment

Choose a reason for hiding this comment

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

Cool use of JSON Merge patches!!, looks ready to merge to me, if I had to point out one thing & this is in combination with the changes made in #726. These PR are adding a new mutability operation into the controller no? so then per the DOCS should we think about adding a new unit test for the actuator_test.go as well? , https://k-orc.cloud/development/writing-tests/.

I would be happy to take a crack at doing this in a follow up PR if you think it is necessary @mandre ?
Note: Also missing a unit test for the enabled field

@mandre
Copy link
Copy Markdown
Collaborator Author

mandre commented Mar 31, 2026

Cool use of JSON Merge patches!!, looks ready to merge to me, if I had to point out one thing & this is in combination with the changes made in #726. These PR are adding a new mutability operation into the controller no? so then per the DOCS should we think about adding a new unit test for the actuator_test.go as well? , https://k-orc.cloud/development/writing-tests/.

I would be happy to take a crack at doing this in a follow up PR if you think it is necessary @mandre ? Note: Also missing a unit test for the enabled field

You're absolutely right. Should we merge both PRs and you add the missing tests to actuator_test.go?

@mandre mandre added this pull request to the merge queue Mar 31, 2026
Merged via the queue into k-orc:main with commit b6fde2a Mar 31, 2026
10 checks passed
@mandre mandre deleted the mutable-password branch March 31, 2026 14:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

semver:minor Backwards-compatible change

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Keystone User: Allow updating user password

2 participants