Skip to content

Commit

Permalink
Add nodeslicepool
Browse files Browse the repository at this point in the history
Fast ranges needs the nodeslicepool crd, this adds that and updates the
multus unit test to accomadate it

Signed-off-by: Benjamin Pickard <[email protected]>
  • Loading branch information
bpickard22 committed Nov 20, 2024
1 parent 2669a4a commit 23a19ce
Show file tree
Hide file tree
Showing 5 changed files with 83 additions and 3 deletions.
79 changes: 79 additions & 0 deletions bindata/network/additional-networks/crd/001-crd.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -172,3 +172,82 @@ spec:
type: object
served: true
storage: true
---
apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
annotations:
controller-gen.kubebuilder.io/version: v0.14.0
name: nodeslicepools.whereabouts.cni.cncf.io
spec:
group: whereabouts.cni.cncf.io
names:
kind: NodeSlicePool
listKind: NodeSlicePoolList
plural: nodeslicepools
singular: nodeslicepool
scope: Namespaced
versions:
- name: v1alpha1
schema:
openAPIV3Schema:
description: NodeSlicePool is the Schema for the nodesliceippools API
properties:
apiVersion:
description: |-
APIVersion defines the versioned schema of this representation of an object.
Servers should convert recognized schemas to the latest internal value, and
may reject unrecognized values.
More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources
type: string
kind:
description: |-
Kind is a string value representing the REST resource this object represents.
Servers may infer this from the endpoint the client submits requests to.
Cannot be updated.
In CamelCase.
More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds
type: string
metadata:
type: object
spec:
description: NodeSlicePoolSpec defines the desired state of NodeSlicePool
properties:
range:
description: |-
Range is a RFC 4632/4291-style string that represents an IP address and prefix length in CIDR notation
this refers to the entire range where the node is allocated a subset
type: string
sliceSize:
description: SliceSize is the size of subnets or slices of the range
that each node will be assigned
type: string
required:
- range
- sliceSize
type: object
status:
description: NodeSlicePoolStatus defines the desired state of NodeSlicePool
properties:
allocations:
description: Allocations holds the allocations of nodes to slices
items:
properties:
nodeName:
description: NodeName is the name of the node assigned to this
slice, empty node name is an available slice for assignment
type: string
sliceRange:
description: SliceRange is the subnet of this slice
type: string
required:
- nodeName
- sliceRange
type: object
type: array
required:
- allocations
type: object
type: object
served: true
storage: true
1 change: 1 addition & 0 deletions bindata/network/multus/002-rbac.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -235,6 +235,7 @@ rules:
resources:
- ippools
- overlappingrangeipreservations
- nodesliceippools
verbs:
- get
- list
Expand Down
2 changes: 1 addition & 1 deletion pkg/network/additional_networks_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ func TestRenderAdditionalNetworksCRD(t *testing.T) {

objs, err := renderAdditionalNetworksCRD(manifestDir)
g.Expect(err).NotTo(HaveOccurred())
g.Expect(objs).To(HaveLen(3))
g.Expect(objs).To(HaveLen(4))
}

func TestRenderRawCNIConfig(t *testing.T) {
Expand Down
2 changes: 1 addition & 1 deletion pkg/network/multus_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ func TestRenderMultus(t *testing.T) {
g.Expect(objs).To(ContainElement(HaveKubernetesID("DaemonSet", "openshift-multus", "multus")))

// It's important that the namespace is first
g.Expect(len(objs)).To(Equal(30), "Expected 30 multus related objects")
g.Expect(len(objs)).To(Equal(31), "Expected 31 multus related objects") //this seems like not a great test imo
g.Expect(objs[0]).To(HaveKubernetesID("CustomResourceDefinition", "", "network-attachment-definitions.k8s.cni.cncf.io"))
g.Expect(objs).To(ContainElement(HaveKubernetesID("Namespace", "", "openshift-multus")))
g.Expect(objs).To(ContainElement(HaveKubernetesID("ServiceAccount", "openshift-multus", "multus-ancillary-tools")))
Expand Down
2 changes: 1 addition & 1 deletion pkg/network/network_metrics_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ func TestRenderNetworkMetricsDaemon(t *testing.T) {

// Check rendered object

g.Expect(len(objs)).To(Equal(30), "Expected 30 multus related objects")
g.Expect(len(objs)).To(Equal(31), "Expected 31 multus related objects")
g.Expect(objs).To(ContainElement(HaveKubernetesID("DaemonSet", "openshift-multus", "network-metrics-daemon")))
g.Expect(objs).To(ContainElement(HaveKubernetesID("Service", "openshift-multus", "network-metrics-service")))
g.Expect(objs).To(ContainElement(HaveKubernetesID("ClusterRole", "", "metrics-daemon-role")))
Expand Down

0 comments on commit 23a19ce

Please sign in to comment.