Skip to content

Commit

Permalink
Merge pull request #882 from zeeke/sync-20240201
Browse files Browse the repository at this point in the history
OCPBUGS-28248: Downstream Sync 2024-02-01
  • Loading branch information
openshift-merge-bot[bot] authored Feb 13, 2024
2 parents 5898650 + 3db20ae commit 842a9f1
Show file tree
Hide file tree
Showing 501 changed files with 13,937 additions and 6,092 deletions.
29 changes: 16 additions & 13 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,10 @@ jobs:
runs-on: ubuntu-latest
steps:

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

- name: Check out code into the Go module directory
uses: actions/checkout@v2
Expand All @@ -32,10 +32,10 @@ jobs:
runs-on: ubuntu-latest
steps:

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

- name: Check out code into the Go module directory
uses: actions/checkout@v2
Expand All @@ -46,34 +46,37 @@ jobs:
- name: test controllers on opensfhit
run: CLUSTER_TYPE=openshift make test-controllers

- name: test controllers on kubernetes
run: CLUSTER_TYPE=kubernetes make test-controllers

- name: test bindata/scripts
run: make test-bindata-scripts

golangci:
name: Golangci-lint
runs-on: ubuntu-latest
steps:
- name: Set up Go 1.20
- name: Set up Go 1.21
uses: actions/setup-go@v2
with:
go-version: 1.20.x
go-version: 1.21.x
- name: Check out code into the Go module directory
uses: actions/checkout@v2
- name: golangci-lint
uses: golangci/golangci-lint-action@v3
with:
# Required: the version of golangci-lint is required and must be specified without patch version: we always use the latest patch version.
version: v1.51.0
version: v1.55.2

test-coverage:
name: test-coverage
runs-on: ubuntu-latest
steps:

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

- name: Check out code into the Go module directory
uses: actions/checkout@v2
Expand Down Expand Up @@ -107,10 +110,10 @@ jobs:
- name: Check out code into the Go module directory
uses: actions/checkout@v2

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

- name: run test
run: make test-e2e-conformance-virtual-k8s-cluster-ci
Expand Down Expand Up @@ -141,10 +144,10 @@ jobs:
- name: Check out code into the Go module directory
uses: actions/checkout@v2

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

- name: run test
run: make test-e2e-conformance-virtual-ocp-cluster-ci
Expand Down
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -82,4 +82,5 @@ tags
# End of https://www.gitignore.io/api/go,vim,emacs,visualstudiocode
#IDE (GoLand) specific
.idea/

# test-environment files
registry-login.conf
16 changes: 9 additions & 7 deletions .golangci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,11 @@ run:
- pkg/client
linters-settings:
depguard:
list-type: blacklist
packages:
# logging is allowed only by logutils.Log, logrus
# is allowed to use only in logutils package
- github.com/sirupsen/logrus
packages-with-error-message:
- github.com/sirupsen/logrus: "logging is allowed only by logutils.Log"
rules:
main:
deny:
- pkg: github.com/sirupsen/logrus
desc: "logging is allowed only by logutils.Log"
dupl:
threshold: 100
funlen:
Expand All @@ -25,6 +23,7 @@ linters-settings:
goconst:
min-len: 2
min-occurrences: 2
ignore-tests: true
gocritic:
enabled-tags:
- diagnostic
Expand Down Expand Up @@ -118,4 +117,7 @@ issues:
- lll
- stylecheck
- goconst
- path: test/conformance/tests
linters:
- goconst

2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM golang:1.20 AS builder
FROM golang:1.21 AS builder
WORKDIR /go/src/github.com/k8snetworkplumbingwg/sriov-network-operator
COPY . .
RUN make _build-manager BIN_PATH=build/_output/cmd
Expand Down
2 changes: 1 addition & 1 deletion Dockerfile.sriov-network-config-daemon
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM golang:1.20 AS builder
FROM golang:1.21 AS builder
WORKDIR /go/src/github.com/k8snetworkplumbingwg/sriov-network-operator
COPY . .
RUN make _build-sriov-network-config-daemon BIN_PATH=build/_output/cmd
Expand Down
2 changes: 1 addition & 1 deletion Dockerfile.webhook
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM golang:1.20 AS builder
FROM golang:1.21 AS builder
WORKDIR /go/src/github.com/k8snetworkplumbingwg/sriov-network-operator
COPY . .
RUN make _build-webhook BIN_PATH=build/_output/cmd
Expand Down
28 changes: 10 additions & 18 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ export WATCH_NAMESPACE?=openshift-sriov-network-operator
export GOFLAGS+=-mod=vendor
export GO111MODULE=on
PKGS=$(shell go list ./... | grep -v -E '/vendor/|/test|/examples')
TESTPKGS?=./...

# go source files, ignore vendor directory
SRC = $(shell find . -type f -name '*.go' -not -path "./vendor/*")
Expand All @@ -51,7 +52,7 @@ GOLANGCI_LINT = $(BIN_DIR)/golangci-lint
# golangci-lint version should be updated periodically
# we keep it fixed to avoid it from unexpectedly failing on the project
# in case of a version bump
GOLANGCI_LINT_VER = v1.51.0
GOLANGCI_LINT_VER = v1.55.2

GOLANGCI_LINT = $(BIN_DIR)/golangci-lint
# golangci-lint version should be updated periodically
Expand All @@ -62,7 +63,7 @@ GOLANGCI_LINT_VER = v1.46.1

