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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

馃尡 add support for topology managed fields #5812

Merged

Conversation

fabriziopandini
Copy link
Member

What this PR does / why we need it:
This PR proposes a solution for ensuring the topology controller handles nicely the removal of fields from the template.

The implementation borrows the idea of managed fields from server-side apply in Kubernetes; when executing a change on templates we keep track of the fields the template expressed opinions on (provided a value).

Then, during the next reconcile on the next object, we consider all the managed fields as authoritative paths, meaning that if the corresponding value has been removed from the desired state, we enforce removal from the resulting object.

Which issue(s) this PR fixes:
Fixes #5811

@k8s-ci-robot k8s-ci-robot added do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. 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 Dec 7, 2021
@fabriziopandini
Copy link
Member Author

/test pull-cluster-api-e2e-full-main

@k8s-ci-robot k8s-ci-robot added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Dec 9, 2021
@k8s-ci-robot k8s-ci-robot removed the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Dec 9, 2021
@fabriziopandini fabriziopandini changed the title [WIP] 馃尡 add support for topology managed fields 馃尡 add support for topology managed fields Dec 10, 2021
@k8s-ci-robot k8s-ci-robot removed the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Dec 10, 2021
@k8s-ci-robot k8s-ci-robot added size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files. and removed size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. labels Dec 10, 2021
@sbueringer
Copy link
Member

@sbueringer
Copy link
Member

lgtm pending squash + golangci-lint

@fabriziopandini fabriziopandini force-pushed the topology-managed-fields branch 2 times, most recently from 4e252fa to 0b16f7e Compare December 10, 2021 20:39
Object: map[string]interface{}{
"metadata": map[string]interface{}{
"annotations": map[string]interface{}{
clusterv1.ClusterTopologyManagedFieldsAnnotation: "kubeadmConfigSpec.clusterConfiguration.imageRepository, " +
Copy link
Member

Choose a reason for hiding this comment

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

Should we consider using some sort of encoding for this annotation? The paths can be easily compressed, and we could b64 encode the output

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 kind of like the idea of this being human readable, so was considering something like
{ kubeadmConfigSpec { clusterConfiguration { imageRepository, version }, initConfiguration { ... } } }
But this requires a little encoder/parser and I did not include in this first iteration, but I really want to sort it out before the actual release

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
/lgtm

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Dec 15, 2021
@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: 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:

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 Dec 15, 2021
@k8s-ci-robot k8s-ci-robot merged commit 88b778d into kubernetes-sigs:main Dec 15, 2021
@k8s-ci-robot k8s-ci-robot added this to the v1.1 milestone Dec 15, 2021
@fabriziopandini fabriziopandini deleted the topology-managed-fields branch December 16, 2021 11:19
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/XXL Denotes a PR that changes 1000+ lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Topology reconcile should manage field removal in an intuitive way
4 participants