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
Create operatorcondition for operator #1875
Create operatorcondition for operator #1875
Conversation
8b82a1a
to
e3cb5d1
Compare
e3cb5d1
to
3ba448c
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice work @awgreene!
Aside from some more tests, I do want us to think about what this looks like if we implement OperatorCondition
generation as a net-new controller (in the style of the Operator API's controllers). I think we'll want to add features as new controllers when we can, so we can reduce the amount we need to rewrite as we move away from OLM's original controllers.
pkg/lib/ownerutil/util.go
Outdated
@@ -406,6 +406,12 @@ func InferGroupVersionKind(obj runtime.Object) error { | |||
Version: apiextensionsv1beta1.SchemeGroupVersion.Version, | |||
Kind: "CustomResourceDefinition", | |||
}) | |||
case *operatorsv1.OperatorCondition: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I wonder if it's possible to get the GVK from a properly initialized runtime.Scheme
.
Thanks for the detailed review @njhale
Are you proposing that instead of generating the |
Exactly. |
359d1ca
to
6a2f13a
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
looks great!
939f577
to
a0c8076
Compare
a0c8076
to
cbd0fd0
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice work!
pkg/controller/operators/operatoconditiongenerator_controller.go
Outdated
Show resolved
Hide resolved
pkg/controller/operators/operatoconditiongenerator_controller.go
Outdated
Show resolved
Hide resolved
pkg/controller/operators/operatoconditiongenerator_controller.go
Outdated
Show resolved
Hide resolved
pkg/controller/operators/operatoconditiongenerator_controller.go
Outdated
Show resolved
Hide resolved
ad97cf2
to
303f569
Compare
func (r *OperatorConditionReconciler) Reconcile(req ctrl.Request) (ctrl.Result, error) { | ||
// Set up a convenient log object so we don't have to type request over and over again | ||
log := r.log.WithValues("request", req) | ||
log.V(1).Info("reconciling operatorcondition") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
probably don't want 1
log level for this (same comment for the rest of the level-1 logs in this file)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'll bump it up a few levels.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have updated the logging levels in the latest version of this PR.
return err | ||
} | ||
existingRoleBinding := &rbacv1.RoleBinding{} | ||
err := r.Client.Get(context.TODO(), client.ObjectKey{Name: roleBinding.GetName(), Namespace: roleBinding.GetNamespace()}, existingRoleBinding) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The get
s should hit the cache when possible instead of using the client
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Controller runtime uses an inline cache, will likely need to enable it.
pkg/controller/operators/operatorconditiongenerator_controller.go
Outdated
Show resolved
Hide resolved
pkg/controller/operators/operatorconditiongenerator_controller.go
Outdated
Show resolved
Hide resolved
pkg/controller/operators/operatorconditiongenerator_controller.go
Outdated
Show resolved
Hide resolved
a8cf38d
to
d439679
Compare
/retest |
1 similar comment
/retest |
/retest Infra Issues... |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
/lgtm
/retest |
3 similar comments
/retest |
/retest |
/retest |
infra issues |
/retest |
2 similar comments
/retest |
/retest |
98421bb
to
f571cd8
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
/lgtm
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: awgreene, dinhxuanvu 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 |
/retest |
1 similar comment
/retest |
Failed to acquire leases. /retest |
/retest |
/retest Please review the full test history for this PR and help us cut down flakes. |
/retest |
/QE-approved |
Description of the change:
Motivation for the change:
Reviewer Checklist
/docs