Skip to content
This repository was archived by the owner on Oct 14, 2025. It is now read-only.

Commit dcb4419

Browse files
committed
allow to disable Pod network: CNI and routes
1 parent 3f03136 commit dcb4419

File tree

1 file changed

+11
-7
lines changed

1 file changed

+11
-7
lines changed

cmd/kindnetd/main.go

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -67,9 +67,11 @@ var (
6767
controlPlaneEndpoint string
6868
metricsBindAddress string
6969
fastpathThreshold int
70+
disableCNI bool
7071
)
7172

7273
func init() {
74+
flag.BoolVar(&disableCNI, "disable-cni", false, "If set, disable the CNI functionality to add IPs to Pods and routing between nodes (default false)")
7375
flag.BoolVar(&networkpolicies, "network-policy", true, "If set, enable Network Policies (default true)")
7476
flag.BoolVar(&dnsCaching, "dns-caching", false, "If set, enable Kubernetes DNS caching (default false)")
7577
flag.BoolVar(&nat64, "nat64", true, "If set, enable NAT64 using the reserved prefix 64:ff9b::/96 on IPv6 only clusters (default true)")
@@ -186,13 +188,15 @@ func main() {
186188
}
187189

188190
// node controller handles CNI config for our own node and routes to the others
189-
nodeController := kindnetnode.NewNodeController(nodeName, clientset, nodeInformer)
190-
go func() {
191-
err := nodeController.Run(ctx, 5)
192-
if err != nil {
193-
klog.Fatalf("error running routes controller: %v", err)
194-
}
195-
}()
191+
if !disableCNI {
192+
nodeController := kindnetnode.NewNodeController(nodeName, clientset, nodeInformer)
193+
go func() {
194+
err := nodeController.Run(ctx, 5)
195+
if err != nil {
196+
klog.Fatalf("error running routes controller: %v", err)
197+
}
198+
}()
199+
}
196200

197201
// create an ipMasqAgent
198202
if masquerading {

0 commit comments

Comments
 (0)