Skip to content

Commit

Permalink
Merge pull request #497 from e0ne/parallel-nic-config
Browse files Browse the repository at this point in the history
Parallel NICs configuration
  • Loading branch information
zeeke authored Feb 15, 2024
2 parents 1163ef9 + 0aead49 commit 3852228
Show file tree
Hide file tree
Showing 10 changed files with 238 additions and 59 deletions.
2 changes: 2 additions & 0 deletions api/v1/sriovoperatorconfig_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,8 @@ type SriovOperatorConfigSpec struct {
UseCDI bool `json:"useCDI,omitempty"`
// DisablePlugins is a list of sriov-network-config-daemon plugins to disable
DisablePlugins PluginNameSlice `json:"disablePlugins,omitempty"`
// FeatureGates to enable experimental features
FeatureGates map[string]bool `json:"featureGates,omitempty"`
}

// SriovOperatorConfigStatus defines the observed state of SriovOperatorConfig
Expand Down
7 changes: 7 additions & 0 deletions api/v1/zz_generated.deepcopy.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions bindata/manifests/daemon/daemonset.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,9 @@ spec:
{{- with index . "DisablePlugins" }}
- --disable-plugins={{.}}
{{- end }}
{{- if .ParallelNicConfig }}
- --parallel-nic-config
{{- end }}
env:
- name: NODE_NAME
valueFrom:
Expand Down
12 changes: 8 additions & 4 deletions cmd/sriov-network-config-daemon/start.go
Original file line number Diff line number Diff line change
Expand Up @@ -78,10 +78,11 @@ var (
}

startOpts struct {
kubeconfig string
nodeName string
systemd bool
disabledPlugins stringList
kubeconfig string
nodeName string
systemd bool
disabledPlugins stringList
parallelNicConfig bool
}
)

Expand All @@ -91,6 +92,7 @@ func init() {
startCmd.PersistentFlags().StringVar(&startOpts.nodeName, "node-name", "", "kubernetes node name daemon is managing")
startCmd.PersistentFlags().BoolVar(&startOpts.systemd, "use-systemd-service", false, "use config daemon in systemd mode")
startCmd.PersistentFlags().VarP(&startOpts.disabledPlugins, "disable-plugins", "", "comma-separated list of plugins to disable")
startCmd.PersistentFlags().BoolVar(&startOpts.parallelNicConfig, "parallel-nic-config", false, "perform NIC configuration in parallel")
}

func runStartCmd(cmd *cobra.Command, args []string) error {
Expand All @@ -104,6 +106,8 @@ func runStartCmd(cmd *cobra.Command, args []string) error {
vars.UsingSystemdMode = true
}

vars.ParallelNicConfig = startOpts.parallelNicConfig

if startOpts.nodeName == "" {
name, ok := os.LookupEnv("NODE_NAME")
if !ok || name == "" {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,11 @@ spec:
provision switchdev-configuration.service and enable OpenvSwitch
hw-offload on nodes.
type: boolean
featureGates:
additionalProperties:
type: boolean
description: FeatureGates to enable experimental features
type: object
logLevel:
description: Flag to control the log verbose level of the operator.
Set to '0' to show only the basic logs. And set to '2' to show all
Expand Down
4 changes: 4 additions & 0 deletions controllers/sriovoperatorconfig_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -187,6 +187,10 @@ func (r *SriovOperatorConfigReconciler) syncConfigDaemonSet(ctx context.Context,
} else {
data.Data["UsedSystemdMode"] = false
}
data.Data["ParallelNicConfig"] = false
if parallelConfig, ok := dc.Spec.FeatureGates[consts.ParallelNicConfigFeatureGate]; ok {
data.Data["ParallelNicConfig"] = parallelConfig
}

envCniBinPath := os.Getenv("SRIOV_CNI_BIN_PATH")
if envCniBinPath == "" {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,11 @@ spec:
provision switchdev-configuration.service and enable OpenvSwitch
hw-offload on nodes.
type: boolean
featureGates:
additionalProperties:
type: boolean
description: FeatureGates to enable experimental features
type: object
logLevel:
description: Flag to control the log verbose level of the operator.
Set to '0' to show only the basic logs. And set to '2' to show all
Expand Down
2 changes: 2 additions & 0 deletions pkg/consts/constants.go
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,8 @@ const (
KernelArgPciRealloc = "pci=realloc"
KernelArgIntelIommu = "intel_iommu=on"
KernelArgIommuPt = "iommu=pt"

ParallelNicConfigFeatureGate = "parallelNicConfig"
)

const (
Expand Down
Loading

0 comments on commit 3852228

Please sign in to comment.