Skip to content
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

CreateOrUpdate should only update status if it is specified #580

Merged
merged 1 commit into from
Mar 28, 2023

Conversation

tpantelis
Copy link
Contributor

We saw an issue with a K8s Deployment where the existing resource had a status field and the new resource had an empty status field but CreateOrUpdate still tried to update the status which led to an eventual conflict failure due to retries exhausted. The reason for this is that it merely compares the original and new statuses for equality. We should first check if the new status is even specified.

In addition:

  • Removed the UpdateStatusFunc from the K8s resource.Interface implementations (Deployment, DaemonSet et al). The K8s controllers own the status for these resources and we should never be updating it.

  • Added a resource.ToJSON function to provide a more user-frendly output then the default Go object stringer. Also JSON outputs pointer values rather than their addresses..

We saw an issue with a K8s Deployment where the existing resource
had a status field and the new resource had an empty status field
but CreateOrUpdate still tried to update the status which led to an
eventual conflict failure due to retries exhausted. The reason for
this is that it merely compares the original and new statuses for
equality. We should first check if the new status is even
specified.

In addition:

- Removed the UpdateStatusFunc from the K8s resource.Interface
  implementations (Deployment, DaemonSet et al). The K8s controllers
  own the status for these resources and we should never be updating
  it.

- Added a resource.ToJSON function to provide a more user-frendly output
  then the default Go object stringer. Also JSON outputs pointer values
  rather than their addresses..

Signed-off-by: Tom Pantelis <[email protected]>
@submariner-bot
Copy link
Contributor

🤖 Created branch: z_pr580/tpantelis/fix_update_status

@github-advanced-security
Copy link

You have successfully added a new Grype configuration .github/workflows/linting.yml:vulnerability-scan. As part of the setup process, we have scanned this repository and found no existing alerts. In the future, you will see all code scanning alerts on the repository Security tab.

@skitt skitt merged commit a6d6971 into submariner-io:devel Mar 28, 2023
@submariner-bot
Copy link
Contributor

🤖 Closed branches: [z_pr580/tpantelis/fix_update_status]

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants