-
Notifications
You must be signed in to change notification settings - Fork 37
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
OCPBUGS-24588: use new workload controller with preconditions #247
base: master
Are you sure you want to change the base?
OCPBUGS-24588: use new workload controller with preconditions #247
Conversation
Skipping CI for Draft Pull Request. |
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: RomanBednar 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 |
pkg/operator/config/config.go
Outdated
type Precondition func(ctx context.Context, c *clients.Clients) (bool, error) | ||
type PreconditionFunc func(context.Context) (bool, error) |
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.
Why there are two functions that do the same? IMO only PreconditionFunc
should exist and perhaps be a type defined somewhere in the workload controller.
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 don't remember, probably wanted to keep it separate but there can be just one - changed.
pkg/operator/config/config.go
Outdated
func (o *OperatorControllerConfig) AddPreconditions(c *clients.Clients, builders ...Precondition) { | ||
for _, builder := range builders { | ||
f := func(ctx context.Context) (bool, error) { | ||
return builder(ctx, c) | ||
} | ||
o.Preconditions = append(o.Preconditions, f) | ||
} |
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.
just add preconditions (better PreconditionFuncs) to o.Preconditions
without any closure in between.
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.
Ok, changed.
required, err := c.getDeployment(opSpec) | ||
if err != nil { | ||
return nil, err | ||
} |
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.
syncDeleting
already has required
in its parameters
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.
Overlooked, removing.
return nil, err | ||
} | ||
|
||
return required, nil |
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 controller conditions will be calculated from required
, which is a Deployment loaded from yaml manifests, which is odd.
Currently, I am not sure what would be the right condition. Please add a TODO comment, we can sort it out later.
Personally, I think no conditions at all would be the best. I.e. the controller should remove Available / Progressing, an operator has to add their own condition in this case.
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.
Indeed, dealing with conditions in operator makes sense. Adding a TODO comment for now.
deployment, err = c.syncManaged(ctx, required, opStatus, syncContext) | ||
if err != nil { | ||
errors = append(errors, err) | ||
} |
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.
This should be in else
branch of the previous if
. Otherwise the operator deletes the Deployment and then just re-creates it here.
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.
Thanks for the catch, fixed.
4592d04
to
04ab0d7
Compare
@RomanBednar: This pull request references Jira Issue OCPBUGS-24588, which is invalid:
Comment The bug has been updated to refer to the pull request using the external bug tracker. In response to this:
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. |
/hold openshift/library-go#1815 has to be merged first followed by library-go bump here |
@jsafrane Moved library-go parts to separate PR and addressed all comments. If we can finish this part I think up next is to attempt workloads controller refactor so it can use daemon set as well and after testing this for a while migrate all operators to the new controller. |
/jira refresh |
@RomanBednar: This pull request references Jira Issue OCPBUGS-24588, which is valid. The bug has been moved to the POST state. 3 validation(s) were run on this bug
No GitHub users were found matching the public email listed for the QA contact in Jira (wduan@redhat.com), skipping review request. In response to this:
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. |
@RomanBednar: The following tests failed, say
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-sigs/prow repository. I understand the commands that are listed here. |
ClusterCSIDriver condition when precondition fails:
Controllers can be configured with csi-operator to have multiple preconditions, errors are then aggregated in ClusterCSIDriver: