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

refactor: add default update and status functions #544

Merged
merged 1 commit into from May 7, 2023

Conversation

akrejcir
Copy link
Collaborator

@akrejcir akrejcir commented May 2, 2023

What this PR does / why we need it:
Added default update and status functions for most resources that are reconciled by the operator.

Release note:

None

Added default update and status functions for most resources that are
reconciled by the operator.

Signed-off-by: Andrej Krejcir <akrejcir@redhat.com>
@kubevirt-bot kubevirt-bot added release-note-none Denotes a PR that doesn't merit a release note. dco-signoff: yes Indicates the PR's author has DCO signed all their commits. labels May 2, 2023
@sonarcloud
Copy link

sonarcloud bot commented May 2, 2023

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 0 Code Smells

No Coverage information No Coverage information
0.0% 0.0% Duplication

@akrejcir
Copy link
Collaborator Author

akrejcir commented May 2, 2023

/cc @ksimon1 @0xFelix

@kubevirt-bot kubevirt-bot requested a review from ksimon1 May 2, 2023 12:16
Copy link
Member

@0xFelix 0xFelix left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

/approve


case *core.Service:
foundService := foundObj.(*core.Service)
// ClusterIP should not be updated
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What does this mean?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The ClusterIP field is set be the API server and is immutable. The problem is that newObj does not have the ClusterIP set, so if we would simply set the sepc:

foundObj.spec = newObj.spec

it would set ClusterIP to nil, and the update would fail.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ACK

@kubevirt-bot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: 0xFelix

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

@kubevirt-bot kubevirt-bot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label May 2, 2023
@ksimon1
Copy link
Member

ksimon1 commented May 3, 2023

lgtm (not adding /, for awareness of Ben)
@codingben you will have to probably adjust again the PR with TTO migration

foundObj.(*promv1.ServiceMonitor).Spec = newTyped.Spec

default:
panic(fmt.Sprintf("Default update is not supported for type: %T", newObj))
Copy link
Member

@codingben codingben May 7, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We'll need to add also pipeline.Task and pipeline.Pipeline after your PR is merged, right?

Copy link
Member

@codingben codingben left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

/lgtm

@kubevirt-bot kubevirt-bot added the lgtm Indicates that a PR is ready to be merged. label May 7, 2023
@kubevirt-bot kubevirt-bot merged commit b879899 into kubevirt:master May 7, 2023
9 of 10 checks passed
@akrejcir akrejcir deleted the default-update-func branch May 8, 2023 19:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. dco-signoff: yes Indicates the PR's author has DCO signed all their commits. lgtm Indicates that a PR is ready to be merged. release-note-none Denotes a PR that doesn't merit a release note. size/L
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants