Skip to content

Conversation

@kevindelgado
Copy link
Contributor

Fixes #191 by removing support for atomic to granular schema changes.

Now, when a field on a schema is changed from atomic to granular, the schema will be treated as if it was always granular, potentially causing existing managers to own less fields than they did previously. Previously, they would own all the contents of an atomic list/map field, now they will only own the top level field itself and none of its contents.

This was determined to be less worse than incorrectly assuming empty fields were previously atomic (and causing managers to own more fields than they should).

Following this we plan to:

  1. Document this behavior in upstream kubernetes documentation.
  2. Potentially revisit larger sweeping changes that could enable this support in the future (i.e. making the fieldset aware of atomicity, creating a separate "defaulting" manager to handle defaulted fields atomicity, etc)

@k8s-ci-robot
Copy link
Contributor

Hi @kevindelgado. Thanks for your PR.

I'm waiting for a kubernetes-sigs member to verify that this patch is reasonable to test. If it is, they should reply with /ok-to-test on its own line. Until that is done, I will not automatically test new commits in this PR, but the usual testing commands by org members will still work. Regular contributors should join the org to skip this step.

Once the patch is verified, the new status will be reflected by the ok-to-test label.

I understand the commands that are listed here.

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/test-infra repository.

@k8s-ci-robot k8s-ci-robot added the needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. label Mar 31, 2021
@k8s-ci-robot k8s-ci-robot added cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. size/L Denotes a PR that changes 100-499 lines, ignoring generated files. labels Mar 31, 2021
@kevindelgado
Copy link
Contributor Author

I went ahead and removed the atomic-to-granular testing that we had. Let me know if you think there's any testing we need to add with this reversion.

It seemed odd to have tests to explicitly prove we don't support this flow, but let me know if you think anything like that should be added to this change.

FWIW testing to confirm no new fields are added to a top level apply manager will be captured in the testing for the Extract changes (where that behavior is needed), but don't seem super relevant here or in any of the schema reconciliation tests.

@kevindelgado
Copy link
Contributor Author

/assign @jpbetz
/cc @apelisse

@kevindelgado kevindelgado force-pushed the no-atomic-to-granular branch from 2045cd8 to f73880c Compare April 1, 2021 16:47
@kevindelgado kevindelgado requested a review from jpbetz April 1, 2021 16:48
}
}

func TestAtomicToGranularSchemaChanges(t *testing.T) {
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 actually keep the test and update it with the new behavior? If we document what happens when someone goes from atomic to granular, then we should have a test to confirm that behavior.

Copy link
Contributor

Choose a reason for hiding this comment

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

Seems useful to me as well. Might also be worth adding a comment in the tests explaining the behavior further.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done, let me know if the comments are sufficient

func (v *reconcileWithSchemaWalker) doList(t *schema.List) (errs ValidationErrors) {
// reconcile lists changed from granular to atomic
// reconcile lists changed from granular to atomic.
// Note that migrations from atomic to granular are unsuported and will
Copy link
Contributor

Choose a reason for hiding this comment

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

I'd change from "unsported" to "unrecommended", and I'm not sure I understand the consequences from that sentence. (comment also applies to below for maps)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done

@kevindelgado kevindelgado force-pushed the no-atomic-to-granular branch from f73880c to 326ec8e Compare April 1, 2021 17:20
@k8s-ci-robot k8s-ci-robot added size/M Denotes a PR that changes 30-99 lines, ignoring generated files. and removed size/L Denotes a PR that changes 100-499 lines, ignoring generated files. labels Apr 1, 2021
@kevindelgado kevindelgado requested a review from apelisse April 1, 2021 17:20
// Upon changing the schema of struct from
// atomic to granular, manager one continues
// to own the same fielset as before,
// but does not retain ownership of any of the subfields.
Copy link
Contributor

@jpbetz jpbetz Apr 1, 2021

Choose a reason for hiding this comment

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

Also make it clear that this is a known limitation and not the ideal behavior?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

added

@kevindelgado kevindelgado force-pushed the no-atomic-to-granular branch from 326ec8e to 460a665 Compare April 1, 2021 17:32
@k8s-ci-robot k8s-ci-robot added size/L Denotes a PR that changes 100-499 lines, ignoring generated files. and removed size/M Denotes a PR that changes 30-99 lines, ignoring generated files. labels Apr 1, 2021
@kevindelgado kevindelgado requested a review from jpbetz April 1, 2021 17:33
@jpbetz
Copy link
Contributor

jpbetz commented Apr 1, 2021

/lgtm

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Apr 1, 2021
@kevindelgado kevindelgado force-pushed the no-atomic-to-granular branch from 460a665 to 4278010 Compare April 1, 2021 17:35
@k8s-ci-robot k8s-ci-robot removed the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Apr 1, 2021
@kevindelgado
Copy link
Contributor Author

kevindelgado commented Apr 1, 2021

lgtm removed b/c I fixed a comment typo

@jpbetz
Copy link
Contributor

jpbetz commented Apr 1, 2021

/lgtm

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Apr 1, 2021
// be treated as if they were always granular.
//
// In this case, the manager that owned the previously atomic field (and all subfields),
// will now own just the top-level field and none of the subfields.
Copy link
Contributor

Choose a reason for hiding this comment

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

Perfect

@apelisse
Copy link
Contributor

apelisse commented Apr 1, 2021

/approve

Do we have other plans for SMD or should I cut a release once this is merged?

@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: apelisse, kevindelgado

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

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. needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. 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.

Schema Reconciler inaccurately determines whether the node is atomic or not

4 participants