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

Make GetReplicasFromRuntimeObject work for DaemonSets #782

Merged
merged 1 commit into from
Sep 12, 2019

Conversation

mm4tt
Copy link
Contributor

@mm4tt mm4tt commented Sep 9, 2019

This is not an ideal solution as it ignores affinity, but it's a good start and for now should fit our needs.

Ref. #704

@k8s-ci-robot k8s-ci-robot added cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. size/M Denotes a PR that changes 30-99 lines, ignoring generated files. approved Indicates a PR has been approved by an approver from all required OWNERS files. labels Sep 9, 2019
@@ -288,7 +288,7 @@ func GetReplicasFromRuntimeObject(obj runtime.Object) (int32, error) {
}
return 0, nil
case *appsv1.DaemonSet:
return 0, nil
return int32(numNodes), nil
Copy link
Member

Choose a reason for hiding this comment

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

I don't think that's a good way of doing this. In DaemonSet you can set node-selector and then less pods can be created.

So instead of that, I think we should pass a ClientSet to this method and here list nodes with a given label-selector and return this number. I know this has a performance implication, but that isn't something that will be called all the time, and it will be more correct.

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, PTAL

@mm4tt mm4tt force-pushed the daemonset_runtime branch 2 times, most recently from c6781b0 to 5aff778 Compare September 11, 2019 16:39
return numSchedulableNodes, nil
}

// Note: This function assumes each controller has field Spec.Replicas, except Job.
Copy link
Member

Choose a reason for hiding this comment

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

and deaemon set?

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.

@wojtek-t
Copy link
Member

/lgtm

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

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: mm4tt, wojtek-t

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 merged commit 8765bf1 into kubernetes:master Sep 12, 2019
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/M Denotes a PR that changes 30-99 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants