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

Support for CNCF containernetworking plugins #281

Closed
wants to merge 1 commit into from

Conversation

Arvinderpal
Copy link

@Arvinderpal Arvinderpal commented Feb 8, 2019

Add support for CNCF containernetworking plugins; in particular, bridge and host-local ipam.
This approach extends KinD's Config with 3 additional fields: CNI, Config File Name and Config File Body.
If these fields are specified then KinD will copy the config file to the /etc/cni/net.d directory under the desired name.
In theory, this approach should work with other plugins that only require a configuration file and their binaries have already been placed in the /opt/cni/bin directory.
** WIP **

Addresses the following issue: #280

bridge and host-local ipam.
This approach extends KinD's Config with 3 additional fields:
CNI, Config File Name and Config File Body.
If these fields are specified then KinD will copy the config
file to the /etc/cni/net.d directory under the desired name.
In theory this approach should work with other plugins that only
require a configuration file and their binaries have already
been placed in the /opt/cni/bin directory.
** WIP **
@k8s-ci-robot
Copy link
Contributor

Welcome @Arvinderpal! It looks like this is your first PR to kubernetes-sigs/kind 🎉

@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: Arvinderpal
To fully approve this pull request, please assign additional approvers.
We suggest the following additional approver: bentheelder

If they are not already assigned, you can assign the PR to them by writing /assign @bentheelder in a comment when ready.

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
Copy link
Contributor

Thanks for your pull request. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).

📝 Please follow instructions at https://git.k8s.io/community/CLA.md#the-contributor-license-agreement to sign the CLA.

It may take a couple minutes for the CLA signature to be fully registered; after that, please reply here with a new comment and we'll verify. Thanks.


  • If you've already signed a CLA, it's possible we don't have your GitHub username or you're using a different email address. Check your existing CLA data and verify that your email is set on your git commits.
  • If you signed the CLA as a corporation, please sign in with your organization's credentials at https://identity.linuxfoundation.org/projects/cncf to be authorized.
  • If you have done the above and are still having issues with the CLA being reported as unsigned, please email the CNCF helpdesk: [email protected]

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/test-infra repository. I understand the commands that are listed here.

@k8s-ci-robot k8s-ci-robot added cncf-cla: no Indicates the PR's author has not signed the CNCF CLA. needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. labels Feb 8, 2019
@k8s-ci-robot
Copy link
Contributor

Hi @Arvinderpal. Thanks for your PR.

I'm waiting for a kubernetes-sigs or kubernetes member to verify that this patch is reasonable to test. If it is, they should reply with /ok-to-test on its own line. Until that is done, I will not automatically test new commits in this PR, but the usual testing commands by org members will still work. Regular contributors should join the org to skip this step.

Once the patch is verified, the new status will be reflected by the ok-to-test label.

I understand the commands that are listed here.

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/test-infra repository.

@k8s-ci-robot k8s-ci-robot added the size/L Denotes a PR that changes 100-499 lines, ignoring generated files. label Feb 8, 2019
@Arvinderpal
Copy link
Author

You can try out the bridge+host-local plugin as so:
kind create cluster --config docs/user/kind-bridge-ipv4-config.yaml

@Arvinderpal Arvinderpal mentioned this pull request Feb 8, 2019
Copy link
Member

@neolit123 neolit123 left a comment

Choose a reason for hiding this comment

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

thanks for the PR @Arvinderpal
added some comments
we probably need to make some decision of how to handle different CNIs first and figure out IPV6 at the same time.

pkg/cluster/config/types.go Show resolved Hide resolved
pkg/cluster/config/types.go Show resolved Hide resolved
@@ -43,6 +43,12 @@ type Node struct {
// Role defines the role of the nodw in the in the Kubernetes cluster managed by `kind`
// Defaults to "control-plane"
Role NodeRole
// CNI is the name of the desired network plugin
CNI string
Copy link
Member

Choose a reason for hiding this comment

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

if we are going to add these they should be under a CNI object and here it should be a pointer so that we can use omitifempty with conjunction with the types.go from v1alpha2

Copy link
Author

Choose a reason for hiding this comment

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

That's a good idea. So something like?
type CNI struct{
CNIType string
CNIConfigFileName string
CNIConfig []string
}

@@ -0,0 +1,41 @@
# this config file contains all config fields with comments
Copy link
Member

Choose a reason for hiding this comment

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

if this file is added should it be linked from the docs?
possibly a separate PR should add this file and link to docs?

Copy link
Author

Choose a reason for hiding this comment

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

Perhaps an "examples" folder would be more appropriate. We will likely have additional configurations for different scenarios -- e.g. IPv4/IPv6 single/multi node with various cni plugins.

@neolit123
Copy link
Member

you can sign the CLA @Arvinderpal
just follow the instructions the bot gave and after you are done call this command /check-cla

@k8s-ci-robot k8s-ci-robot added cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. and removed cncf-cla: no Indicates the PR's author has not signed the CNCF CLA. labels Feb 8, 2019
@neolit123
Copy link
Member

you can sign the CLA @Arvinderpal

ok, looks like you signed it already. :)