.PHONY: all build clean gendeepcopy test test-e2e test-e2e-k8s run image fmt sync-manifests test-e2e-conformance manifests update-codegen

all: generate vet build
all: generate lint build

build: manager _build-sriov-network-config-daemon _build-webhook

Expand All @@ -82,14 +83,14 @@ image: ; $(info Building images...)
$(IMAGE_BUILDER) build -f $(DOCKERFILE_WEBHOOK) -t $(WEBHOOK_IMAGE_TAG) $(CURPATH) $(IMAGE_BUILD_OPTS)

# Run tests
test: generate vet manifests envtest
KUBEBUILDER_ASSETS="$(shell $(ENVTEST) use $(ENVTEST_K8S_VERSION) --bin-dir=/tmp -p path)" HOME="$(shell pwd)" go test ./... -coverprofile cover.out -v
test: generate lint manifests envtest
KUBEBUILDER_ASSETS="$(shell $(ENVTEST) use $(ENVTEST_K8S_VERSION) --bin-dir=/tmp -p path)" HOME="$(shell pwd)" go test -coverprofile cover.out -v ${TESTPKGS}

# Build manager binary
manager: generate vet _build-manager
manager: generate _build-manager

# Run against the configured Kubernetes cluster in ~/.kube/config
run: vet skopeo install
run: skopeo install
hack/run-locally.sh

# Install CRDs into a cluster
Expand Down Expand Up @@ -137,10 +138,6 @@ fmt: ## Go fmt your code
fmt-code:
go fmt ./...

# Run go vet against code
vet:
go vet ./...

# Generate code
generate: controller-gen
$(CONTROLLER_GEN) object:headerFile="hack/boilerplate.go.txt" paths="./..."
Expand All @@ -162,7 +159,7 @@ envtest: ## Download envtest-setup locally if necessary.

GOMOCK = $(shell pwd)/bin/mockgen
gomock:
$(call go-get-tool,$(GOMOCK),github.com/golang/mock/[email protected])
$(call go-install-tool,$(GOMOCK),github.com/golang/mock/[email protected])

# go-install-tool will 'go install' any package $2 and install it to $1.
define go-install-tool
Expand Down Expand Up @@ -210,7 +207,7 @@ redeploy-operator-virtual-cluster:
test-e2e-validation-only:
SUITE=./test/validation ./hack/run-e2e-conformance.sh

test-e2e: generate vet manifests skopeo envtest
test-e2e: generate manifests skopeo envtest
KUBEBUILDER_ASSETS="$(shell $(ENVTEST) use $(ENVTEST_K8S_VERSION) --bin-dir=/tmp -p path)"; source hack/env.sh; HOME="$(shell pwd)" go test ./test/e2e/... -timeout 60m -coverprofile cover.out -v

test-e2e-k8s: export NAMESPACE=sriov-network-operator
Expand All @@ -219,14 +216,9 @@ test-e2e-k8s: test-e2e
test-bindata-scripts: fakechroot
fakechroot ./test/scripts/enable-kargs_test.sh

test-%: generate vet manifests envtest
test-%: generate manifests envtest
KUBEBUILDER_ASSETS="$(shell $(ENVTEST) use $(ENVTEST_K8S_VERSION) --bin-dir=/tmp -p path)" HOME="$(shell pwd)" go test ./$*/... -coverprofile cover-$*.out -coverpkg ./... -v

# deploy-setup-k8s: export NAMESPACE=sriov-network-operator
# deploy-setup-k8s: export ADMISSION_CONTROLLERS_ENABLED=false
# deploy-setup-k8s: export CNI_BIN_PATH=/opt/cni/bin
# test-e2e-k8s: test-e2e

GOCOVMERGE = $(BIN_DIR)/gocovmerge
gocovmerge: ## Download gocovmerge locally if necessary.
$(call go-install-tool,$(GOCOVMERGE),github.com/shabbyrobe/gocovmerge/cmd/gocovmerge@latest)
Expand Down
31 changes: 31 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -228,6 +228,37 @@ This feature was created to support deployments where the user want to use some
communication like storage network or out of band managment and the virtual functions must exist on boot and not only
after the operator and config-daemon are running.

#### Disabling SR-IOV Config Daemon plugins

It is possible to disable SR-IOV network operator config daemon plugins in case their operation
is not needed or un-desirable.

As an example, some plugins perform vendor specific firmware configuration
to enable SR-IOV (e.g `mellanox` plugin). certain deployment environments may prefer to perform such configuration
once during node provisioning, while ensuring the configuration will be compatible with any sriov network node policy
defined for the particular environment. This will reduce or completely eliminate the need for reboot of nodes during SR-IOV
configurations by the operator.

This can be done by setting SriovOperatorConfig `default` CR `spec.disablePlugins` with the list of desired plugins
to disable.

**Example**:

```yaml
apiVersion: sriovnetwork.openshift.io/v1
kind: SriovOperatorConfig
metadata:
name: default
namespace: sriov-network-operator
spec:
...
disablePlugins:
- mellanox
...
```

> **NOTE**: Currently only `mellanox` plugin can be disabled.

## Components and design

This operator is split into 2 components:
Expand Down
Loading

0 comments on commit 842a9f1

Please sign in to comment.