-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
Conversation
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 **
Welcome @Arvinderpal! It looks like this is your first PR to kubernetes-sigs/kind 🎉 |
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: Arvinderpal If they are not already assigned, you can assign the PR to them by writing 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 |
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.
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. |
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 Once the patch is verified, the new status will be reflected by the 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. |
You can try out the bridge+host-local plugin as so: |
There was a problem hiding this 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.
@@ -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 |
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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 |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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.
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 { |
There was a problem hiding this comment.
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"` |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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
Thanks for the feedback guys! |
I accidentally closed the PR. My bad! |
Sorry I missed this:
There's a weekly SIG-Testing subproject meeting. |
Apologies for the delay |
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. :) |
@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. |
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. |
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