Skip to content
This repository has been archived by the owner on May 6, 2022. It is now read-only.

Detect no-op status updates #2531

Merged

Conversation

luksa
Copy link
Contributor

@luksa luksa commented Dec 18, 2018

This PR is a

  • Bug Fix

What this PR does / why we need it:
When the controller updates the status of an object (e.g. ServiceInstance), it stops reconciling the object and waits for the watch event to come back from the API server, which is when it then resumes the reconciliation. In some cases, the status update does not produce a watch event, because the controller doesn't actually modify the object in the status update (i.e. the state of the object in the request matches the existing object state in the API server). The controller should detect this and continue reconciling the object instead of stopping.

This PR makes the controller detect such no-op status updates. It also fixes a few other problems, where the controller assumed the object was updated, when it really wasn't.

Merge Checklist:

  • New feature
    • Tests
    • Documentation
  • SVCat CLI flag
  • Server Flag for config
    • Chart changes
    • removing a flag by marking deprecated and hiding to avoid
      breaking the chart release and existing clients who provide a
      flag that will get an error when they try to update

@k8s-ci-robot k8s-ci-robot added cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. size/L Denotes a PR that changes 100-499 lines, ignoring generated files. labels Dec 18, 2018
@luksa luksa force-pushed the check_noop_status_update branch 2 times, most recently from e97ae69 to c18b052 Compare December 18, 2018 08:20
@jboyd01
Copy link
Contributor

jboyd01 commented Jan 2, 2019

/approve

@k8s-ci-robot k8s-ci-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Jan 2, 2019
@k8s-ci-robot k8s-ci-robot added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Jan 20, 2019
@jberkhahn
Copy link
Contributor

this looks good, just needs to be rebased

@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: jboyd01

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 removed the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Jan 22, 2019
@luksa
Copy link
Contributor Author

luksa commented Jan 22, 2019

Rebased & resolved conflicts.

@luksa
Copy link
Contributor Author

luksa commented Jan 22, 2019

Please merge #2529 first, since it's included in this PR here, but really should end up as being a separate commit.

These functions try to resolve the service class/plan. If they resolve
it successfully, they just modify the instance object, but don't
actually update it on the server. If they can't resolve it,
the do update the object on the server and they also return an error.

It would be cleaner if they only returned an error and let the caller
perform the actual update. This way, the functions' behavior is
consistent between the two possible outcomes.

This commit does exactly that.
@jberkhahn
Copy link
Contributor

/lgtm

@k8s-ci-robot k8s-ci-robot added the lgtm Indicates that a PR is ready to be merged. label Jan 22, 2019
@k8s-ci-robot k8s-ci-robot merged commit 44a0392 into kubernetes-retired:master Jan 22, 2019
viviyww pushed a commit to viviyww/service-catalog that referenced this pull request May 10, 2019
* Clean up resolveServiceClassRef & similar functions

These functions try to resolve the service class/plan. If they resolve
it successfully, they just modify the instance object, but don't
actually update it on the server. If they can't resolve it,
the do update the object on the server and they also return an error.

It would be cleaner if they only returned an error and let the caller
perform the actual update. This way, the functions' behavior is
consistent between the two possible outcomes.

This commit does exactly that.

* Check for no-op status update when calling updateServiceInstanceCondition

* Fix Fake ServiceInstance client so it mutates object's ResourceVersion

* Check for no-op status update in resolveClusterReferences & resolveNamespacedReferences

* Don't assume updateServiceInstanceStatus() always updates the object
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
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. lgtm Indicates that a PR is ready to be merged. size/L Denotes a PR that changes 100-499 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants