Skip to content

Conversation

@dougbtv
Copy link
Member

@dougbtv dougbtv commented Apr 3, 2025

If a net-attach-def with a whereabouts configuration was missing ranges, a comparison of the missing property would cause the node slice controller to crash

Given an invalid config, such as:

[fedora@kubecon-demo crds]$ cat ~/poison-nad.yml 
apiVersion: "k8s.cni.cncf.io/v1"
kind: NetworkAttachmentDefinition
metadata:
  name: poison-conf
spec:
  config: '{
       "name": "whereabouts-shim",
       "cniVersion": "0.3.1",
       "type": "bridge",
       "ipam": {
         "type": "whereabouts"
       }
      }'

We'd have the node slice controller bomb out when it went to make a comparison:

E0403 17:43:44.816992       1 panic.go:115] "Observed a panic" panic="runtime error: index out of range [0] with length 0" panicGoValue="runtime.boundsError{x:0, y:0, signed:true, code:0x0}" stacktrace=<
	goroutine 88 [running]:
[...snip...]
	/go/src/github.com/k8snetworkplumbingwg/whereabouts/pkg/node-controller/controller.go:526
[...snip...]

With line 526, being return conf1.IPRanges[0].Range == conf2.IPRanges[0].Range && conf1.NodeSliceSize == conf2.NodeSliceSize

So, I went added some checks that the range is there, otherwise, don't process it further.

@coveralls
Copy link

coveralls commented Apr 3, 2025

Pull Request Test Coverage Report for Build 14250727707

Details

  • 2 of 9 (22.22%) changed or added relevant lines in 1 file are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage decreased (-0.06%) to 51.519%

Changes Missing Coverage Covered Lines Changed/Added Lines %
pkg/node-controller/controller.go 2 9 22.22%
Totals Coverage Status
Change from base Build 14244399522: -0.06%
Covered Lines: 1967
Relevant Lines: 3818

💛 - Coveralls

…gurations

If a net-attach-def with a whereabouts configuration was missing ranges, a comparison of the missing property would cause the node slice controller to crash
@dougbtv dougbtv force-pushed the node-slice-controller-fix-missing-ranges branch from 66c474c to c903949 Compare April 3, 2025 19:01
@bpickard22
Copy link
Collaborator

/lgtm

@bpickard22 bpickard22 merged commit efdfc04 into k8snetworkplumbingwg:master Apr 3, 2025
11 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants