containerd / Go Cni
Licence: apache-2.0
A generic CNI library to provide APIs for CNI plugin interactions
Stars: ✭ 82
Programming Languages
go
31211 projects - #10 most used programming language
Labels
Projects that are alternatives of or similar to Go Cni
Kube Spawn
A tool for creating multi-node Kubernetes clusters on a Linux machine using kubeadm & systemd-nspawn. Brought to you by the Kinvolk team.
Stars: ✭ 392 (+378.05%)
Mutual labels: cni
Cilium
eBPF-based Networking, Security, and Observability
Stars: ✭ 10,256 (+12407.32%)
Mutual labels: cni
cni-benchmarks
A simple program to benchmark various container networking (CNI) plugins.
Stars: ✭ 85 (+3.66%)
Mutual labels: cni
Kube Ovn
A Kubernetes Network Fabric for Enterprises that is Rich in Functions and Easy in Operations
Stars: ✭ 798 (+873.17%)
Mutual labels: cni
everoute
Everoute provide cloud-native networking and security solution
Stars: ✭ 26 (-68.29%)
Mutual labels: cni
Coil
CNI plugin for Kubernetes designed for scalability and extensibility
Stars: ✭ 81 (-1.22%)
Mutual labels: cni
Bond Cni
Bond-cni is for fail-over and high availability of networking in cloudnative orchestration
Stars: ✭ 36 (-56.1%)
Mutual labels: cni
vsphere-kubernetes-drivers-operator
vSphere Kubernetes Driver Operator to simplify and automate the lifecycle management of CSI and CPI for Kubernetes cluster running on vSphere
Stars: ✭ 21 (-74.39%)
Mutual labels: cni
firecracker-task-driver
nomad task driver that uses firecracker to start micro-vms
Stars: ✭ 85 (+3.66%)
Mutual labels: cni
Cni Genie
CNI-Genie for choosing pod network of your choice during deployment time. Supported pod networks - Calico, Flannel, Romana, Weave
Stars: ✭ 408 (+397.56%)
Mutual labels: cni
Kubernetes The Ansible Way
Bootstrap Kubernetes the Ansible way on Everything (here: Vagrant). Inspired by Kelsey Hightower´s kubernetes-the-hard-way, but refactored to Infrastructure-as-Code.
Stars: ✭ 82 (+0%)
Mutual labels: cni
K Vswitch
k-vswitch is an easy-to-operate, performant and secure Kubernetes networking plugin based on Open vSwitch
Stars: ✭ 71 (-13.41%)
Mutual labels: cni
go-cni
A generic CNI library to provide APIs for CNI plugin interactions. The library provides APIs to:
- Load CNI network config from different sources
- Setup networks for container namespace
- Remove networks from container namespace
- Query status of CNI network plugin initialization
go-cni aims to support plugins that implement Container Network Interface
Usage
package main
import (
"context"
"fmt"
"log"
gocni "github.com/containerd/go-cni"
)
func main() {
id := "example"
netns := "/var/run/netns/example-ns-1"
// CNI allows multiple CNI configurations and the network interface
// will be named by eth0, eth1, ..., ethN.
ifPrefixName := "eth"
defaultIfName := "eth0"
// Initializes library
l, err := gocni.New(
// one for loopback network interface
gocni.WithMinNetworkCount(2),
gocni.WithPluginConfDir("/etc/cni/net.d"),
gocni.WithPluginDir([]string{"/opt/cni/bin"}),
// Sets the prefix for network interfaces, eth by default
gocni.WithInterfacePrefix(ifPrefixName))
if err != nil {
log.Fatalf("failed to initialize cni library: %v", err)
}
// Load the cni configuration
if err := l.Load(gocni.WithLoNetwork, gocni.WithDefaultConf); err != nil {
log.Fatalf("failed to load cni configuration: %v", err)
}
// Setup network for namespace.
labels := map[string]string{
"K8S_POD_NAMESPACE": "namespace1",
"K8S_POD_NAME": "pod1",
"K8S_POD_INFRA_CONTAINER_ID": id,
// Plugin tolerates all Args embedded by unknown labels, like
// K8S_POD_NAMESPACE/NAME/INFRA_CONTAINER_ID...
"IgnoreUnknown": "1",
}
ctx := context.Background()
// Teardown network
defer func() {
if err := l.Remove(ctx, id, netns, gocni.WithLabels(labels)); err != nil {
log.Fatalf("failed to teardown network: %v", err)
}
}()
// Setup network
result, err := l.Setup(ctx, id, netns, gocni.WithLabels(labels))
if err != nil {
log.Fatalf("failed to setup network for namespace: %v", err)
}
// Get IP of the default interface
IP := result.Interfaces[defaultIfName].IPConfigs[0].IP.String()
fmt.Printf("IP of the default interface %s:%s", defaultIfName, IP)
}
Project details
The go-cni is a containerd sub-project, licensed under the Apache 2.0 license. As a containerd sub-project, you will find the:
information in our containerd/project
repository.
Note that the project description data, including the texts, logos, images, and/or trademarks,
for each open source project belongs to its rightful owner.
If you wish to add or remove any projects, please contact us at [email protected].