Commit Graph

1041 Commits

Author SHA1 Message Date
Sebastian Scheinkman
b0db0e4d0c Merge pull request #1528 from schsebabot/devtask-b25fc0a0-create-coderabbityaml-for-multus-cni
Create .coderabbit.yaml for multus-cni
2026-08-04 22:03:25 +03:00
thomasferrandiz
776fccd09a Merge pull request #1517 from Basavaraju-G/fix-flaky-server-test
fix(test): fix test file collision in pkg/server and pkg/multus tests
2026-08-04 09:45:46 +02:00
thomasferrandiz
2e79055d7d Merge pull request #1522 from k8snetworkplumbingwg/dependabot/go_modules/golang.org/x/net-0.55.0
Bump golang.org/x/net from 0.53.0 to 0.55.0
2026-07-31 12:25:48 +02:00
dependabot[bot]
db72eee672 Bump golang.org/x/net from 0.53.0 to 0.55.0
Bumps [golang.org/x/net](https://github.com/golang/net) from 0.53.0 to 0.55.0.
- [Commits](https://github.com/golang/net/compare/v0.53.0...v0.55.0)

---
updated-dependencies:
- dependency-name: golang.org/x/net
  dependency-version: 0.55.0
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>
2026-07-30 15:33:08 +00:00
thomasferrandiz
c06ce574f7 Merge pull request #1526 from k8snetworkplumbingwg/dependabot/go_modules/google.golang.org/grpc-1.82.1
Bump google.golang.org/grpc from 1.79.3 to 1.82.1
2026-07-30 17:31:35 +02:00
schsebabot
f1d012eab4 chore: add .coderabbit.yaml configuration
Add a .coderabbit.yaml configuration file to enable CodeRabbit
AI-powered code reviews for the multus-cni project.

The configuration includes:
- Review profile and path filters (excluding vendor/ and go.sum)
- Path-specific review instructions for Go source, CNI core logic,
  thick/thin plugin server, K8s client, types, network utilities,
  DRA/kubelet integration, binary entry points, manifests,
  deployments, Dockerfiles, E2E tests, unit tests, hack scripts,
  go.mod, CI workflows, crypto/TLS, and GoReleaser
- Security scanners (gitleaks, semgrep, checkov, hadolint, trivy,
  osvScanner, actionlint, ast-grep)
- Knowledge base and chat configuration

Signed-off-by: SchSeba <schseba@gmail.com>
2026-07-30 11:26:43 +00:00
dependabot[bot]
574080f8f7 Bump google.golang.org/grpc from 1.79.3 to 1.82.1
Bumps [google.golang.org/grpc](https://github.com/grpc/grpc-go) from 1.79.3 to 1.82.1.
- [Release notes](https://github.com/grpc/grpc-go/releases)
- [Commits](https://github.com/grpc/grpc-go/compare/v1.79.3...v1.82.1)

---
updated-dependencies:
- dependency-name: google.golang.org/grpc
  dependency-version: 1.82.1
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>
2026-07-25 01:02:02 +00:00
Ben Pickard
6386911021 Merge pull request #1521 from chent1996/fix/conflist-del-ip-leak-fork
fix(types): preserve conflist delegate config so DEL does not leak IPs
2026-07-23 16:39:22 -04:00
Chen Tang
1688144568 fix(multus): preserve delegate bytes when cniVersion injection fails
CmdDel: do not clobber delegate Bytes when cniVersion injection
fails. Assign to a temporary and only overwrite on success, so DEL
keeps the original config instead of running with nil input, which
would risk leaking the IP.

Signed-off-by: Chen Tang <tangchen1234567@gmail.com>
2026-07-21 20:34:33 +08:00
Chen Tang
6597fa65f5 fix(types): preserve conflist delegate config so DEL does not leak IPs
A clusterNetwork loaded from a .conflist path was reconstructed via the
lossy cnitypes.PluginConf, dropping CNI-specific fields (calico's
kubeconfig/datastore_type/policy, etc). ADD survived by using the
complete CNINetworkConfigList, but DEL used the stripped Bytes, so
calico could not build its datastore client, never released the IP, and
leaked one address per teardown.

- LoadDelegateNetConfFromConfList: rebuild Bytes losslessly from the
  libcni raw bytes (per-plugin, covering subdirectory-chain plugins)
  instead of marshaling the lossy NetConfList; assign Bytes once after
  deviceID/cni-args injection (fixes deviceID-without-cni-args drop)
- collapse the redundant CNINetworkConfigList field; conflistAdd now
  uses Bytes uniformly, removing the dual source of truth and the TODO
- CmdDel: inject cniVersion onto raw Bytes via InjectCNIVersionInConfList
  instead of re-marshaling the lossy ConfList (second stripping point)
- add regression tests for field preservation, subdirectory-chain
  plugins, and cniVersion injection

Signed-off-by: Chen Tang <tangchen1234567@gmail.com>
2026-07-21 20:34:33 +08:00
Ben Pickard
5e0dff04e0 Merge pull request #1512 from miheer/bump-k8s-1.36.1
Bump Kubernetes dependencies to 1.36.2
2026-07-17 13:54:31 -04:00
Miheer Salunke
fbfe6fbac5 Bump Kubernetes to 1.36.2 and Go to 1.26
Commands run:

go get k8s.io/api@v0.36.2 k8s.io/apimachinery@v0.36.2 k8s.io/client-go@v0.36.2 k8s.io/kubelet@v0.36.2

go mod tidy

go mod vendor

go test ./cmd/cert-approver

go test ./pkg/k8sclient

go test ./pkg/checkpoint ./pkg/cmdutils ./pkg/logging

GOOS=linux make build

podman run --rm --privileged -v /Users/misalunk/go/src/github.com/k8snetworkplumbingwg/multus-cni:/workspace:Z -w /workspace -e GO111MODULE=on -e GOFLAGS="-mod=vendor -p=1" -e GOCACHE=/tmp/go-build-cache registry.ci.openshift.org/ocp/builder:rhel-9-golang-1.26-openshift-5.0 bash -lc 'mkdir -p /etc/cni/net.d /var/lib/cni/multus/results && printf "package main\nfunc main(){}\n" > /tmp/true.go && CGO_ENABLED=0 go build -o /tmp/truebin /tmp/true.go && cp /tmp/truebin /usr/bin/true && ./hack/test-go.sh'

podman build --platform linux/arm64 --tag localhost/multus-cni:go126-thin --file images/Dockerfile .

podman build --platform linux/arm64 --tag localhost/multus-cni:go126-thick --file images/Dockerfile.thick .

podman build --platform linux/arm64 --tag localhost/multus-cni:go126-debug --file images/Dockerfile.debug .

podman build --platform linux/amd64 --tag localhost/multus-cni:go126-e2e-thin-amd64 --file images/Dockerfile .

podman build --platform linux/amd64 --tag localhost/multus-cni:go126-e2e-thick-amd64 --file images/Dockerfile.thick .

ruby -e 'require "yaml"; ARGV.each { |file| YAML.parse_file(file); puts "valid YAML: #{file}" }' .github/workflows/test.yml .github/workflows/build.yml .github/workflows/release.yml
2026-07-17 22:46:35 +05:30
Sebastian Scheinkman
7235e831cb Merge pull request #1492 from rollandf/dra-resourcename
feat: DRA resource.k8s.io/v1 integration via draclient
2026-07-08 15:32:24 +03:00
Basavaraju-G
f80583bddc fix(test): use unique temp file path in pkg/server tests
Both pkg/multus and pkg/server tests used /tmp/foo.multus.conf as the
readiness indicator file. Since go test ./... runs packages in parallel,
pkg/multus AfterEach would delete the file while pkg/server STATUS/GC
tests were polling for it, causing intermittent failures.

Rename to /tmp/foo.multus.server-test.conf to avoid the collision.
2026-06-28 14:48:44 +00:00
Fred Rolland
88504f20f7 server: fix ignoreReadinessIndicator being silently skipped when no server config is set
overrideCNIConfigWithServerConfig returned the client config unchanged
whenever overrideConf was empty, bypassing the readinessindicatorfile
key-stripping logic even when ignoreReadinessIndicator=true. This
caused STATUS and GC handlers to poll for the readiness indicator file
for up to 45 s in tests that create the server with
ignoreReadinessIndicator=true and no server-side config override.

Also remove the now-unused sets import.

Signed-off-by: Fred Rolland <frolland@nvidia.com>
2026-06-24 22:31:24 +03:00
Fred Rolland
0913b1c3a1 draclient: use field selectors and lightweight device index for ResourceSlice cache
Replace full ResourceSlice object cache with a flat deviceInfoCacheKey→deviceInfo
index. Populate lazily per driver using combined spec.nodeName+spec.driver field
selectors derived from pod.Spec.NodeName, reducing API response size to a single
node's slices for one driver. Device lookup becomes O(1). Add ctx propagation to
GetPodResourceMap interface.

Signed-off-by: Fred Rolland <frolland@nvidia.com>
2026-06-24 22:31:17 +03:00
Fred Rolland
42212e292e draclient: do not fail CNI when a DRA claim contributes nothing
- If every allocation result for a claim is skipped (no slice match, missing
  Multus deviceID/resourceName, etc.), log a warning and continue to the next
  claim instead of returning an error, so kubelet/device-plugin entries stay
  usable (hybrid legacy VF + broken or irrelevant DRA claims).
- getDeviceInfo: treat missing multus deviceID on a matched device as the same
  skippable sentinel as “not in slice”, avoiding a misleading final error.
- Tests: expect nil error for unmapped claims; add case preserving pre-filled
  resource map entries; keep VF+GPU success with empty GPU slice.
- k8sclient: stub kubelet ResourceClient in DRA failure test; logging: Warningf.

Signed-off-by: Fred Rolland <frolland@nvidia.com>
2026-06-03 17:01:33 +03:00
Fred Rolland
fb5099758c feat: DRA resource.k8s.io/v1 integration via draclient
Migrate Dynamic Resource Allocation from kubelet PodResources / v1alpha2-style usage to the stable resource.k8s.io/v1 API (Kubernetes 1.34+).

- Add pkg/draclient: fetch ResourceClaims and ResourceSlices, build pod resource map from device attributes (k8s.cni.cncf.io/deviceID, k8s.cni.cncf.io/resourceName) and ExtendedResourceClaimStatus
- Wire GetPodResourceMap into k8sclient; remove DRA path from kubeletclient
- RBAC: resourceclaims, resourceclaims/status, resourceslices (get, list) on multus ClusterRole
- Docs: DRA / NAD usage; tests for draclient and k8sclient

Co-authored-by: Sebastian Sch <sebassch@gmail.com>
Signed-off-by: Fred Rolland <frolland@nvidia.com>
2026-06-03 17:01:33 +03:00
Ben Pickard
db30741512 Merge pull request #1510 from hrntknr/limit_listener
Add connection limit for thick daemon.
v4.3.0
2026-05-29 11:05:10 -04:00
Ben Pickard
66efbb5a98 Merge pull request #1509 from bpickard22/enable-pprof
Add optional pprof endpoint support to multus-daemon
2026-05-27 09:06:29 -04:00
Takanori Hirano
c0feb7fea7 Validate multus daemon connection limit 2026-05-27 04:06:52 +00:00
Julius Hinze
1ce45bb658 Add connection limit for thick daemon.
Co-authored-by: Takanori Hirano <me@hrntknr.net>
2026-05-27 03:47:27 +00:00
Benjamin Pickard
9063a32fe1 Add optional pprof endpoint support to multus-daemon
Add pprof profiling endpoints to the metrics server, gated behind
a new EnablePprof config field. When enabled, standard Go pprof
handlers are registered on the metrics port under /debug/pprof/.

This also improves the metrics server setup:
- Use dedicated http.ServeMux instead of DefaultServeMux
- Move mux/handler setup outside the retry loop
- Use http.Server with ReadHeaderTimeout for resource safety
- Add graceful shutdown on context cancellation

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Signed-off-by: Benjamin Pickard <bpickard@redhat.com>
2026-05-20 16:25:35 -04:00
Ben Pickard
bd3f2a56c8 Merge pull request #1494 from k8snetworkplumbingwg/pin-actions-to-sha
Pin GH Actions to commit sha
2026-04-29 11:29:33 -04:00
thomasferrandiz
e10870dbcf Merge pull request #1491 from k8snetworkplumbingwg/dependabot/go_modules/google.golang.org/grpc-1.79.3
Bump google.golang.org/grpc from 1.73.0 to 1.79.3
2026-04-14 16:43:16 +02:00
Ben Pickard
522324cea1 Merge pull request #1472 from RamLavi/fix_alpine_short_name
e2e: Use fully qualified image name for images
2026-04-01 14:31:56 -04:00
Ben Pickard
7247264d92 Merge pull request #1476 from dgsponer/master
Add "nad" as shortName
2026-04-01 14:04:12 -04:00
Thomas Ferrandiz
6a6fb45fd8 Pin GH Actions to commit sha 2026-03-25 13:25:45 +00:00
Ben Pickard
132c5e7e79 Merge pull request #1490 from tsorya/jkary-fix-status-gc-no-pod-context
Fix thick plugin STATUS and GC handling for plugin-level commands
2026-03-23 15:39:43 -04:00
Ben Pickard
157e72f375 Merge pull request #1478 from pliurh/kubeconfig
k8sclient: use ServerVersion instead of pod list for kubeconfig validation
2026-03-19 09:00:03 -04:00
dependabot[bot]
75ac52c2c0 Bump google.golang.org/grpc from 1.73.0 to 1.79.3
Bumps [google.golang.org/grpc](https://github.com/grpc/grpc-go) from 1.73.0 to 1.79.3.
- [Release notes](https://github.com/grpc/grpc-go/releases)
- [Commits](https://github.com/grpc/grpc-go/compare/v1.73.0...v1.79.3)

---
updated-dependencies:
- dependency-name: google.golang.org/grpc
  dependency-version: 1.79.3
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>
2026-03-19 09:13:36 +00:00
thomasferrandiz
d801f0f407 Merge pull request #1487 from yingwang-0320/CORENET-6865-rebase
Bump multus-cni to Kube 1.35 and Go to 1.25
2026-03-19 10:12:17 +01:00
Igal Tsoiref
caedfea615 Address PR review nits from pliurh
- Check os.OpenFile error in STATUS/GC test
- Document that k8sArgs may be nil for STATUS/GC in HandleCNIRequest

Made-with: Cursor
2026-03-18 23:21:46 -04:00
Jason Kary
ec08b5fa8b Fix thick plugin STATUS and GC handling for plugin-level commands
STATUS and GC are plugin-level commands with no pod context per the
CNI 1.1.0 spec. The thick plugin daemon incorrectly required
CNI_CONTAINERID, CNI_NETNS, and K8S_POD_NAME/K8S_POD_NAMESPACE for
these commands, causing failures when invoked by kubelet.

Signed-off-by: Jason Kary <jkary@redhat.com>
2026-03-18 23:21:46 -04:00
Peng Liu
ddd00fe48b k8sclient: fix per-node kubeconfig fallback
Validate the per-node kubeconfig when a current certificate is
available and fall back to the bootstrap kubeconfig only when the
per-node config is no longer trusted.

Also rebuild the derived per-node rest.Config from the reloaded
bootstrap config so TLS settings are preserved and refreshed
consistently.

Signed-off-by: Peng Liu <pliu@redhat.com>
2026-03-17 15:06:12 +08:00
Peng Liu
f36f591be9 k8sclient: use ServerVersion instead of pod list for kubeconfig validation
Listing all pods across all namespaces during bootstrap is expensive
in large clusters and unnecessary since the result is discarded.
Use the lightweight /version endpoint to validate connectivity instead.

Signed-off-by: Peng Liu <pliu@redhat.com>
2026-03-17 14:42:53 +08:00
Ben Pickard
6eb8514eef Merge pull request #1481 from cathy-zhou/sortedResourcesUpstream
Sort DeviceIDs in GetPodResourceMap for deterministic ordering
2026-03-16 15:50:00 -04:00
Yun Zhou
1f27f0e331 Sort DeviceIDs in GetPodResourceMap for deterministic ordering
When a namespace uses a primary User-Defined Network (UDN) with a
device-plugin resource (e.g. SR-IOV), OVN-Kubernetes uses the last
device in the list for the primary interface while Multus assigns
earlier devices to cluster-default/secondary interfaces. The kubelet
and checkpoint paths build the list from map iteration, so order was
non-deterministic and the "last" device could differ between callers.
Sorting ensures both Multus and OVN-K8s see the same order so the
last device is consistently the one reserved for the primary UDN.

Signed-off-by: Yun Zhou <yunz@nvidia.com>
2026-03-16 11:46:51 -07:00
Ying Wang
4b82deaab3 fix error of no such tool covdata
Signed-off-by: Ying Wang <yingwang@rehat.com>
2026-03-13 10:22:30 -04:00
Ying Wang
33e7e49a1d fix make test error: informer synchronization timeouts in multus_cni100_test.go
Signed-off-by: Ying Wang <yingwang@rehat.com>
2026-03-13 09:28:48 -04:00
Ying Wang
eac883137c update go version to 1.25 in dockerfile and workflows files
Signed-off-by: Ying Wang <yingwang@rehat.com>
2026-03-13 12:16:22 +08:00
Ying Wang
0f1255133e multus-cni kube 1.35 rebase
Signed-off-by: Ying Wang <yingwang@rehat.com>
2026-03-13 11:31:21 +08:00
Ben Pickard
7063fb6206 Merge pull request #1484 from bpickard22/fix-trivy-ci
ci: update trivy-action to v0.35.0 to fix image scanning failure
2026-03-10 23:05:07 -04:00
Benjamin Pickard
9b9fb443b2 ci: update trivy-action to v0.35.0 to fix image scanning failure
The trivy-action@0.29.0 was trying to install Trivy v0.57.1 which
no longer exists in the GitHub releases. This was causing all PR
builds to fail on the "Image thick plugin" job. Update to v0.35.0
which properly installs the latest Trivy version.

Assisted by Claude Sonnet 4.5

Signed-off-by: Benjamin Pickard <bpickard@redhat.com>
2026-03-10 17:07:51 -04:00
Diego Gsponer
5dd752d9fc Add "nad" as shortName 2026-02-18 14:27:55 +01:00
Ben Pickard
705a59eaf9 Merge pull request #1470 from trozet/add_status_delegation
Adds support for CNI STATUS + other fixes for CNI Spec 1.1.0
v4.2.4
2026-02-17 15:22:32 -05:00
Tim Rozet
c943f9ffa2 thin_entrypoint: use conflist template for cniVersion >= 1.0.0
Fix thin auto-config generation to select 00-multus.conflist for
all CNI versions >= 1.0.0 (not only exact 1.0.0)

Signed-off-by: Tim Rozet <trozet@nvidia.com>
2026-02-13 14:23:57 -05:00
Tim Rozet
56d18efde0 support GC for single-plugin delegates in CmdGC
support only existed for confList before.

Signed-off-by: Tim Rozet <trozet@nvidia.com>
2026-02-13 14:17:41 -05:00
Tim Rozet
921191dece Dynamically determine version for empty ADD result
So that we can be compatible with 1.1.0.

Signed-off-by: Tim Rozet <trozet@nvidia.com>
2026-02-13 13:55:00 -05:00
Tim Rozet
e091897b4c Update gateway-result handling for 1.1.0
Signed-off-by: Tim Rozet <trozet@nvidia.com>
2026-02-13 13:48:35 -05:00