fix(rbgsa-controller): preserve and initialize readyReplicas#280
Conversation
There was a problem hiding this comment.
Code Review
This pull request refactors the RoleBasedGroupScalingAdapter controller to use a new patchAdapterStatus helper, ensuring status updates are performed against the latest object state from the API server. Additionally, it ensures ReadyReplicas is initialized to 0 when an adapter is bound without an existing role status. Feedback suggests optimizing the status patching logic by using a minimal apply configuration that only includes the object's identity and status, thereby avoiding the inclusion of the full Spec in status subresource updates.
|
Addressed the open review comment in The RBGSA status patch helper now builds a status-only apply configuration instead of reusing the full object apply configuration, so |
3af25e8 to
32a00f7
Compare
Server-side-apply patches were being built from the in-memory adapter status, which could lag the on-cluster state due to informer cache staleness. When the resulting apply config omitted readyReplicas, SSA cleared the field — dropping ready-replica observations during phase transitions and scale operations. - Add patchAdapterStatus() that reads the latest status via apiReader before building the apply config, so the patch always carries every status field this controller owns. - Add a status-only apply-config factory so status patches cannot accidentally touch spec. - Initialize readyReplicas to 0 on bind when the RBG has not yet reported a RoleStatus, so the field is always materialized in the apply config. - Route all four status patch sites (unbound phase, bind, readyReplicas sync, scale) through the shared helper.
32a00f7 to
f2ccf91
Compare
Summary
status.readyReplicasis reset to nil when status is updatedstatus.readyReplicasback to nilstatus.readyReplicasto0when a bound adapter is created before the parent RBG has role statusTesting