@@ -96,6 +96,10 @@ func (n *Node) CopyFrom(source, dest string) error {
return docker.CopyFrom(n.nameOrID, source, dest)
}

func (n *Node) MkDirPath(dirPath string) error {
Copy link
Member

Choose a reason for hiding this comment

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

this seems awfully specific?

@@ -42,6 +42,12 @@ type Node struct {
// Role defines the role of the nodw in the in the Kubernetes cluster managed by `kind`
// Defaults to "control-plane"
Role NodeRole `json:"role,omitempty"`
// CNI is the name of the desired network plugin
CNI string `json:"cni,omitempty"`
Copy link
Member

Choose a reason for hiding this comment

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

are we going to put different CNI per node?

Copy link
Author

Choose a reason for hiding this comment

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

That's a good point.
I don't think that's a very likely scenario, but at the same time I don't believe there is any strict requirement that all nodes in a cluster use the same CNI plugin. For example, a particular set of nodes may have specialized NICs for which a different CNI plugin may be desirable.

Copy link
Member

Choose a reason for hiding this comment

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

we should definitely move the CNI object outside of the Node and into the main Config object.
CNI should be per cluster.

Copy link
Author

Choose a reason for hiding this comment

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

@neolit123 CNIConfig can contain node specific data. For example, the host-local ipam consists of fields (e.g. subnet, gateway, routes) that are node specific (https://github.com/containernetworking/plugins/tree/master/plugins/ipam/host-local)
I suspect that this will not play well with Replicas since nodes will not be exact copies of each other. However, this is something that can be documented.

Copy link
Member

Choose a reason for hiding this comment

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

For example, a particular set of nodes may have specialized NICs for which a different CNI plugin may be desirable.

But these are not on real NICs.

I also think having CNI config is perhaps not the right level of complexity for kind. Most CNI are deployable as a k8s manifest, I think we can support that or not installing a CNI at all and leaving it to the end user. Ref #278

@Arvinderpal
Copy link
Author

Arvinderpal commented Feb 8, 2019

Thanks for the feedback guys!
I would love to help out with this effort. On that note, are there any periodic syncs/meetings where such topics are discussed?

@Arvinderpal Arvinderpal closed this Feb 8, 2019
@Arvinderpal
Copy link
Author

I accidentally closed the PR. My bad!

@Arvinderpal Arvinderpal reopened this Feb 8, 2019
@BenTheElder
Copy link
Member

Sorry I missed this:

I would love to help out with this effort. On that note, are there any periodic syncs/meetings where such topics are discussed?

There's a weekly SIG-Testing subproject meeting.
https://github.com/kubernetes/community/blob/master/sig-list.md

@BenTheElder
Copy link
Member

Apologies for the delay
/priority backlog
I'd prefer to let this come after the next release. So far we're testing Kubernetes / kubeadm, and apps on top. Testing CNIs with kind is neat but originally unplanned territory and we're trying to stabilize the config in particular so I'd like to think a bit more before adding anything to it.

@k8s-ci-robot k8s-ci-robot added the priority/backlog Higher priority than priority/awaiting-more-evidence. label Feb 14, 2019
@Arvinderpal
Copy link
Author

Hi, no worries. This does bloat the Config so if there is a cleaner solution that would be preferred. Most if not all major CNIs provide manifests. With these smaller CNIs however, there are no such manifests available but in theory it should be possible to create them. I'll look into it. :)

@k8s-ci-robot
Copy link
Contributor

@Arvinderpal: PR needs rebase.

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/test-infra repository.

@k8s-ci-robot k8s-ci-robot added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Feb 21, 2019
@BenTheElder
Copy link
Member

SGTM, let's do a new PR moving this into EG the node image build, or override the manifest in config (and just depend on pulling the images) ref: #340.

Going forward the manifest is now not pulled from weave's site except as a fallback for old images, it is pulled from the node instead.

stg-0 added a commit to stg-0/kind that referenced this pull request Sep 11, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. priority/backlog Higher priority than priority/awaiting-more-evidence. 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.

4 participants