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

Add logic to set the operator's status in the NFD CR #84

Closed

Conversation

courtneypacheco
Copy link
Contributor

Add logic that sets the operator's status in the NFD CR based on whether one or more of NFD's resources is: degraded, progressing, upgradeable, or available. Also add a "applyComponents" function to simplify readability.

@k8s-ci-robot k8s-ci-robot added cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. labels Aug 26, 2021
@k8s-ci-robot
Copy link
Contributor

Hi @courtneypacheco. Thanks for your PR.

I'm waiting for a kubernetes-sigs member to verify that this patch is reasonable to test. If it is, they should reply with /ok-to-test on its own line. Until that is done, I will not automatically test new commits in this PR, but the usual testing commands by org members will still work. Regular contributors should join the org to skip this step.

Once the patch is verified, the new status will be reflected by the ok-to-test label.

I understand the commands that are listed here.

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.

@k8s-ci-robot k8s-ci-robot added the size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. label Aug 26, 2021
@courtneypacheco
Copy link
Contributor Author

/assign @ArangoGutierrez

Copy link
Contributor

@marquiz marquiz left a comment

Choose a reason for hiding this comment

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

Thanks @courtneypacheco! Could you rebase this on top of latest master. It would make the review far more easier (to not see the effects of merge(s))

/ok-to-test

@k8s-ci-robot k8s-ci-robot added ok-to-test Indicates a non-member PR verified by an org member that is safe to test. and removed needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. labels Aug 27, 2021
@courtneypacheco
Copy link
Contributor Author

courtneypacheco commented Aug 30, 2021

@marquiz Thanks! I noticed some of my tests failed, so I'm adding fixes. I will certainly rebase and squash. :)

Add logic that sets the operator's status in the NFD CR based on
whether one or more of NFD's resources is: degraded, progressing,
upgradeable, or available. Also add a "applyComponents" function
to simplify readability.
@courtneypacheco
Copy link
Contributor Author

@marquiz Just squashed commits and rebased. PTAL.

@courtneypacheco courtneypacheco mentioned this pull request Sep 7, 2021
@ArangoGutierrez
Copy link
Contributor

@marquiz Just squashed commits and rebased. PTAL.

@marquiz lgtm?

Copy link
Contributor

@ArangoGutierrez ArangoGutierrez left a comment

Choose a reason for hiding this comment

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

This works downstream
waiting on @marquiz for lgtm

@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: ArangoGutierrez, courtneypacheco

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

@k8s-ci-robot k8s-ci-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Sep 28, 2021
Copy link
Contributor

@marquiz marquiz left a comment

Choose a reason for hiding this comment

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

Thanks for the PR!

I gave it a quick look, not ready for merging, yet 😉 I'm most concerned about the dependency to openshift. I know we already have some but we should keep it at a very minimum (and possibly eliminate some of the existing, too)

rstatus, err := r.getSecurityContextConstraintsConditions(ctx)
if rstatus.isDegraded {
return r.updateDegradedCondition(instance, err.Error(), err)

Copy link
Contributor

Choose a reason for hiding this comment

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

Unneeded empty line. Ditto X times below

Comment on lines +153 to +155
} else if err != nil {
return r.updateDegradedCondition(instance, conditionFailedGettingNFDScc, err)
}
Copy link
Contributor

Choose a reason for hiding this comment

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

Always first check for error, then other conditions. Ditto X times below

Also, you could streamline a bit. Suggestion:

if rstatus, err := r.getSecurityContextConstraintsConditions(ctx); err != nil {
...
} else if rstatus.isDegraded {
...
}

Comment on lines +257 to +259
if result != nil {
return *result, nil
}
Copy link
Contributor

Choose a reason for hiding this comment

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

Looks suspicious, masking the error 😦

Comment on lines +317 to +318

// update ports
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: unrelated

"errors"
"time"

conditionsv1 "github.com/openshift/custom-resource-status/conditions/v1"
Copy link
Contributor

Choose a reason for hiding this comment

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

Hmm, I'm not sure we want to depend on downstream (openshift) at least this heavily 🧐 I think we should use k8s metav1 (k8s.io/apimachinery/pkg/apis/meta/v1).

Maybe ConditionTypes is something that we could use from openshift 🤔 Or then just copy paste those here in order to break the dependency

@k8s-ci-robot
Copy link
Contributor

@courtneypacheco: PR needs rebase.

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.

@k8s-ci-robot k8s-ci-robot added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Sep 29, 2021
@ArangoGutierrez
Copy link
Contributor

Superseed by #88
/close

@k8s-ci-robot
Copy link
Contributor

@ArangoGutierrez: Closed this PR.

In response to this:

Superseed by #88
/close

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.

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. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. ok-to-test Indicates a non-member PR verified by an org member that is safe to test. size/XL Denotes a PR that changes 500-999 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants