Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/master' into sync-20240220
Browse files Browse the repository at this point in the history
Signed-off-by: Andrea Panattoni <[email protected]>
  • Loading branch information
zeeke committed Feb 20, 2024
2 parents d1ad94e + 6d52067 commit 4b878a3
Show file tree
Hide file tree
Showing 48 changed files with 1,795 additions and 562 deletions.
22 changes: 22 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,9 @@ jobs:
- name: test pkg
run: make test-pkg

- name: test cmd
run: make test-cmd

- name: test controllers on opensfhit
run: CLUSTER_TYPE=openshift make test-controllers

Expand All @@ -52,6 +55,22 @@ jobs:
- name: test bindata/scripts
run: make test-bindata-scripts

modules:
name: check go modules
runs-on: ubuntu-latest
steps:

- name: Set up Go 1.21
uses: actions/setup-go@v2
with:
go-version: 1.21.x

- name: Check out code into the Go module directory
uses: actions/checkout@v2

- name: check go modules are up to date
run: make check-deps

golangci:
name: Golangci-lint
runs-on: ubuntu-latest
Expand Down Expand Up @@ -84,6 +103,9 @@ jobs:
- name: test pkg
run: make test-pkg

- name: test cmd
run: make test-cmd

- name: test controllers on opensfhit
run: CLUSTER_TYPE=openshift make test-controllers

Expand Down
6 changes: 6 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -245,6 +245,12 @@ deps-update:
go mod tidy && \
go mod vendor

check-deps: deps-update
@set +e; git diff --quiet HEAD go.sum go.mod vendor; \
if [ $$? -eq 1 ]; \
then echo -e "\ngo modules are out of date. Please commit after running 'make deps-update' command\n"; \
exit 1; fi

$(GOLANGCI_LINT): ; $(info installing golangci-lint...)
$(call go-install-tool,$(GOLANGCI_LINT),github.com/golangci/golangci-lint/cmd/golangci-lint@$(GOLANGCI_LINT_VER))

