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 Node watch to Machine controller #3826

Merged

Conversation

sedefsavas
Copy link

What this PR does / why we need it:
Forward porting #3748

@k8s-ci-robot k8s-ci-robot added the cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. label Oct 20, 2020
@k8s-ci-robot k8s-ci-robot added the size/L Denotes a PR that changes 100-499 lines, ignoring generated files. label Oct 20, 2020
@sedefsavas sedefsavas force-pushed the forward_port_nodewatcher branch from 029c28d to 9e99cbf Compare October 20, 2020 00:35
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.

/lgtm

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Oct 20, 2020
if err := r.Client.List(
context.TODO(),
machineList,
client.MatchingFields{clusterv1.MachineNodeNameIndex: node.Name},
Copy link
Contributor

Choose a reason for hiding this comment

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

I didn't catch this in the 0.3 PR, but I just noticed that we're not restricting to machines in a specific namespace or for a specific cluster. We should probably do that, to avoid any possible false positives (e.g. 2 clusters in 2 different VPCs that have the same node name for a node).

func (r *MachineReconciler) nodeToMachine(namespace, clusterName string) func(o client.Object) []reconcile.Request {
  return func(o client.Object) []reconcile.Request {
    // use namespace and clusterName in r.Client.List
  }
}

WDYT? cc @vincepri @fabriziopandini

Copy link
Member

Choose a reason for hiding this comment

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

This makes sense, it helps with potential conflicts, although it needs to be tested if we can mix and match field matchers with normal ones

Copy link
Contributor

Choose a reason for hiding this comment

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

You mean InNamespace + MatchingFields? Any reason to think that wouldn't work?

Copy link
Contributor

Choose a reason for hiding this comment

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

Looking at the CacheReader implementation, it looks like:

  1. If there is a field selector, respect that
  2. Else, if there is a namespace match, use that
  3. Else, list everything

THEN, if there is a label selector, honor that.

So we can't do namespace + field selector 😦

Copy link
Contributor

Choose a reason for hiding this comment

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

Maybe we should enhance this in C-R?

Copy link
Contributor

Choose a reason for hiding this comment

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

Copy link
Member

Choose a reason for hiding this comment

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

Yes, this seems like it could be a good improvement there

Copy link
Member

Choose a reason for hiding this comment

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

Do we want to file an issue and merge this PR as-is for now given that's just forward porting?

Copy link
Contributor

Choose a reason for hiding this comment

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

Yes

@vincepri vincepri changed the title 🌱Forward porting: Add Node watch to Machine controller 🌱 Add Node watch to Machine controller Oct 20, 2020
@vincepri
Copy link
Member

/milestone v0.4.0

@k8s-ci-robot k8s-ci-robot added this to the v0.4.0 milestone Oct 20, 2020
@vincepri
Copy link
Member

/approve

@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 Oct 20, 2020
@k8s-ci-robot k8s-ci-robot merged commit 1319d61 into kubernetes-sigs:master Oct 20, 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. 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.

5 participants