MCPcopy Index your code
hub / github.com/cybozu-go/coil

github.com/cybozu-go/coil @v2.14.2

Chat with this repo
repository ↗ · DeepWiki ↗ · release v2.14.2 ↗ · + Follow
684 symbols 2,208 edges 104 files 218 documented · 32%
What it actually does AI analysis from the code graph — generated when you open this
loading…
README

GitHub release CI PkgGoDev Go Report Card

Coil

Coil is a CNI-based network plugin for Kubernetes.

Coil is designed with respect to the UNIX philosophy. You can combine Coil with any routing software and/or any network policy implementation.

Coil allows to define multiple IP address pools. You can define a pool of global IPv4 addresses for a small number of pods and another pool of private IPv4 addresses for the remaining pods.

There are blog articles about Coil: https://blog.kintone.io/archive/category/Coil

Status

Version 2 is generally available (GA). It conforms to CNI spec 1.1.0.

Dependencies

  • Kubernetes Version: 1.32, 1.33, 1.34

    • Other versions are likely to work, but not tested.
  • (Optional) Routing software

    • Coil has a simple routing software for flat L2 networks.
    • If your network is not flat, use BIRD or similar software to advertise the routes.

Features

  • Address pools

    Coil can have multiple pools of IP addresses for different purposes. By setting a special annotation to a namespace, you can specify a pool for the pods in that namespace.

  • IPv4/IPv6 dual stack

    In addition to IPv4-only and IPv6-only stacks, Coil can define dual stack address pools.

  • Running with any routing software

    Coil provides a simple router for clusters where all the nodes are in a flat L2 network. This router, called coil-router, is optional.

    For more complex networks, Coil exports routing information to an unused kernel routing table. By importing the routes from the table, any routing software can advertise them.

  • On-demand NAT for egress traffics

    Coil can implement SNAT on Kubernetes. You can define SNAT routers for external networks as many as you want.

    Only selected pods can communicate with external networks via SNAT routers.

  • Auto MTU configuration

    Coil detects the optimal MTU and configures MTU for container networks.

Refer to the design document for more information on these features.

Quick start

Coil can run on kind clusters using Docker.

Prepare a recent Ubuntu and install Docker and Go, then run:

$ cd v2
$ make certs
$ make image

$ cd e2e
$ make start
$ make install-coil
$ ../bin/kubectl apply -f manifests/default_pool.yaml

Now you can play with Coil.

Usage examples

Project Neco uses Coil with these software:

Coil can work with Cilium through its generic veth chaining feature.

Documentation

Installation procedures are described in docs/setup.md.

The user manual is docs/usage.md.

docs directory contains other documents about designs and specifications.

Upgrade from v1

See coil-migrator.md

License

Coil is licensed under the Apache License, Version 2.0.

Extension points exported contracts — how you extend this code

RouteExporter (Interface)
RouteExporter exports subnets to a Linux kernel routing table. [4 implementers]
v2/pkg/nodenet/route_exporter.go
NATSetup (Interface)
NATSetup represents a NAT setup function for Pods. [2 implementers]
v2/runners/coild_server.go
RouteSyncer (Interface)
RouteSyncer is the interface to program direct routing. [4 implementers]
v2/pkg/nodenet/route_syncer.go
PodNetwork (Interface)
PodNetwork represents an interface to configure container networking. [3 implementers]
v2/pkg/nodenet/pod.go
NodeIPAM (Interface)
NodeIPAM manages IP address assignments to Pods on each node. [3 implementers]
v2/pkg/ipam/node.go
Server (Interface)
Server defines the interface for NAT server implementations. It manages client registrations and routing for egress NAT [2 …
v2/pkg/nat/server.go

Core symbols most depended-on inside this repo

Update
called by 53
v2/pkg/nodenet/pod.go
Run
called by 38
v2/pkg/metrics/collector.go
List
called by 25
v2/pkg/nodenet/pod.go
Start
called by 19
v2/runners/router.go
newInternalError
called by 17
v2/runners/coild_server.go
allocate
called by 17
v2/pkg/ipam/node.go
Allocate
called by 16
v2/pkg/ipam/node.go
AddPeer
called by 15
v2/pkg/founat/fou.go

Shape

Method 331
Function 250
Struct 87
Interface 13
TypeAlias 2
FuncType 1

Languages

Go100%

Modules by API surface

v2/api/v2/zz_generated.deepcopy.go52 symbols
v2/pkg/cnirpc/cni.pb.go41 symbols
v2/pkg/founat/client.go33 symbols
v2/pkg/ipam/node.go31 symbols
v2/pkg/nodenet/pod.go29 symbols
v2/runners/coild_server.go26 symbols
v2/pkg/cnirpc/cni_grpc.pb.go26 symbols
v2/controllers/mock_test.go26 symbols
v2/pkg/founat/fou.go22 symbols
v2/runners/coild_server_test.go20 symbols
v2/e2e/coil_test.go19 symbols
v2/pkg/ipam/pool.go17 symbols

For agents

$ claude mcp add coil \
  -- python -m otcore.mcp_server <graph>

⬇ download graph artifact

Ask about this repo answers extend the page