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

🐛 Apply conditions patch should preserve LastTransitionTime #3179

Conversation

fabriziopandini
Copy link
Member

What this PR does / why we need it:
This PR fixes a nasty bug when applying a condition patch with and add operation with the path happening on a different second than the one where the condition was set on the target object.

The PR also align the variable names used for the objects involved in the three-way merge with the one used by the patch helper (before, after, latest), so there will be less confusion were looking at the code

Which issue(s) this PR fixes
Fixes #3178

@k8s-ci-robot k8s-ci-robot added the cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. label Jun 10, 2020
@k8s-ci-robot k8s-ci-robot added approved Indicates a PR has been approved by an approver from all required OWNERS files. size/L Denotes a PR that changes 100-499 lines, ignoring generated files. labels Jun 10, 2020
@fabriziopandini
Copy link
Member Author

/assign @benmoss

@benmoss
Copy link

benmoss commented Jun 10, 2020

Great branch name 😄

@benmoss
Copy link

benmoss commented Jun 10, 2020

Looks like it's not flaky anymore too 😸 . I'll try to make a patch to fix it if I can figure it out.

@benmoss
Copy link

benmoss commented Jun 10, 2020

This is one solution to fixing this test now: https://gist.github.com/benmoss/14ac414bccdfbce903ee4db43da7f18b

go-cmp will end up using https://golang.org/pkg/time/#Time.Equal rather than Gomega's Equal matcher which ends up using reflect.DeepEqual. It's a whole nightmare then of reflect.DeepEqual compares private fields on time.Time structs, and why UTC times have nil locations but those that are coming back from the API server are in local time.

Copy link
Contributor

@JoelSpeed JoelSpeed left a comment

Choose a reason for hiding this comment

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

+1 for the name changes in patch.go, much clearer this way I think

util/conditions/setter.go Outdated Show resolved Hide resolved
util/conditions/setter.go Show resolved Hide resolved
@fabriziopandini fabriziopandini force-pushed the apply-conditions-patch-should-preserve-lasttransitiontime branch from 88f233b to bb93a8a Compare June 11, 2020 19:58
@fabriziopandini
Copy link
Member Author

/retest

1 similar comment
@fabriziopandini
Copy link
Member Author

/retest

@fabriziopandini fabriziopandini force-pushed the apply-conditions-patch-should-preserve-lasttransitiontime branch from a690b64 to 2b50149 Compare June 11, 2020 20:58
Copy link
Member

@vincepri vincepri left a comment

Choose a reason for hiding this comment

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

/approve
/milestone v0.3.7

@k8s-ci-robot k8s-ci-robot added this to the v0.3.7 milestone Jun 11, 2020
@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: fabriziopandini, vincepri

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:
  • OWNERS [fabriziopandini,vincepri]

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@vincepri
Copy link
Member

/lgtm

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Jun 11, 2020
@k8s-ci-robot k8s-ci-robot merged commit c97bdd7 into kubernetes-sigs:master Jun 11, 2020
@fabriziopandini fabriziopandini deleted the apply-conditions-patch-should-preserve-lasttransitiontime branch June 16, 2020 12:11
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. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. lgtm "Looks good to me", 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.

Flaky test: Patch Helper Should patch conditions
5 participants