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

[release-4.18][manual] objstate: rte: isolate platform-specific code #1152

Merged
merged 4 commits into from
Jan 13, 2025

Conversation

ffromani
Copy link
Member

isolate per-platform specific code in their own types and source code, to reduce the clutter without intentional changes of behavior.
The idea is to gradually move towards full isolation and containment of the platform-specific code, and this change is a step in that direction.
Actually, we dopn't really care about the platform but rather about how we find the nodes, but the method (poolName vs machineconfigpool) is still tied to the platform, hence the ambiguity.
In the long run we want to support only the newer pool approach introduced with HCP.

manual backport of #1114

extract helper to update the state from either
NodeGroups or MachineConfigPools into helpers.
The goal here is to isolate this code to make the main
calling functions more targeted and to unblock future
refactoring.

Signed-off-by: Francesco Romani <[email protected]>
(cherry picked from commit b249228)
@openshift-ci openshift-ci bot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Jan 13, 2025
extract helper to fetch the state from either
NodeGroups or MachineConfigPools into helpers.
The goal here is to isolate this code to make the main
calling functions more targeted and to unblock future
refactoring.

Add helpers to inject parameters.
This helps making the objectstate flavours all consistent
with each other; previously `rte` was the outlier and the
only variant with extra parameters.

This require the constructor function to return a pointer
to a struct (not a struct). Update all the variants for
consistency.

Signed-off-by: Francesco Romani <[email protected]>
(cherry picked from commit b4964b1)
move helpers in per-mode files.
This is meant to keep the filesize at bay
and to enable future code extraction.

No intended change in behavior.

Signed-off-by: Francesco Romani <[email protected]>
(cherry picked from commit 6668e12)
the helpers we extracted in previous commits still share some state;
pack them in a struct, which makes also nicer to consume them from
the caller site(s), acting almost like a type.

In the (far?) future, when we will move completely to nodegroups
(if ever), this code should be dissolved back in the callers.

Signed-off-by: Francesco Romani <[email protected]>
(cherry picked from commit 860ffd1)
@ffromani ffromani force-pushed the plat-cleanup-objstate-4.18 branch from a63b7c8 to 1cb525c Compare January 13, 2025 12:55
@openshift-ci openshift-ci bot added the lgtm Indicates that a PR is ready to be merged. label Jan 13, 2025
Copy link
Contributor

openshift-ci bot commented Jan 13, 2025

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: ffromani, Tal-or

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@ffromani
Copy link
Member Author

/test ci-e2e-install-hypershift

@openshift-merge-bot openshift-merge-bot bot merged commit 01b3074 into release-4.18 Jan 13, 2025
15 checks passed
@ffromani ffromani deleted the plat-cleanup-objstate-4.18 branch January 14, 2025 13:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. lgtm Indicates that a PR is ready to be merged.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants