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

ctrl: HCP adaptations for NodeGroup validation and RTE #1027

Merged
merged 2 commits into from
Nov 20, 2024

Conversation

shajmakh
Copy link
Member

@shajmakh shajmakh commented Sep 27, 2024

Adapt the possibility of running the operator on Hypershift platform by
replacing MCP context with PoolName where relevant; In addition to extra
NodeGroup validation on hypershift.

@openshift-ci openshift-ci bot added the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Sep 27, 2024
Copy link
Contributor

openshift-ci bot commented Sep 27, 2024

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: shajmakh

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

@openshift-ci openshift-ci bot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Sep 27, 2024
@shajmakh
Copy link
Member Author

#1018 is needed first

@openshift-merge-robot openshift-merge-robot added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Oct 19, 2024
@openshift-merge-robot openshift-merge-robot removed the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Oct 30, 2024
@shajmakh shajmakh changed the title WIP: Hypershift RTE adaptations ctrl: HCP adaptations for NodeGroup validation and RTE Oct 30, 2024
@openshift-ci openshift-ci bot removed the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Oct 30, 2024
@shajmakh
Copy link
Member Author

depends on #1015

Copy link
Collaborator

@Tal-or Tal-or left a comment

Choose a reason for hiding this comment

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

I think we need to come with a better approach than all the branching in the flow per platform type.
I'll try to experiment with the code and will provide some feedback soon

pkg/objectstate/rte/rte.go Outdated Show resolved Hide resolved
@Tal-or
Copy link
Collaborator

Tal-or commented Nov 3, 2024

depends on #1015

Why this PR depends on #1015?

Copy link
Member

@ffromani ffromani left a comment

Choose a reason for hiding this comment

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

let's add the missing FindTree alias per inline comment and we can merge.

It's more important to fix CI than polish, but we need to polish as soon as we have CI running.

@@ -257,11 +260,64 @@ func (em *ExistingManifests) State(mf rtemanifests.Manifests, updater GenerateDe
}

for _, tree := range em.trees {
for _, mcp := range tree.MachineConfigPools {
if em.plat == platform.OpenShift {
Copy link
Member

Choose a reason for hiding this comment

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

we can merge to have actually CI running, but this code is now untenable, we need to plan a cleanup/possibly a redesign ASAP

Copy link
Member

Choose a reason for hiding this comment

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

will add an issue/card to track this work

pkg/validation/validation_test.go Outdated Show resolved Hide resolved
Comment on lines 146 to 164
if err := validation.NodeGroups(instance.Spec.NodeGroups, r.Platform); err != nil {
return r.updateStatus(ctx, instance, status.ConditionDegraded, validation.NodeGroupsError, err)
}

trees, err := getTreesByNodeGroup(ctx, r.Client, instance.Spec.NodeGroups)
trees, err := getTreesByNodeGroup(ctx, r.Client, instance.Spec.NodeGroups, r.Platform)
if err != nil {
return r.updateStatus(ctx, instance, status.ConditionDegraded, validation.NodeGroupsError, err)
}

multiMCPsErr := validation.MultipleMCPsPerTree(instance.Annotations, trees)
var multiMCPsErr error
if r.Platform == platform.OpenShift {
multiMCPsErr = validation.MultipleMCPsPerTree(instance.Annotations, trees)

if err := validation.MachineConfigPoolDuplicates(trees); err != nil {
return r.updateStatus(ctx, instance, status.ConditionDegraded, validation.NodeGroupsError, err)
if err := validation.MachineConfigPoolDuplicates(trees); err != nil {
return r.updateStatus(ctx, instance, status.ConditionDegraded, validation.NodeGroupsError, err)
}
Copy link
Member

Choose a reason for hiding this comment

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

all the validation code should be abstracted (in the aforementioned future cleanup once CI runs) in a platform-specific function instead of having plenty of if platform == like we have today

Copy link
Member

Choose a reason for hiding this comment

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

will add an issue/card to track this work

@Tal-or
Copy link
Collaborator

Tal-or commented Nov 19, 2024

let's add the missing FindTree alias per inline comment and we can merge.

It's more important to fix CI than polish, but we need to polish as soon as we have CI running.

It's possible to rebase this one on top of #1071 to make sure CI is happy

@shajmakh shajmakh force-pushed the HCP-adaptations branch 4 times, most recently from f033f45 to 7f40dbf Compare November 20, 2024 12:44
@openshift-merge-robot openshift-merge-robot added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Nov 20, 2024
@openshift-merge-robot openshift-merge-robot removed the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Nov 20, 2024
Adapt the possibility of running the operator on Hypershift platform by
replacing MCP context with PoolName where relevant; In addition to extra
NodeGroup validation on hypershift.

Signed-off-by: Shereen Haj <[email protected]>
The controller reconciliation should reflect the node group statuses
after verifying all components are up and healthy. To preserve backward
compatibility, for OCP we copy the node group config from
MachineConfigPools[].Config to NodeGroupStatus[].Config. For hypershift
we don't have MCP so we copy that info from the NodeGroup[].Config. That
is safe because we know the controller loop will exit if a
node group is misconfigured.

Signed-off-by: Shereen Haj <[email protected]>
Copy link
Member

@ffromani ffromani left a comment

Choose a reason for hiding this comment

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

/lgtm

@openshift-ci openshift-ci bot added the lgtm Indicates that a PR is ready to be merged. label Nov 20, 2024
@ffromani
Copy link
Member

/override ci/prow/ci-e2e-install-hypershift

this is still expected

Copy link
Contributor

openshift-ci bot commented Nov 20, 2024

@ffromani: Overrode contexts on behalf of ffromani: ci/prow/ci-e2e-install-hypershift

In response to this:

/override ci/prow/ci-e2e-install-hypershift

this is still expected

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository.

@ffromani ffromani merged commit 576c0cc into openshift-kni:main Nov 20, 2024
13 of 15 checks passed
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.

4 participants