-
Notifications
You must be signed in to change notification settings - Fork 226
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
API-1835: Don't use Update in removestaleconditionscontroller #1864
base: master
Are you sure you want to change the base?
API-1835: Don't use Update in removestaleconditionscontroller #1864
Conversation
@bertinatto: This pull request references API-1835 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.18.0" version, but no target version was set. 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. |
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: bertinatto 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 |
5b6845e
to
f63e72e
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
conditions []string | ||
operatorClient v1helpers.OperatorClient | ||
controllerInstanceName string | ||
conditions []string |
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.
please rename to conditionTypes
or even conditionTypesToRemove
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.
Renamed to conditionTypesToRemove
} | ||
return factory.New(). | ||
ResyncEvery(time.Minute). | ||
WithSync(c.sync). | ||
WithInformers(operatorClient.Informer()). | ||
ToController( | ||
"RemoveStaleConditionsController", // don't change what is passed here unless you also remove the old FooDegraded condition | ||
c.controllerInstanceName, | ||
eventRecorder.WithComponentSuffix("remove-stale-conditions"), | ||
) | ||
} | ||
|
||
func (c RemoveStaleConditionsController) sync(ctx context.Context, syncContext factory.SyncContext) 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.
would you mind adding some unit tests for the sync function ?
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 some unit tests (bases on the node status controller)
var removedCount int | ||
jsonPatch := jsonpatch.New() | ||
for i, existingCondition := range operatorStatus.Conditions { | ||
for _, conditionToRemove := range c.conditions { |
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.
please rename to conditionTypeToRemove
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.
Done
} | ||
jsonPatch.WithRemove( | ||
fmt.Sprintf("/status/conditions/%d", removeAtIndex), | ||
jsonpatch.NewTestCondition(fmt.Sprintf("/status/conditions/%d/type", removeAtIndex), conditionToRemove), |
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.
is there an e2e test that we could rely on ?
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'm not aware of any
f63e72e
to
cc91110
Compare
cc91110
to
8f287dd
Compare
@bertinatto: This pull request references API-1835 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.18.0" version, but no target version was set. 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: 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-sigs/prow repository. I understand the commands that are listed here. |
@bertinatto: This pull request references API-1835 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.18.0" version, but no target version was set. 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. |
Proof: openshift/cluster-authentication-operator#729
Manual testing done: