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

🌱 Add --additional-sync-machine-labels to allow syncing additional labels to Nodes #11650

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

Conversation

ykakarap
Copy link
Contributor

@ykakarap ykakarap commented Jan 7, 2025

What this PR does / why we need it:

Add an flag to the CAPI manager to dictate the labels that should be synced form the Machine to the node. If the flag is not specified it defaults to:

Has node-role.kubernetes.io as prefix.
Belongs to node-restriction.kubernetes.io domain.
Belongs to node.cluster.x-k8s.io domain.

Any value specified by the flag would be additional to the list to default values.

Which issue(s) this PR fixes (optional, in fixes #<issue number>(, fixes #<issue_number>, ...) format, will close the issue(s) when PR gets merged):
Fixes #11657

/area machine

@k8s-ci-robot k8s-ci-robot added area/machine Issues or PRs related to machine lifecycle management 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. labels Jan 7, 2025
@k8s-ci-robot k8s-ci-robot added the size/L Denotes a PR that changes 100-499 lines, ignoring generated files. label Jan 7, 2025
@ykakarap ykakarap force-pushed the sync-machine-labels branch from df52d4f to cb79cc3 Compare January 7, 2025 22:29
@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 Jan 7, 2025
@ykakarap ykakarap force-pushed the sync-machine-labels branch from cb79cc3 to 2d97f8a Compare January 7, 2025 22:52
main.go Outdated Show resolved Hide resolved
@ykakarap ykakarap force-pushed the sync-machine-labels branch from 2d97f8a to 5ff55f6 Compare January 7, 2025 23:06
@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 Jan 7, 2025
@ykakarap ykakarap changed the title [WIP] 🌱 sync machine labels 🌱 sync machine labels Jan 7, 2025
@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 Jan 7, 2025
@ykakarap ykakarap changed the title 🌱 sync machine labels 🌱 sync machine labels to node Jan 7, 2025
@ykakarap ykakarap changed the title 🌱 sync machine labels to node 🌱 sync defined machine labels to node Jan 7, 2025
main.go Outdated Show resolved Hide resolved
@enxebre
Copy link
Member

enxebre commented Jan 8, 2025

Thanks! let's please make sure to add a counter part issue and update the original proposal https://github.com/kubernetes-sigs/cluster-api/blob/12cd150d55330e04b2639396469786a6020a5b82/docs/proposals/20220927-label-sync-between-machine-and-nodes.md

@ykakarap
Copy link
Contributor Author

ykakarap commented Jan 8, 2025

TODO:

  • Update CAPI Book
  • Update the proposal
  • Create issue

@nrb
Copy link
Contributor

nrb commented Jan 9, 2025

Thanks for this!

Something that would be useful here is some sort of wildcard support, in case administrators would like all labels propagated.

@vincepri
Copy link
Member

vincepri commented Jan 9, 2025

Something that would be useful here is some sort of wildcard support, in case administrators would like all labels propagated.

This is supported by setting *

https://github.com/kubernetes-sigs/cluster-api/pull/11650/files#diff-d4d6212206abc46c562f8e0ede7e3c6aa9b87390648a7f25ad96699446b1c525R761-R766

@ykakarap ykakarap force-pushed the sync-machine-labels branch from 5ff55f6 to 804d45d Compare January 9, 2025 21:52
main.go Outdated Show resolved Hide resolved
docs/book/src/reference/api/metadata-propagation.md Outdated Show resolved Hide resolved
@ykakarap ykakarap force-pushed the sync-machine-labels branch from 0c12e60 to 114bd3a Compare January 15, 2025 18:20
@nrb
Copy link
Contributor

nrb commented Jan 16, 2025

@enxebre An issue was created, #11657.

This PR looks good to me; the documentation is clear, and the use of file path globbing would support my intended use case.

@enxebre
Copy link
Member

enxebre commented Jan 16, 2025

/lgtm

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

LGTM label has been added.

Git tree hash: ed1927bdc916768f2a953ecfe84b99405eab3a2d

Copy link
Member

@fabriziopandini fabriziopandini left a comment

Choose a reason for hiding this comment

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

Nice improvement!
/lgtm
@sbueringer @chrischdi for a final pass

internal/controllers/machine/machine_controller_noderef.go Outdated Show resolved Hide resolved
main.go Outdated Show resolved Hide resolved
@k8s-ci-robot k8s-ci-robot added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Jan 22, 2025
@ykakarap ykakarap force-pushed the sync-machine-labels branch from 114bd3a to 3643897 Compare January 23, 2025 18:58
@k8s-ci-robot k8s-ci-robot removed the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Jan 23, 2025
@k8s-ci-robot k8s-ci-robot requested a review from enxebre January 23, 2025 18:58
@k8s-ci-robot
Copy link
Contributor

New changes are detected. LGTM label has been removed.

@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by:
Once this PR has been reviewed and has the lgtm label, please ask for approval from enxebre. For more information see the 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

@ykakarap ykakarap force-pushed the sync-machine-labels branch from 3643897 to 3aeb947 Compare January 23, 2025 19:05
@k8s-ci-robot k8s-ci-robot removed the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Jan 23, 2025
@ykakarap ykakarap force-pushed the sync-machine-labels branch from 3aeb947 to 272b936 Compare January 23, 2025 19:11
Copy link
Member

@sbueringer sbueringer left a comment

Choose a reason for hiding this comment

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

Just a few minor findings

docs/book/src/reference/api/metadata-propagation.md Outdated Show resolved Hide resolved
main.go Outdated Show resolved Hide resolved
@sbueringer sbueringer changed the title 🌱 sync defined machine labels to node 🌱 Add --additional-sync-machine-labels to allow syncing additional labels to Nodes Jan 24, 2025
@ykakarap ykakarap force-pushed the sync-machine-labels branch from 272b936 to 5f8e673 Compare January 24, 2025 22:31
@k8s-ci-robot
Copy link
Contributor

@ykakarap: The following test failed, say /retest to rerun all failed tests or /retest-required to rerun all mandatory failed tests:

Test name Commit Details Required Rerun command
pull-cluster-api-apidiff-main 5f8e673 link false /test pull-cluster-api-apidiff-main

Full PR test history. Your PR dashboard. Please help us cut down on flakes by linking to an open issue when you hit one in your PR.

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/machine Issues or PRs related to machine lifecycle management 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.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Provide configuration to allow users to define their own prefixes to sync labels from Machines to Nodes
8 participants