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

HOSTEDCP-1513: Add operator scoping support to nodepool controller #3928

Merged
merged 2 commits into from May 6, 2024

Conversation

lucaspalm
Copy link
Contributor

What this PR does / why we need it:
These changes extend the hostedcluster annotation scoping support to the nodepool controller. This feature was originally introduced in #3702, but support was only added to the hostedcluster controller at that time.

Which issue(s) this PR fixes:
https://issues.redhat.com//browse/HOSTEDCP-1513

@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 Apr 23, 2024
Copy link
Contributor

openshift-ci bot commented Apr 23, 2024

Skipping CI for Draft Pull Request.
If you want CI signal for your change, please convert it to an actual PR.
You can still manually trigger a test run with /test all

@openshift-ci openshift-ci bot added do-not-merge/needs-area area/hypershift-operator Indicates the PR includes changes for the hypershift operator and API - outside an OCP release and removed do-not-merge/needs-area labels Apr 23, 2024
Copy link

netlify bot commented Apr 23, 2024

Deploy Preview for hypershift-docs ready!

Name Link
🔨 Latest commit 22235d2
🔍 Latest deploy log https://app.netlify.com/sites/hypershift-docs/deploys/6627fbf25b3b9100083f9fc5
😎 Deploy Preview https://deploy-preview-3928--hypershift-docs.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

@lucaspalm lucaspalm changed the title Add operator scoping support to nodepool controller HOSTEDCP-1513: Add operator scoping support to nodepool controller Apr 23, 2024
@openshift-ci-robot openshift-ci-robot added the jira/valid-reference Indicates that this PR references a valid Jira ticket of any type. label Apr 23, 2024
@openshift-ci-robot
Copy link

openshift-ci-robot commented Apr 23, 2024

@lucaspalm: This pull request references HOSTEDCP-1513 which is a valid jira issue.

Warning: The referenced jira issue has an invalid target version for the target branch this PR targets: expected the epic to target the "4.16.0" version, but no target version was set.

In response to this:

What this PR does / why we need it:
These changes extend the hostedcluster annotation scoping support to the nodepool controller. This feature was originally introduced in #3702, but support was only added to the hostedcluster controller at that time.

Which issue(s) this PR fixes:
https://issues.redhat.com//browse/HOSTEDCP-1513

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 openshift-eng/jira-lifecycle-plugin repository.

@lucaspalm lucaspalm marked this pull request as ready for review April 23, 2024 20:53
@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 Apr 23, 2024
@openshift-ci openshift-ci bot requested review from csrwng and enxebre April 23, 2024 20:53
// is to accept all nodepool events in which the owning hostedcluster resource does not have a corresponding scope annotation defined.
// The ENABLE_HOSTEDCLUSTERS_ANNOTATION_SCOPING env var must also be set to "true" to enable the scoping feature.
func PredicatesForNodepoolAnnotationScoping(r client.Reader) predicate.Predicate {
hcAnnotationScopingEnabledEnvVal := os.Getenv(EnableHostedClustersAnnotationScopingEnv)
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: let's prefer to read these values at startup or as close to startup in main() as we can and pass them via normal function parameters to aid in understanding control flow

support/util/util.go Outdated Show resolved Hide resolved
support/util/util.go Outdated Show resolved Hide resolved
// match the "scope" annotation specified in the HOSTEDCLUSTERS_SCOPE_ANNOTATION env var. If not defined or empty, the
// default behavior is to accept all events for hostedclusters that do not have the annotation.
// The ENABLE_HOSTEDCLUSTERS_ANNOTATION_SCOPING env var must also be set to "true" to enable the scoping feature.
func PredicatesForNodepoolChildResourcesAnnotationScoping(r client.Reader) predicate.Predicate {
Copy link
Contributor

Choose a reason for hiding this comment

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

Could you DRY out these helpers by passing in the function to extract the HostedCluster's NamespacedName from the obj client.Object?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

What function are you referring to exactly? Is there one that exists already somewhere or are you saying to create one use that?

Copy link
Contributor

Choose a reason for hiding this comment

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

The latter - it seemed like the only difference between these utilities

Copy link
Contributor Author

@lucaspalm lucaspalm May 3, 2024

Choose a reason for hiding this comment

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

@stevekuznetsov Check out the changes in 3c11c28. I was able to shrink down this predicate utility code quite a bit! I made sure to test these changes in a local environment to ensure the same results I was seeing before. Thanks for the idea!

Copy link
Contributor

Choose a reason for hiding this comment

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

Nice! This looks really good!

@stevekuznetsov
Copy link
Contributor

/lgtm
/retest

@openshift-ci openshift-ci bot added the lgtm Indicates that a PR is ready to be merged. label May 5, 2024
Copy link
Contributor

openshift-ci bot commented May 5, 2024

@lucaspalm: The following test failed, say /retest to rerun all failed tests or /retest-required to rerun all mandatory failed tests:

Test name Commit Details Required Rerun command
ci/prow/e2e-azure 3c11c28 link false /test e2e-azure

Full PR test history. Your PR dashboard.

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/test-infra repository. I understand the commands that are listed here.

@csrwng
Copy link
Contributor

csrwng commented May 6, 2024

/approve

@csrwng
Copy link
Contributor

csrwng commented May 6, 2024

/override "Red Hat Konflux / hypershift-main-enterprise-contract / hypershift-operator-main"

Copy link
Contributor

openshift-ci bot commented May 6, 2024

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: csrwng, lucaspalm

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 May 6, 2024
Copy link
Contributor

openshift-ci bot commented May 6, 2024

@csrwng: Overrode contexts on behalf of csrwng: Red Hat Konflux / hypershift-main-enterprise-contract / hypershift-operator-main

In response to this:

/override "Red Hat Konflux / hypershift-main-enterprise-contract / hypershift-operator-main"

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/test-infra repository.

@openshift-merge-bot openshift-merge-bot bot merged commit 54f9ed0 into openshift:main May 6, 2024
12 of 14 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. area/hypershift-operator Indicates the PR includes changes for the hypershift operator and API - outside an OCP release jira/valid-reference Indicates that this PR references a valid Jira ticket of any type. lgtm Indicates that a PR is ready to be merged.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants