Skip to content

Commit c986251

Browse files
committed
Implement RDMA subsystem mode change
Now it's possible to configure RDMA subsystem mode using SR-IOV Network Operator in systemd mode We can't configure RDMA subsystem in a daemon mode because it should be done on host before any network namespace is created.
1 parent bbdfd9d commit c986251

22 files changed

+432
-282
lines changed

api/v1/sriovnetworkpoolconfig_types.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,10 @@ type SriovNetworkPoolConfigSpec struct {
2121
// Drain will respect Pod Disruption Budgets (PDBs) such as etcd quorum guards,
2222
// even if maxUnavailable is greater than one.
2323
MaxUnavailable *intstr.IntOrString `json:"maxUnavailable,omitempty"`
24+
25+
// +kubebuilder:validation:Enum=shared;exclusive
26+
// RDMA subsystem. Allowed value "shared", "exclusive".
27+
RdmaMode string `json:"rdmaMode,omitempty"`
2428
}
2529

2630
type OvsHardwareOffloadConfig struct {

api/v1/zz_generated.deepcopy.go

Lines changed: 0 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

cmd/sriov-network-config-daemon/service.go

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -152,6 +152,17 @@ func phasePre(setupLog logr.Logger, conf *systemd.SriovConfig, hostHelpers helpe
152152
hostHelpers.TryEnableTun()
153153
hostHelpers.TryEnableVhostNet()
154154

155+
rdmaSubsystem, err := hostHelpers.GetRDMASubsystem()
156+
if err != nil {
157+
setupLog.Error(err, "failed to get RDMA subsystem mode")
158+
}
159+
if rdmaSubsystem != conf.RdmaMode {
160+
err = hostHelpers.SetRDMASubsystem(conf.RdmaMode)
161+
if err != nil {
162+
setupLog.Error(err, "failed to set RDMA subsystem mode")
163+
}
164+
}
165+
155166
return callPlugin(setupLog, PhasePre, conf, hostHelpers)
156167
}
157168

config/crd/bases/sriovnetwork.openshift.io_sriovibnetworks.yaml

Lines changed: 18 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,7 @@ apiVersion: apiextensions.k8s.io/v1
33
kind: CustomResourceDefinition
44
metadata:
55
annotations:
6-
controller-gen.kubebuilder.io/version: v0.9.0
7-
creationTimestamp: null
6+
controller-gen.kubebuilder.io/version: v0.14.0
87
name: sriovibnetworks.sriovnetwork.openshift.io
98
spec:
109
group: sriovnetwork.openshift.io
@@ -21,23 +20,29 @@ spec:
2120
description: SriovIBNetwork is the Schema for the sriovibnetworks API
2221
properties:
2322
apiVersion:
24-
description: 'APIVersion defines the versioned schema of this representation
25-
of an object. Servers should convert recognized schemas to the latest
26-
internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources'
23+
description: |-
24+
APIVersion defines the versioned schema of this representation of an object.
25+
Servers should convert recognized schemas to the latest internal value, and
26+
may reject unrecognized values.
27+
More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources
2728
type: string
2829
kind:
29-
description: 'Kind is a string value representing the REST resource this
30-
object represents. Servers may infer this from the endpoint the client
31-
submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds'
30+
description: |-
31+
Kind is a string value representing the REST resource this object represents.
32+
Servers may infer this from the endpoint the client submits requests to.
33+
Cannot be updated.
34+
In CamelCase.
35+
More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds
3236
type: string
3337
metadata:
3438
type: object
3539
spec:
3640
description: SriovIBNetworkSpec defines the desired state of SriovIBNetwork
3741
properties:
3842
capabilities:
39-
description: 'Capabilities to be configured for this network. Capabilities
40-
supported: (infinibandGUID), e.g. ''{"infinibandGUID": true}'''
43+
description: |-
44+
Capabilities to be configured for this network.
45+
Capabilities supported: (infinibandGUID), e.g. '{"infinibandGUID": true}'
4146
type: string
4247
ipam:
4348
description: IPAM configuration to be used for this network.
@@ -50,8 +55,9 @@ spec:
5055
- disable
5156
type: string
5257
metaPlugins:
53-
description: MetaPluginsConfig configuration to be used in order to
54-
chain metaplugins to the sriov interface returned by the operator.
58+
description: |-
59+
MetaPluginsConfig configuration to be used in order to chain metaplugins to the sriov interface returned
60+
by the operator.
5561
type: string
5662
networkNamespace:
5763
description: Namespace of the NetworkAttachmentDefinition custom resource

config/crd/bases/sriovnetwork.openshift.io_sriovnetworknodepolicies.yaml

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,7 @@ apiVersion: apiextensions.k8s.io/v1
33
kind: CustomResourceDefinition
44
metadata:
55
annotations:
6-
controller-gen.kubebuilder.io/version: v0.9.0
7-
creationTimestamp: null
6+
controller-gen.kubebuilder.io/version: v0.14.0
87
name: sriovnetworknodepolicies.sriovnetwork.openshift.io
98
spec:
109
group: sriovnetwork.openshift.io
@@ -22,14 +21,19 @@ spec:
2221
API
2322
properties:
2423
apiVersion:
25-
description: 'APIVersion defines the versioned schema of this representation
26-
of an object. Servers should convert recognized schemas to the latest
27-
internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources'
24+
description: |-
25+
APIVersion defines the versioned schema of this representation of an object.
26+
Servers should convert recognized schemas to the latest internal value, and
27+
may reject unrecognized values.
28+
More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources
2829
type: string
2930
kind:
30-
description: 'Kind is a string value representing the REST resource this
31-
object represents. Servers may infer this from the endpoint the client
32-
submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds'
31+
description: |-
32+
Kind is a string value representing the REST resource this object represents.
33+
Servers may infer this from the endpoint the client submits requests to.
34+
Cannot be updated.
35+
In CamelCase.
36+
More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds
3337
type: string
3438
metadata:
3539
type: object

config/crd/bases/sriovnetwork.openshift.io_sriovnetworknodestates.yaml

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,7 @@ apiVersion: apiextensions.k8s.io/v1
33
kind: CustomResourceDefinition
44
metadata:
55
annotations:
6-
controller-gen.kubebuilder.io/version: v0.9.0
7-
creationTimestamp: null
6+
controller-gen.kubebuilder.io/version: v0.14.0
87
name: sriovnetworknodestates.sriovnetwork.openshift.io
98
spec:
109
group: sriovnetwork.openshift.io
@@ -35,14 +34,19 @@ spec:
3534
API
3635
properties:
3736
apiVersion:
38-
description: 'APIVersion defines the versioned schema of this representation
39-
of an object. Servers should convert recognized schemas to the latest
40-
internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources'
37+
description: |-
38+
APIVersion defines the versioned schema of this representation of an object.
39+
Servers should convert recognized schemas to the latest internal value, and
40+
may reject unrecognized values.
41+
More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources
4142
type: string
4243
kind:
43-
description: 'Kind is a string value representing the REST resource this
44-
object represents. Servers may infer this from the endpoint the client
45-
submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds'
44+
description: |-
45+
Kind is a string value representing the REST resource this object represents.
46+
Servers may infer this from the endpoint the client submits requests to.
47+
Cannot be updated.
48+
In CamelCase.
49+
More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds
4650
type: string
4751
metadata:
4852
type: object

config/crd/bases/sriovnetwork.openshift.io_sriovnetworkpoolconfigs.yaml

Lines changed: 48 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,7 @@ apiVersion: apiextensions.k8s.io/v1
33
kind: CustomResourceDefinition
44
metadata:
55
annotations:
6-
controller-gen.kubebuilder.io/version: v0.9.0
7-
creationTimestamp: null
6+
controller-gen.kubebuilder.io/version: v0.14.0
87
name: sriovnetworkpoolconfigs.sriovnetwork.openshift.io
98
spec:
109
group: sriovnetwork.openshift.io
@@ -22,14 +21,19 @@ spec:
2221
API
2322
properties:
2423
apiVersion:
25-
description: 'APIVersion defines the versioned schema of this representation
26-
of an object. Servers should convert recognized schemas to the latest
27-
internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources'
24+
description: |-
25+
APIVersion defines the versioned schema of this representation of an object.
26+
Servers should convert recognized schemas to the latest internal value, and
27+
may reject unrecognized values.
28+
More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources
2829
type: string
2930
kind:
30-
description: 'Kind is a string value representing the REST resource this
31-
object represents. Servers may infer this from the endpoint the client
32-
submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds'
31+
description: |-
32+
Kind is a string value representing the REST resource this object represents.
33+
Servers may infer this from the endpoint the client submits requests to.
34+
Cannot be updated.
35+
In CamelCase.
36+
More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds
3337
type: string
3438
metadata:
3539
type: object
@@ -40,13 +44,15 @@ spec:
4044
anyOf:
4145
- type: integer
4246
- type: string
43-
description: "maxUnavailable defines either an integer number or percentage
44-
of nodes in the pool that can go Unavailable during an update. \n
45-
A value larger than 1 will mean multiple nodes going unavailable
46-
during the update, which may affect your workload stress on the
47-
remaining nodes. Drain will respect Pod Disruption Budgets (PDBs)
48-
such as etcd quorum guards, even if maxUnavailable is greater than
49-
one."
47+
description: |-
48+
maxUnavailable defines either an integer number or percentage
49+
of nodes in the pool that can go Unavailable during an update.
50+
51+
52+
A value larger than 1 will mean multiple nodes going unavailable during
53+
the update, which may affect your workload stress on the remaining nodes.
54+
Drain will respect Pod Disruption Budgets (PDBs) such as etcd quorum guards,
55+
even if maxUnavailable is greater than one.
5056
x-kubernetes-int-or-string: true
5157
nodeSelector:
5258
description: nodeSelector specifies a label selector for Nodes
@@ -55,24 +61,24 @@ spec:
5561
description: matchExpressions is a list of label selector requirements.
5662
The requirements are ANDed.
5763
items:
58-
description: A label selector requirement is a selector that
59-
contains values, a key, and an operator that relates the key
60-
and values.
64+
description: |-
65+
A label selector requirement is a selector that contains values, a key, and an operator that
66+
relates the key and values.
6167
properties:
6268
key:
6369
description: key is the label key that the selector applies
6470
to.
6571
type: string
6672
operator:
67-
description: operator represents a key's relationship to
68-
a set of values. Valid operators are In, NotIn, Exists
69-
and DoesNotExist.
73+
description: |-
74+
operator represents a key's relationship to a set of values.
75+
Valid operators are In, NotIn, Exists and DoesNotExist.
7076
type: string
7177
values:
72-
description: values is an array of string values. If the
73-
operator is In or NotIn, the values array must be non-empty.
74-
If the operator is Exists or DoesNotExist, the values
75-
array must be empty. This array is replaced during a strategic
78+
description: |-
79+
values is an array of string values. If the operator is In or NotIn,
80+
the values array must be non-empty. If the operator is Exists or DoesNotExist,
81+
the values array must be empty. This array is replaced during a strategic
7682
merge patch.
7783
items:
7884
type: string
@@ -85,24 +91,32 @@ spec:
8591
matchLabels:
8692
additionalProperties:
8793
type: string
88-
description: matchLabels is a map of {key,value} pairs. A single
89-
{key,value} in the matchLabels map is equivalent to an element
90-
of matchExpressions, whose key field is "key", the operator
91-
is "In", and the values array contains only "value". The requirements
92-
are ANDed.
94+
description: |-
95+
matchLabels is a map of {key,value} pairs. A single {key,value} in the matchLabels
96+
map is equivalent to an element of matchExpressions, whose key field is "key", the
97+
operator is "In", and the values array contains only "value". The requirements are ANDed.
9398
type: object
9499
type: object
100+
x-kubernetes-map-type: atomic
95101
ovsHardwareOffloadConfig:
96102
description: OvsHardwareOffloadConfig describes the OVS HWOL configuration
97103
for selected Nodes
98104
properties:
99105
name:
100-
description: 'Name is mandatory and must be unique. On Kubernetes:
101-
Name is the name of OvsHardwareOffloadConfig On OpenShift: Name
102-
is the name of MachineConfigPool to be enabled with OVS hardware
103-
offload'
106+
description: |-
107+
Name is mandatory and must be unique.
108+
On Kubernetes:
109+
Name is the name of OvsHardwareOffloadConfig
110+
On OpenShift:
111+
Name is the name of MachineConfigPool to be enabled with OVS hardware offload
104112
type: string
105113
type: object
114+
rdmaMode:
115+
description: RDMA subsystem. Allowed value "shared", "exclusive".
116+
enum:
117+
- shared
118+
- exclusive
119+
type: string
106120
type: object
107121
status:
108122
description: SriovNetworkPoolConfigStatus defines the observed state of

0 commit comments

Comments
 (0)