Skip to content

Conversation

@kwiesmueller
Copy link
Member

@kwiesmueller kwiesmueller commented May 2, 2020

The fieldset provided to the update/apply will be excluded from any managedFields changes, but still be reflected in the actual update.

  • Needs more documentation or a better name to clarify this behavior.

/sig api-machinery
/wg api-expression
/cc @apelisse

@k8s-ci-robot k8s-ci-robot requested a review from apelisse May 2, 2020 16:23
@k8s-ci-robot k8s-ci-robot added sig/api-machinery Categorizes an issue or PR as relevant to SIG API Machinery. wg/api-expression Categorizes an issue or PR as relevant to WG API Expression. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. labels May 2, 2020
@apelisse
Copy link
Contributor

apelisse commented May 5, 2020

I'm a little confused why there are all these commits in there, do you need #133? You also have a commit that has already been merged.

@kwiesmueller kwiesmueller force-pushed the ignore-fields branch 4 times, most recently from 72cf25b to 4efc49f Compare May 11, 2020 18:30
}
if ignored != nil {
set = set.RecursiveDifference(ignored)
// TODO: is this correct. If we don't remove from lastSet pruning might remove the fields?
Copy link
Member Author

Choose a reason for hiding this comment

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

After thinking about it again, this might not be required.
Pruning should remove fields from the object if they are not present in newObject and ignored.
Please confirm

Copy link
Contributor

Choose a reason for hiding this comment

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

lastSet.Set().RecursiveDifference(ignored)

I think that has to be wrong, we're not editing "VersionedSet" in place, and also RecursiveDifference returns a new object, so that's a no-op right now.

I would assume that the lastSet has been trimmed already (during the operation that set it), but it's possible that the ignored fields have changed since that manager was written, so doing it again seem reasonable.

Copy link
Contributor

@apelisse apelisse left a comment

Choose a reason for hiding this comment

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

I have

@apelisse
Copy link
Contributor

This is really starting to look good, a few things to fix and we'll be good to go!

Copy link
Contributor

@apelisse apelisse left a comment

Choose a reason for hiding this comment

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

Looks good!

@apelisse
Copy link
Contributor

Daniel, do you want to have a look at that "RecursiveDifference" code?
/assign @lavalamp

name string
a *Set
b *Set
expect *Set
Copy link
Contributor

Choose a reason for hiding this comment

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

Can you add in the expectation for the regular difference? I'm actually not following how this is different?

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 added both differences to the test and added the test i forgot for both.

fieldpath/set.go Outdated
//
// Compared to a regular difference, this recursively removes
// all children from s
// that are either children or members in s2
Copy link
Contributor

Choose a reason for hiding this comment

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

Can we align this comment more with the one for Difference? I'm having a hard time understanding the difference (no pun intended). Feel free to adjust both comments, the existing one isn't amazingly clear.

Copy link
Member Author

Choose a reason for hiding this comment

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

Can you check again?

The difference is, that a Difference only respects fields that are directly specified.
So to remove a.b.c and a.b.d from s, both need to be in s2.
But RecursiveDifference behaves more like deleting a folder that contains folders. It's enough to specify a in s2 and it's members are deleted recursively, or in the case of RecursiveDifference not added to the result.

I tried a few different explanations, but none was really good. I'm open for suggestions :-/

@lavalamp
Copy link
Contributor

Thanks, it's much clearer now.

/approve

(I only looked at the tests & documentation, maybe @apelisse or @jennybuckley can review the rest and lgtm)

@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: kwiesmueller, lavalamp

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 added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label May 26, 2020
@apelisse
Copy link
Contributor

I had a look at the code, thanks!
/lgtm

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label May 27, 2020
@k8s-ci-robot k8s-ci-robot merged commit 8fff187 into kubernetes-sigs:master May 27, 2020
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. sig/api-machinery Categorizes an issue or PR as relevant to SIG API Machinery. size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. wg/api-expression Categorizes an issue or PR as relevant to WG API Expression.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants