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-29126: deploymentcontroller: use builder pattern #1679
OCPBUGS-29126: deploymentcontroller: use builder pattern #1679
Conversation
@bertinatto: This pull request references Jira Issue OCPBUGS-29126, 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 |
bfc2f34
to
5fafaba
Compare
@@ -249,3 +309,12 @@ func isProgressing(deployment *appsv1.Deployment) (bool, string) { | |||
} | |||
return false, "" | |||
} | |||
|
|||
func containsCondition(conditions []string, condition string) bool { |
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.
nit: could use slices.Contains from standard library
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.
Replaced
5fafaba
to
d881918
Compare
/lgtm |
/hold cancel |
|
||
func (c *DeploymentController) WithConditions(conditions ...string) *DeploymentController { |
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.
missing doc.
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.
Added docs.
resourcemerge.SetDeploymentGeneration(&newStatus.Generations, deployment) | ||
return nil | ||
// Set Progressing Condition | ||
if slices.Contains(c.conditions, opv1.OperatorStatusTypeProgressing) { |
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.
old code always had these, why make them "sometimes"?
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 idea was to have the possibility to make every condition optional. NewDeploymentController
still always has this by default.
|
||
return factory.New().WithInformers( | ||
// ToController converts the DeploymentController into a factory.Controller. | ||
func (c *DeploymentController) ToController() factory.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.
This could return an error so people would knwo they broke it.
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! Done.
035581c
to
aa6f19d
Compare
aa6f19d
to
a5b4f1b
Compare
@bertinatto: all tests passed! 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. |
/lgtm |
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: bertinatto, deads2k, dusk125 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 |
/jira refresh |
@bertinatto: This pull request references Jira Issue OCPBUGS-29126, which is valid. 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. |
@bertinatto: Jira Issue OCPBUGS-29126: Some pull requests linked via external trackers have merged: The following pull requests linked via external trackers have not merged: These pull request must merge or be unlinked from the Jira bug in order for it to move to the next state. Once unlinked, request a bug refresh with Jira Issue OCPBUGS-29126 has not been moved to the MODIFIED state. 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. |
Fix included in accepted release 4.16.0-0.nightly-2024-05-08-222442 |
This is specially useful for controllers that don't want certain conditions.
CC @openshift/storage