Update machine status - #352
Conversation
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: yairpod The full list of commands accepted by this bot can be found here. DetailsNeeds approval from an approver in each of these files:Approvers can indicate their approval by writing |
Reviewer's GuideThe PR introduces meaningful Machine status conditions for key provisioning and attestation-key approval, defines their shared constants and builders, and updates both reconciliation paths to patch status only when conditions change while retaining existing error and requeue behavior. Sequence diagram for Machine key provisioning statussequenceDiagram
participant MachineReconciler
participant Trustee
participant KubernetesAPI
MachineReconciler->>Trustee: generate_secret(id, owner_reference)
alt secret generation succeeds
MachineReconciler->>Trustee: send_secret(id)
end
MachineReconciler->>MachineReconciler: machine_key_provisioned_condition(provisioned, generation, existing_status)
alt condition changed
MachineReconciler->>KubernetesAPI: patch_status(Machine, conditions)
end
MachineReconciler-->>MachineReconciler: requeue or return provisioning error
Sequence diagram for Machine attestation-key approval statussequenceDiagram
participant AttestationKeyReconciler
participant KubernetesAPI
AttestationKeyReconciler->>KubernetesAPI: patch_status(AttestationKey, Approved)
AttestationKeyReconciler->>AttestationKeyReconciler: machine_ak_approved_condition(false, generation, status)
alt matching key approved
AttestationKeyReconciler->>KubernetesAPI: patch_status(Machine, AttestationKeyApproved)
else no matching key
AttestationKeyReconciler->>KubernetesAPI: patch_status(Machine, AttestationKeyApproved=False)
end
File-Level Changes
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
There was a problem hiding this comment.
Hey - I've reviewed your changes and they look great!
Sourcery assessment
Needs a human reviewer. If the condition logic or status patch is wrong, a Machine could retain an incorrect provisioning or attestation status after a revert, potentially misleading status-based automation or operators. The underlying key operations are not changed in substance, and the persisted status can be corrected by a subsequent reconciliation or rerun.
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.
Jakob-Naucke
left a comment
There was a problem hiding this comment.
I know I'm no saint for this but could you motivate the change in the commit message a little more? Which new conditions are there and why, where do and don't we change the way we update a status (apply vs. merge)
Machines had no status conditions, making it hard to observe provisioning and attestation-key state. Add two Machine conditions: - KeyProvisioned: set by register-server after LUKS key provisioning - AttestationKeyApproved: set to False by attestation-key-register when no matching key is found, and to True when a key is approved Extract a generic patch_status_condition helper that uses Patch::Apply with per-controller field managers, replacing the previous upsert-then-merge-patch pattern. SSA lets each controller own its conditions independently, avoiding last-write-wins races on the conditions array. Migrate all existing condition-update call sites (register_server, attestation_key_register) to the new helper. Signed-off-by: Yair Podemsky <ypodemsk@redhat.com> Assisted-by: AI
0a4ded7 to
374f728
Compare
Yes, I get too lax, I now wrote a proper Commit message. |
Jakob-Naucke
left a comment
There was a problem hiding this comment.
Extract a generic patch_status_condition helper that uses
Patch::Apply with per-controller field managers, replacing the
previous upsert-then-merge-patch pattern. SSA lets each controller
own its conditions independently, avoiding last-write-wins races
on the conditions array.
Migrate all existing condition-update call sites (register_server,
attestation_key_register) to the new helper.
I think it's easier to review if these changes go in a separate (preceding) commit
Update machine status CRDs that were unused and could be meaningful.
Summary by Sourcery
Expose meaningful Machine status conditions for key provisioning and attestation-key approval.
New Features:
Enhancements: