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 support for NFD-Master instance flag #56

Merged

Conversation

ArangoGutierrez
Copy link
Contributor

Issue kubernetes-sigs/node-feature-discovery#427 proposed a way to handle multiple NFD instances on a same cluster , this was addressed with kubernetes-sigs/node-feature-discovery#431 patch

this patch updated the operator to support multiple instances of NFD on the same cluster

THIS PATCH MUST BE REVIEWED AND MERGED AFTER #53

@k8s-ci-robot k8s-ci-robot added the cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. label Apr 8, 2021
@k8s-ci-robot k8s-ci-robot requested review from marquiz and zvonkok April 8, 2021 21:42
@k8s-ci-robot k8s-ci-robot added approved Indicates a PR has been approved by an approver from all required OWNERS files. size/L Denotes a PR that changes 100-499 lines, ignoring generated files. labels Apr 8, 2021
@ArangoGutierrez
Copy link
Contributor Author

this PR buils on PR #53 so leaving it on
/hold

@k8s-ci-robot k8s-ci-robot added the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Apr 8, 2021
config/rbac/role.yaml Outdated Show resolved Hide resolved
Comment on lines 315 to 318
for _, c := range obj.Spec.Template.Spec.Containers[0].Command {
if c == instanceFlag {
// all set!
found = true
}
}
Copy link
Contributor

Choose a reason for hiding this comment

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

stupid question: can the instance flag change so that this code is unable to find it?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Good catch!

Copy link
Contributor

Choose a reason for hiding this comment

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

Hmm, could we drop this fragile-looking logic altogether and just forcefully (re-)set the container command line?

E.g. so that build/assets/master/0400_master_daemonset.yaml would have simply command: ["nfd-master"] and we would set obj.Spec.Template.Spec.Containers[0].Args to {"--port=12000"} here and append --instance if necessary. Would make it a lot cleaner and more robust IMO. WDYT?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

agree, also TODO allow users to define the master port via CRD, WDYT?
cc @zvonkok

Copy link
Contributor

Choose a reason for hiding this comment

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

Yes of course. I'm not sure how useful that would be 🤔 Maybe it is

Comment on lines 315 to 318
for _, c := range obj.Spec.Template.Spec.Containers[0].Command {
if c == instanceFlag {
// all set!
found = true
}
}
Copy link
Contributor

Choose a reason for hiding this comment

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

Hmm, could we drop this fragile-looking logic altogether and just forcefully (re-)set the container command line?

E.g. so that build/assets/master/0400_master_daemonset.yaml would have simply command: ["nfd-master"] and we would set obj.Spec.Template.Spec.Containers[0].Args to {"--port=12000"} here and append --instance if necessary. Would make it a lot cleaner and more robust IMO. WDYT?

@k8s-ci-robot k8s-ci-robot added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Apr 13, 2021
@ArangoGutierrez
Copy link
Contributor Author

Now this baby needs rebase

@k8s-ci-robot k8s-ci-robot added size/S Denotes a PR that changes 10-29 lines, ignoring generated files. and removed needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. size/L Denotes a PR that changes 100-499 lines, ignoring generated files. labels Apr 16, 2021
@ArangoGutierrez ArangoGutierrez requested a review from marquiz April 16, 2021 00:56
@ArangoGutierrez
Copy link
Contributor Author

This Patch now looks a lot better and more specific to it's intention
ready for review @marquiz

@@ -30,6 +30,7 @@ spec:
image: $(NODE_FEATURE_DISCOVERY_IMAGE)
name: nfd-master
command: ["nfd-master", "--port=12000"]
args: ["--port=12000"]
Copy link
Contributor

Choose a reason for hiding this comment

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

I think you could/should drop this from here and add it unconditionally in the controller.

@ArangoGutierrez
Copy link
Contributor Author

Will rebase on #63 to unhold

@ArangoGutierrez
Copy link
Contributor Author

/hold cancel

@k8s-ci-robot k8s-ci-robot removed the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Apr 20, 2021
@ArangoGutierrez ArangoGutierrez requested a review from marquiz April 20, 2021 14:17
@ArangoGutierrez
Copy link
Contributor Author

@marquiz this one is now ready to smash

// https://kubernetes-sigs.github.io/node-feature-discovery/v0.8/advanced/master-commandline-reference.html#-instance
if n.ins.Spec.Instance != "" {
instanceFlag := fmt.Sprintf("--instance=%s", n.ins.Spec.Instance)
obj.Spec.Template.Spec.Containers[0].Args = []string{portFlag, instanceFlag}
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: I think it would be neater and more future-proof (if we add more flags) to use append() here

@ArangoGutierrez ArangoGutierrez requested a review from marquiz April 20, 2021 16:21
Issue kubernetes-sigs/node-feature-discovery#427 proposed a way to
handle multiple NFD instances on a same cluster , this was addressed
with kubernetes-sigs/node-feature-discovery#431 patch

this patch updated the operator to support multiple instances of NFD on
the same cluster

Signed-off-by: Carlos Eduardo Arango Gutierrez <carangog@redhat.com>
Copy link
Contributor

@marquiz marquiz left a comment

Choose a reason for hiding this comment

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

I like this @ArangoGutierrez! Good work 😎

/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 20, 2021
@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: ArangoGutierrez, marquiz

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:
  • OWNERS [ArangoGutierrez,marquiz]

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 0d926be into kubernetes-sigs:master Apr 20, 2021
@marquiz marquiz mentioned this pull request Oct 26, 2021
13 tasks
@ArangoGutierrez ArangoGutierrez deleted the devel/instance-flag branch March 13, 2023 10:32
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/S Denotes a PR that changes 10-29 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants