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

enhancement: drop the redundant ApplyUnstructuredResourceImproved return value #1833

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

rexagod
Copy link
Member

@rexagod rexagod commented Oct 14, 2024

Drop the boolean return value that signified if an update happened as it
is not necessary and pollutes the signature.

Signed-off-by: Pranshu Srivastava rexagod@gmail.com


Blocked by (and rebased over) #1823. The relevant commit is 12f2bce.

@rexagod
Copy link
Member Author

rexagod commented Oct 14, 2024

(cc @jan--f)

@openshift-ci openshift-ci bot requested review from deads2k and jsafrane October 14, 2024 20:17
@openshift-merge-robot openshift-merge-robot added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Oct 19, 2024
…urn value

Drop the boolean return value that signified if an update happened as it
is not necessary and pollutes the signature.

Signed-off-by: Pranshu Srivastava <rexagod@gmail.com>
@rexagod rexagod force-pushed the regression-1575-followup branch from 12f2bce to 5a7e66e Compare October 20, 2024 10:57
@openshift-merge-robot openshift-merge-robot removed the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Oct 20, 2024
Comment on lines +127 to +132
unstructuredResource.SetResourceVersion(gotUnstructuredResource.GetResourceVersion())
unstructuredResource.SetGeneration(gotUnstructuredResource.GetGeneration())
unstructuredResource.SetCreationTimestamp(gotUnstructuredResource.GetCreationTimestamp())
unstructuredResource.SetUID(gotUnstructuredResource.GetUID())
unstructuredResource.SetManagedFields(gotUnstructuredResource.GetManagedFields())
require.Equal(t, unstructuredResource.UnstructuredContent(), gotUnstructuredResource.UnstructuredContent())
Copy link
Member Author

Choose a reason for hiding this comment

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

Since we are already doing this now, LMK if the didUpdate function above feels redundant now. I kept it to visualize the workaround for the didUpdate return parameter in the test.

Copy link
Contributor

openshift-ci bot commented Oct 20, 2024

@rexagod: 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.

@@ -72,6 +72,26 @@ func ApplyUnstructuredResourceImproved(
resourceGVR schema.GroupVersionResource,
defaultingFunc mimicDefaultingFunc,
equalityChecker equalityChecker,
) (*unstructured.Unstructured, error) {
Copy link
Member Author

Choose a reason for hiding this comment

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

@jan--f I believe this satisfies the proposed refactor we talked about earlier?

@jan--f
Copy link

jan--f commented Nov 5, 2024

Thanks, I like the slimmer interface.

/lgtm

@openshift-ci openshift-ci bot added the lgtm Indicates that a PR is ready to be merged. label Nov 5, 2024
Copy link
Contributor

openshift-ci bot commented Nov 5, 2024

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: jan--f, rexagod
Once this PR has been reviewed and has the lgtm label, please assign p0lyn0mial for approval. For more information see the Kubernetes Code Review Process.

The full list of commands accepted by this bot can be found 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

@rexagod
Copy link
Member Author

rexagod commented Nov 6, 2024

Once this PR has been reviewed and has the lgtm label, please assign p0lyn0mial for approval.

/cc @p0lyn0mial

@openshift-ci openshift-ci bot requested a review from p0lyn0mial November 6, 2024 10:50
@rexagod
Copy link
Member Author

rexagod commented Nov 11, 2024

cc @deads2k @p0lyn0mial to PTAL 🙏🏼

@@ -32,7 +32,7 @@ func DeleteAlertmanager(ctx context.Context, client dynamic.Interface, recorder

// ApplyPrometheus applies the Prometheus.
func ApplyPrometheus(ctx context.Context, client dynamic.Interface, recorder events.Recorder, required *unstructured.Unstructured) (*unstructured.Unstructured, bool, error) {
return ApplyUnstructuredResourceImproved(ctx, client, recorder, required, noCache, prometheusGVR, nil, nil)
return ApplyUnstructuredResourceImprovedDeprecated(ctx, client, recorder, required, noCache, prometheusGVR, nil, nil)
Copy link
Contributor

Choose a reason for hiding this comment

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

Okay, what is the plan for switching to ApplyUnstructuredResourceImproved?

Copy link
Member Author

Choose a reason for hiding this comment

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

I was thinking of doing that early in the next release to allow enough time for folks to migrate?

@rexagod rexagod requested a review from p0lyn0mial November 18, 2024 09:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
lgtm Indicates that a PR is ready to be merged.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants