| Lorenz Brun | c607bf6 | 2025-07-22 20:25:26 +0200 | [diff] [blame^] | 1 | From 9bd63f7ca7d4a248f31600bb09fe1c828d40115a Mon Sep 17 00:00:00 2001 |
| 2 | From: Lorenz Brun <lorenz@monogon.tech> |
| 3 | Date: Wed, 6 Aug 2025 04:07:56 +0200 |
| 4 | Subject: [PATCH] Use our CNI adapter instead of go-cni |
| 5 | |
| 6 | We're not really using CNI here, just straight-up intercepting the Go |
| 7 | calls and redirecting them to us. |
| 8 | --- |
| 9 | cmd/ctr/commands/run/run.go | 2 +- |
| 10 | cmd/ctr/commands/tasks/kill.go | 2 +- |
| 11 | internal/cri/server/cni_conf_syncer.go | 2 +- |
| 12 | internal/cri/server/sandbox_run.go | 2 +- |
| 13 | internal/cri/server/sandbox_run_test.go | 2 +- |
| 14 | internal/cri/server/service.go | 2 +- |
| 15 | internal/cri/server/service_linux.go | 2 +- |
| 16 | internal/cri/server/service_other.go | 2 +- |
| 17 | internal/cri/server/service_test.go | 2 +- |
| 18 | internal/cri/server/service_windows.go | 2 +- |
| 19 | internal/cri/store/sandbox/metadata.go | 2 +- |
| 20 | internal/cri/testing/fake_cni_plugin.go | 2 +- |
| 21 | internal/cri/types/sandbox_info.go | 2 +- |
| 22 | 13 files changed, 13 insertions(+), 13 deletions(-) |
| 23 | |
| 24 | diff --git a/cmd/ctr/commands/run/run.go b/cmd/ctr/commands/run/run.go |
| 25 | index 365f77746..298f004f2 100644 |
| 26 | --- a/cmd/ctr/commands/run/run.go |
| 27 | +++ b/cmd/ctr/commands/run/run.go |
| 28 | @@ -24,7 +24,7 @@ import ( |
| 29 | "strings" |
| 30 | |
| 31 | "github.com/containerd/console" |
| 32 | - gocni "github.com/containerd/go-cni" |
| 33 | + gocni "source.monogon.dev/metropolis/node/kubernetes/containerd/cniproxy" |
| 34 | specs "github.com/opencontainers/runtime-spec/specs-go" |
| 35 | "github.com/urfave/cli/v2" |
| 36 | |
| 37 | diff --git a/cmd/ctr/commands/tasks/kill.go b/cmd/ctr/commands/tasks/kill.go |
| 38 | index 78b5584e2..d03a2aa48 100644 |
| 39 | --- a/cmd/ctr/commands/tasks/kill.go |
| 40 | +++ b/cmd/ctr/commands/tasks/kill.go |
| 41 | @@ -23,7 +23,7 @@ import ( |
| 42 | |
| 43 | containerd "github.com/containerd/containerd/v2/client" |
| 44 | "github.com/containerd/containerd/v2/cmd/ctr/commands" |
| 45 | - gocni "github.com/containerd/go-cni" |
| 46 | + gocni "source.monogon.dev/metropolis/node/kubernetes/containerd/cniproxy" |
| 47 | "github.com/containerd/log" |
| 48 | "github.com/containerd/typeurl/v2" |
| 49 | "github.com/moby/sys/signal" |
| 50 | diff --git a/internal/cri/server/cni_conf_syncer.go b/internal/cri/server/cni_conf_syncer.go |
| 51 | index 822e7e54a..646286c4e 100644 |
| 52 | --- a/internal/cri/server/cni_conf_syncer.go |
| 53 | +++ b/internal/cri/server/cni_conf_syncer.go |
| 54 | @@ -22,7 +22,7 @@ import ( |
| 55 | "path/filepath" |
| 56 | "sync" |
| 57 | |
| 58 | - "github.com/containerd/go-cni" |
| 59 | + "source.monogon.dev/metropolis/node/kubernetes/containerd/cniproxy" |
| 60 | "github.com/containerd/log" |
| 61 | "github.com/fsnotify/fsnotify" |
| 62 | ) |
| 63 | diff --git a/internal/cri/server/sandbox_run.go b/internal/cri/server/sandbox_run.go |
| 64 | index 3142efb72..1e26479f6 100644 |
| 65 | --- a/internal/cri/server/sandbox_run.go |
| 66 | +++ b/internal/cri/server/sandbox_run.go |
| 67 | @@ -26,7 +26,7 @@ import ( |
| 68 | "strings" |
| 69 | "time" |
| 70 | |
| 71 | - "github.com/containerd/go-cni" |
| 72 | + "source.monogon.dev/metropolis/node/kubernetes/containerd/cniproxy" |
| 73 | "github.com/containerd/log" |
| 74 | "github.com/containerd/typeurl/v2" |
| 75 | runtime "k8s.io/cri-api/pkg/apis/runtime/v1" |
| 76 | diff --git a/internal/cri/server/sandbox_run_test.go b/internal/cri/server/sandbox_run_test.go |
| 77 | index 3b3b01187..7c643f7c7 100644 |
| 78 | --- a/internal/cri/server/sandbox_run_test.go |
| 79 | +++ b/internal/cri/server/sandbox_run_test.go |
| 80 | @@ -21,7 +21,7 @@ import ( |
| 81 | "net" |
| 82 | "testing" |
| 83 | |
| 84 | - "github.com/containerd/go-cni" |
| 85 | + "source.monogon.dev/metropolis/node/kubernetes/containerd/cniproxy" |
| 86 | "github.com/stretchr/testify/assert" |
| 87 | runtime "k8s.io/cri-api/pkg/apis/runtime/v1" |
| 88 | ) |
| 89 | diff --git a/internal/cri/server/service.go b/internal/cri/server/service.go |
| 90 | index 8b65b1465..4ffe73acc 100644 |
| 91 | --- a/internal/cri/server/service.go |
| 92 | +++ b/internal/cri/server/service.go |
| 93 | @@ -26,7 +26,7 @@ import ( |
| 94 | "sync/atomic" |
| 95 | "time" |
| 96 | |
| 97 | - "github.com/containerd/go-cni" |
| 98 | + "source.monogon.dev/metropolis/node/kubernetes/containerd/cniproxy" |
| 99 | "github.com/containerd/log" |
| 100 | "github.com/containerd/typeurl/v2" |
| 101 | imagespec "github.com/opencontainers/image-spec/specs-go/v1" |
| 102 | diff --git a/internal/cri/server/service_linux.go b/internal/cri/server/service_linux.go |
| 103 | index a115e5f67..c9451e41e 100644 |
| 104 | --- a/internal/cri/server/service_linux.go |
| 105 | +++ b/internal/cri/server/service_linux.go |
| 106 | @@ -25,7 +25,7 @@ import ( |
| 107 | |
| 108 | "github.com/containerd/containerd/v2/pkg/cap" |
| 109 | "github.com/containerd/containerd/v2/pkg/kernelversion" |
| 110 | - "github.com/containerd/go-cni" |
| 111 | + "source.monogon.dev/metropolis/node/kubernetes/containerd/cniproxy" |
| 112 | "github.com/containerd/log" |
| 113 | ) |
| 114 | |
| 115 | diff --git a/internal/cri/server/service_other.go b/internal/cri/server/service_other.go |
| 116 | index 70e050f11..4b027730a 100644 |
| 117 | --- a/internal/cri/server/service_other.go |
| 118 | +++ b/internal/cri/server/service_other.go |
| 119 | @@ -19,7 +19,7 @@ |
| 120 | package server |
| 121 | |
| 122 | import ( |
| 123 | - "github.com/containerd/go-cni" |
| 124 | + "source.monogon.dev/metropolis/node/kubernetes/containerd/cniproxy" |
| 125 | ) |
| 126 | |
| 127 | // initPlatform handles initialization of the CRI service for non-windows |
| 128 | diff --git a/internal/cri/server/service_test.go b/internal/cri/server/service_test.go |
| 129 | index b6d9ecfb3..7dc40781d 100644 |
| 130 | --- a/internal/cri/server/service_test.go |
| 131 | +++ b/internal/cri/server/service_test.go |
| 132 | @@ -20,7 +20,7 @@ import ( |
| 133 | "context" |
| 134 | |
| 135 | "github.com/containerd/errdefs" |
| 136 | - "github.com/containerd/go-cni" |
| 137 | + "source.monogon.dev/metropolis/node/kubernetes/containerd/cniproxy" |
| 138 | "github.com/containerd/platforms" |
| 139 | imagespec "github.com/opencontainers/image-spec/specs-go/v1" |
| 140 | |
| 141 | diff --git a/internal/cri/server/service_windows.go b/internal/cri/server/service_windows.go |
| 142 | index 1bf71413f..0ebae652d 100644 |
| 143 | --- a/internal/cri/server/service_windows.go |
| 144 | +++ b/internal/cri/server/service_windows.go |
| 145 | @@ -19,7 +19,7 @@ package server |
| 146 | import ( |
| 147 | "fmt" |
| 148 | |
| 149 | - "github.com/containerd/go-cni" |
| 150 | + "source.monogon.dev/metropolis/node/kubernetes/containerd/cniproxy" |
| 151 | ) |
| 152 | |
| 153 | // windowsNetworkAttachCount is the minimum number of networks the PodSandbox |
| 154 | diff --git a/internal/cri/store/sandbox/metadata.go b/internal/cri/store/sandbox/metadata.go |
| 155 | index 20fe2f1d1..8a2d22aa5 100644 |
| 156 | --- a/internal/cri/store/sandbox/metadata.go |
| 157 | +++ b/internal/cri/store/sandbox/metadata.go |
| 158 | @@ -20,7 +20,7 @@ import ( |
| 159 | "encoding/json" |
| 160 | "fmt" |
| 161 | |
| 162 | - cni "github.com/containerd/go-cni" |
| 163 | + cni "source.monogon.dev/metropolis/node/kubernetes/containerd/cniproxy" |
| 164 | runtime "k8s.io/cri-api/pkg/apis/runtime/v1" |
| 165 | ) |
| 166 | |
| 167 | diff --git a/internal/cri/testing/fake_cni_plugin.go b/internal/cri/testing/fake_cni_plugin.go |
| 168 | index fcc060f1c..cac2d5173 100644 |
| 169 | --- a/internal/cri/testing/fake_cni_plugin.go |
| 170 | +++ b/internal/cri/testing/fake_cni_plugin.go |
| 171 | @@ -19,7 +19,7 @@ package testing |
| 172 | import ( |
| 173 | "context" |
| 174 | |
| 175 | - cni "github.com/containerd/go-cni" |
| 176 | + cni "source.monogon.dev/metropolis/node/kubernetes/containerd/cniproxy" |
| 177 | ) |
| 178 | |
| 179 | // FakeCNIPlugin is a fake plugin used for test. |
| 180 | diff --git a/internal/cri/types/sandbox_info.go b/internal/cri/types/sandbox_info.go |
| 181 | index 49acadae8..fbe6af925 100644 |
| 182 | --- a/internal/cri/types/sandbox_info.go |
| 183 | +++ b/internal/cri/types/sandbox_info.go |
| 184 | @@ -17,7 +17,7 @@ |
| 185 | package types |
| 186 | |
| 187 | import ( |
| 188 | - "github.com/containerd/go-cni" |
| 189 | + "source.monogon.dev/metropolis/node/kubernetes/containerd/cniproxy" |
| 190 | "github.com/opencontainers/runtime-spec/specs-go" |
| 191 | runtime "k8s.io/cri-api/pkg/apis/runtime/v1" |
| 192 | |
| 193 | -- |
| 194 | 2.49.0 |
| 195 | |