Expand Down
7 changes: 6 additions & 1 deletion api/v1/helper.go
Original file line number Diff line number Diff line change
Expand Up @@ -253,7 +253,12 @@ func NeedToUpdateSriov(ifaceSpec *Interface, ifaceStatus *InterfaceExt) bool {
for _, groupSpec := range ifaceSpec.VfGroups {
if IndexInRange(vfStatus.VfID, groupSpec.VfRange) {
ingroup = true
if groupSpec.DeviceType != consts.DeviceTypeNetDevice {
if vfStatus.Driver == "" {
log.V(2).Info("NeedToUpdateSriov(): Driver needs update - has no driver",
"desired", groupSpec.DeviceType)
return true
}
if groupSpec.DeviceType != "" && groupSpec.DeviceType != consts.DeviceTypeNetDevice {
if groupSpec.DeviceType != vfStatus.Driver {
log.V(2).Info("NeedToUpdateSriov(): Driver needs update",
"desired", groupSpec.DeviceType, "current", vfStatus.Driver)
Expand Down
6 changes: 4 additions & 2 deletions api/v1/sriovoperatorconfig_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,9 +44,9 @@ type SriovOperatorConfigSpec struct {
// NodeSelector selects the nodes to be configured
ConfigDaemonNodeSelector map[string]string `json:"configDaemonNodeSelector,omitempty"`
// Flag to control whether the network resource injector webhook shall be deployed
EnableInjector *bool `json:"enableInjector,omitempty"`
EnableInjector bool `json:"enableInjector,omitempty"`
// Flag to control whether the operator admission controller webhook shall be deployed
EnableOperatorWebhook *bool `json:"enableOperatorWebhook,omitempty"`
EnableOperatorWebhook bool `json:"enableOperatorWebhook,omitempty"`
// 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 the available logs.
// +kubebuilder:validation:Minimum=0
// +kubebuilder:validation:Maximum=2
Expand All @@ -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
17 changes: 7 additions & 10 deletions api/v1/zz_generated.deepcopy.go

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

23 changes: 15 additions & 8 deletions bindata/manifests/daemon/daemonset.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -43,10 +43,7 @@ spec:
initContainers:
- name: sriov-cni
image: {{.SRIOVCNIImage}}
command:
- /bin/sh
- -c
- cp /usr/bin/sriov /host/opt/cni/bin/
args: ["--no-sleep"]
securityContext:
privileged: true
resources:
Expand All @@ -56,12 +53,12 @@ spec:
volumeMounts:
- name: cnibin
mountPath: /host/opt/cni/bin
- name: os-release
mountPath: /host/etc/os-release
readOnly: true
- name: sriov-infiniband-cni
image: {{.SRIOVInfiniBandCNIImage}}
command:
- /bin/sh
- -c
- cp /usr/bin/ib-sriov /host/opt/cni/bin/
args: ["--no-sleep"]
securityContext:
privileged: true
resources:
Expand All @@ -71,6 +68,9 @@ spec:
volumeMounts:
- name: cnibin
mountPath: /host/opt/cni/bin
- name: os-release
mountPath: /host/etc/os-release
readOnly: true
{{- if .UsedSystemdMode}}
- name: sriov-service-copy
image: {{.Image}}
Expand Down Expand Up @@ -103,6 +103,9 @@ spec:
{{- with index . "DisablePlugins" }}
- --disable-plugins={{.}}
{{- end }}
{{- if .ParallelNicConfig }}
- --parallel-nic-config
{{- end }}
env:
- name: NODE_NAME
valueFrom:
Expand Down Expand Up @@ -134,3 +137,7 @@ spec:
- name: cnibin
hostPath:
path: {{.CNIBinPath}}
- name: os-release
hostPath:
path: /etc/os-release
type: File
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
contents: |
[Unit]
Description=Configures SRIOV NIC - post network configuration
After=systemd-networkd-wait-online.service NetworkManager-wait-online.service
Before=network-online.target
[Service]
Type=oneshot
ExecStart=/var/lib/sriov/sriov-network-config-daemon -v 2 --zap-log-level 2 service --phase post
StandardOutput=journal+console
[Install]
WantedBy=network-online.target
enabled: true
name: sriov-config-post-network.service
Original file line number Diff line number Diff line change
@@ -1,14 +1,15 @@
contents: |
[Unit]
Description=Configures SRIOV NIC
After=network-pre.target
Before=NetworkManager.service kubelet.service
Description=Configures SRIOV NIC - pre network configuration
DefaultDependencies=no
After=network-pre.target systemd-udev-settle.service systemd-sysusers.service systemd-sysctl.service
Before=network.target NetworkManager.service systemd-networkd.service ovs-vswitchd.service ovsdb-server.service
[Service]
Type=oneshot
ExecStart=/var/lib/sriov/sriov-network-config-daemon -v 2 service
ExecStart=/var/lib/sriov/sriov-network-config-daemon -v 2 --zap-log-level 2 service --phase pre
StandardOutput=journal+console
[Install]
WantedBy=multi-user.target
enabled: true
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,19 +12,36 @@ spec:
units:
- contents: |
[Unit]
Description=Configures SRIOV NIC
# Removal of this file signals firstboot completion
ConditionPathExists=!/etc/ignition-machine-config-encapsulated.json
# This service is used to configure the SR-IOV VFs on NICs
After=network-pre.target
Before=NetworkManager.service kubelet.service
Description=Configures SRIOV NIC - pre network configuration
DefaultDependencies=no
After=network-pre.target systemd-udev-settle.service systemd-sysusers.service systemd-sysctl.service
Before=network.target NetworkManager.service systemd-networkd.service ovs-vswitchd.service ovsdb-server.service
[Service]
Type=oneshot
ExecStart=/var/lib/sriov/sriov-network-config-daemon service -v {{ .LogLevel }}
ExecStart=/var/lib/sriov/sriov-network-config-daemon service -v {{ .LogLevel }} --zap-log-level {{ .LogLevel }} --phase pre
StandardOutput=journal+console
[Install]
WantedBy=multi-user.target
enabled: true
name: "sriov-config.service"
- contents: |
[Unit]
# Removal of this file signals firstboot completion
ConditionPathExists=!/etc/ignition-machine-config-encapsulated.json
Description=Configures SRIOV NIC - post network configuration
After=systemd-networkd-wait-online.service NetworkManager-wait-online.service
Before=network-online.target
[Service]
Type=oneshot
ExecStart=/var/lib/sriov/sriov-network-config-daemon service -v {{ .LogLevel }} --zap-log-level {{ .LogLevel }} --phase post
StandardOutput=journal+console
[Install]
WantedBy=network-online.target
enabled: true
name: "sriov-config-post-network.service"
Loading

0 comments on commit 4b878a3

Please sign in to comment.