Skip to content
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

Fix CONTAINER_ID with PodSandboxID #213

Merged
merged 3 commits into from
Apr 11, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
4 changes: 2 additions & 2 deletions .golangci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ linters-settings:
dupl:
threshold: 100
funlen:
lines: 100
statements: 50
lines: 110
statements: 55
maiqueb marked this conversation as resolved.
Show resolved Hide resolved
gci:
local-prefixes: github.com/maiqueb/multus-dynamic-networks-controller
goconst:
Expand Down
1 change: 0 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,6 @@ spec:
The `multus-dynamic-networks-controller` configuration is encoded in JSON, and allows the following keys:

- `"criSocketPath"`: specify the path to the CRI socket. Defaults to `/run/containerd/containerd.sock`.
- `"criType"`: either `crio` or `containerd`. Defaults to `containerd`.
- `"multusSocketPath"`: specify the path to the multus socket. Defaults to `/var/run/multus-cni/multus.sock`.

The configuration is defined in a `ConfigMap`, which is defined in the
Expand Down
15 changes: 3 additions & 12 deletions cmd/dynamic-networks-controller/networks-controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,6 @@ import (
"github.com/k8snetworkplumbingwg/multus-dynamic-networks-controller/pkg/config"
"github.com/k8snetworkplumbingwg/multus-dynamic-networks-controller/pkg/controller"
"github.com/k8snetworkplumbingwg/multus-dynamic-networks-controller/pkg/cri"
"github.com/k8snetworkplumbingwg/multus-dynamic-networks-controller/pkg/cri/containerd"
"github.com/k8snetworkplumbingwg/multus-dynamic-networks-controller/pkg/cri/crio"
"github.com/k8snetworkplumbingwg/multus-dynamic-networks-controller/pkg/logging"
"github.com/k8snetworkplumbingwg/multus-dynamic-networks-controller/pkg/multuscni"
)
Expand Down Expand Up @@ -91,9 +89,10 @@ func newController(stopChannel chan struct{}, configuration *config.Multus) (*co

eventBroadcaster := newEventBroadcaster(k8sClient)

containerRuntime, err := newContainerRuntime(configuration)
const shortTimeout = 5 * time.Second
containerRuntime, err := cri.NewRuntime(configuration.CriSocketPath, shortTimeout)
if err != nil {
return nil, fmt.Errorf("failed to create CRI type %s: %v", configuration.CriType, err)
return nil, fmt.Errorf("failed to create CRI runtime (%s): %v", configuration.CriSocketPath, err)
}

podNetworksController, err := controller.NewPodNetworksController(
Expand Down Expand Up @@ -156,14 +155,6 @@ func handleSignals(stopChannel chan struct{}, signals ...os.Signal) {
}()
}

func newContainerRuntime(configuration *config.Multus) (cri.ContainerRuntime, error) {
const shortTimeout = 5 * time.Second
if configuration.CriType == cri.Crio {
return crio.NewRuntime(configuration.CriSocketPath, shortTimeout)
}
return containerd.NewContainerdRuntime(configuration.CriSocketPath, shortTimeout)
}

func controllerVersion() string {
if commitSHA, wasFound := os.LookupEnv("DYNAMIC_NETWORK_CONTROLLER_COMMIT_HASH"); wasFound {
return commitSHA
Expand Down
33 changes: 1 addition & 32 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@ module github.com/k8snetworkplumbingwg/multus-dynamic-networks-controller
go 1.21

require (
github.com/containerd/containerd v1.7.12
github.com/containerd/typeurl/v2 v2.1.1
github.com/containernetworking/cni v1.1.2
github.com/k8snetworkplumbingwg/network-attachment-definition-client v1.5.0
github.com/onsi/ginkgo/v2 v2.15.0
Expand All @@ -17,25 +15,14 @@ require (
k8s.io/client-go v0.29.1
k8s.io/cri-api v0.29.1
k8s.io/klog/v2 v2.120.1
k8s.io/kubelet v0.29.1
)

require (
github.com/AdaLogics/go-fuzz-headers v0.0.0-20230811130428-ced1acdcaa24 // indirect
github.com/AdamKorcz/go-118-fuzz-build v0.0.0-20231105174938-2b5cbb29f3e2 // indirect
github.com/Microsoft/go-winio v0.6.1 // indirect
github.com/Microsoft/hcsshim v0.11.4 // indirect
github.com/containerd/cgroups v1.1.0 // indirect
github.com/containerd/continuity v0.4.3 // indirect
github.com/containerd/fifo v1.1.0 // indirect
github.com/containerd/log v0.1.0 // indirect
github.com/containerd/ttrpc v1.2.2 // indirect
github.com/davecgh/go-spew v1.1.1 // indirect
github.com/docker/go-events v0.0.0-20190806004212-e31b211e4f1c // indirect
github.com/emicklei/go-restful/v3 v3.11.2 // indirect
github.com/evanphx/json-patch v4.12.0+incompatible // indirect
github.com/felixge/httpsnoop v1.0.4 // indirect
github.com/go-logr/logr v1.4.1 // indirect
github.com/go-logr/stdr v1.2.2 // indirect
github.com/go-openapi/jsonpointer v0.20.2 // indirect
github.com/go-openapi/jsonreference v0.20.4 // indirect
github.com/go-openapi/swag v0.22.8 // indirect
Expand All @@ -51,38 +38,20 @@ require (
github.com/imdario/mergo v0.3.16 // indirect
github.com/josharian/intern v1.0.0 // indirect
github.com/json-iterator/go v1.1.12 // indirect
github.com/klauspost/compress v1.17.4 // indirect
github.com/mailru/easyjson v0.7.7 // indirect
github.com/moby/locker v1.0.1 // indirect
github.com/moby/sys/mountinfo v0.7.1 // indirect
github.com/moby/sys/sequential v0.5.0 // indirect
github.com/moby/sys/signal v0.7.0 // indirect
github.com/moby/sys/user v0.1.0 // indirect
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect
github.com/modern-go/reflect2 v1.0.2 // indirect
github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 // indirect
github.com/opencontainers/go-digest v1.0.0 // indirect
github.com/opencontainers/image-spec v1.1.0-rc2.0.20221005185240-3a7f492d3f1b // indirect
github.com/opencontainers/selinux v1.11.0 // indirect
github.com/pkg/errors v0.9.1 // indirect
github.com/sirupsen/logrus v1.9.3 // indirect
github.com/spf13/pflag v1.0.5 // indirect
go.opencensus.io v0.24.0 // indirect
go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.45.0 // indirect
go.opentelemetry.io/otel v1.19.0 // indirect
go.opentelemetry.io/otel/metric v1.19.0 // indirect
go.opentelemetry.io/otel/trace v1.19.0 // indirect
golang.org/x/mod v0.14.0 // indirect
golang.org/x/net v0.20.0 // indirect
golang.org/x/oauth2 v0.16.0 // indirect
golang.org/x/sync v0.6.0 // indirect
golang.org/x/sys v0.16.0 // indirect
golang.org/x/term v0.16.0 // indirect
golang.org/x/text v0.14.0 // indirect
golang.org/x/time v0.5.0 // indirect
golang.org/x/tools v0.17.0 // indirect
google.golang.org/appengine v1.6.8 // indirect
google.golang.org/genproto v0.0.0-20240123012728-ef4313101c80 // indirect
google.golang.org/genproto/googleapis/rpc v0.0.0-20240123012728-ef4313101c80 // indirect
google.golang.org/protobuf v1.32.0 // indirect
gopkg.in/inf.v0 v0.9.1 // indirect
Expand Down
Loading
Loading