From b88087e69dca149661558c472ec95844681b4286 Mon Sep 17 00:00:00 2001 From: Sebastian Sch Date: Thu, 26 May 2022 16:28:18 +0300 Subject: [PATCH 1/2] Bump golang to 1.18.2 Signed-off-by: Sebastian Sch --- .github/workflows/go.yml | 8 ++++---- Dockerfile | 2 +- Dockerfile.sriov-network-config-daemon | 2 +- Dockerfile.webhook | 2 +- Makefile | 8 ++++---- .../bases/sriovnetwork.openshift.io_sriovibnetworks.yaml | 9 +-------- ...iovnetwork.openshift.io_sriovnetworknodepolicies.yaml | 9 +-------- ...sriovnetwork.openshift.io_sriovnetworknodestates.yaml | 9 +-------- ...riovnetwork.openshift.io_sriovnetworkpoolconfigs.yaml | 9 +-------- .../bases/sriovnetwork.openshift.io_sriovnetworks.yaml | 9 +-------- .../sriovnetwork.openshift.io_sriovoperatorconfigs.yaml | 9 +-------- 11 files changed, 17 insertions(+), 59 deletions(-) diff --git a/.github/workflows/go.yml b/.github/workflows/go.yml index bc1285bfc..6387d2c51 100644 --- a/.github/workflows/go.yml +++ b/.github/workflows/go.yml @@ -9,10 +9,10 @@ jobs: runs-on: ubuntu-latest steps: - - name: Set up Go 1.17 + - name: Set up Go 1.18 uses: actions/setup-go@v2 with: - go-version: 1.17.8 + go-version: 1.18.2 - name: Check out code into the Go module directory uses: actions/checkout@v2 @@ -28,10 +28,10 @@ jobs: runs-on: ubuntu-latest steps: - - name: Set up Go 1.17 + - name: Set up Go 1.18 uses: actions/setup-go@v2 with: - go-version: 1.17.8 + go-version: 1.18.2 - name: Check out code into the Go module directory uses: actions/checkout@v2 diff --git a/Dockerfile b/Dockerfile index 6ec247dba..52c722fb6 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,4 +1,4 @@ -FROM golang:1.17 AS builder +FROM golang:1.18 AS builder WORKDIR /go/src/github.com/k8snetworkplumbingwg/sriov-network-operator COPY . . RUN make _build-manager BIN_PATH=build/_output/cmd diff --git a/Dockerfile.sriov-network-config-daemon b/Dockerfile.sriov-network-config-daemon index cba71c4d7..67fc451bd 100644 --- a/Dockerfile.sriov-network-config-daemon +++ b/Dockerfile.sriov-network-config-daemon @@ -1,4 +1,4 @@ -FROM golang:1.17 AS builder +FROM golang:1.18 AS builder WORKDIR /go/src/github.com/k8snetworkplumbingwg/sriov-network-operator COPY . . RUN make _build-sriov-network-config-daemon BIN_PATH=build/_output/cmd diff --git a/Dockerfile.webhook b/Dockerfile.webhook index cd862cb79..21e625ba0 100644 --- a/Dockerfile.webhook +++ b/Dockerfile.webhook @@ -1,4 +1,4 @@ -FROM golang:1.17 AS builder +FROM golang:1.18 AS builder WORKDIR /go/src/github.com/k8snetworkplumbingwg/sriov-network-operator COPY . . RUN make _build-webhook BIN_PATH=build/_output/cmd diff --git a/Makefile b/Makefile index 64d298cca..a592043b1 100644 --- a/Makefile +++ b/Makefile @@ -44,7 +44,7 @@ BUNDLE_METADATA_OPTS ?= $(BUNDLE_CHANNELS) $(BUNDLE_DEFAULT_CHANNEL) # Image URL to use all building/pushing image targets IMG ?= controller:latest # Produce CRDs that work back to Kubernetes 1.11 (no version conversion) -CRD_OPTIONS ?= "crd:crdVersions={v1},trivialVersions=true" +CRD_OPTIONS ?= "crd:crdVersions={v1}" # Get the currently used golang install path (in GOPATH/bin, unless GOBIN is set) ifeq (,$(shell go env GOBIN)) @@ -145,11 +145,11 @@ generate: controller-gen CONTROLLER_GEN = $(shell pwd)/bin/controller-gen controller-gen: ## Download controller-gen locally if necessary. - $(call go-get-tool,$(CONTROLLER_GEN),sigs.k8s.io/controller-tools/cmd/controller-gen@v0.4.1) + $(call go-get-tool,$(CONTROLLER_GEN),sigs.k8s.io/controller-tools/cmd/controller-gen@v0.9.0) KUSTOMIZE = $(shell pwd)/bin/kustomize kustomize: ## Download kustomize locally if necessary. - $(call go-get-tool,$(KUSTOMIZE),sigs.k8s.io/kustomize/kustomize/v3@v3.8.7) + $(call go-get-tool,$(KUSTOMIZE),sigs.k8s.io/kustomize/kustomize/v4@v4.5.5) # go-get-tool will 'go get' any package $2 and install it to $1. PROJECT_DIR := $(shell dirname $(abspath $(lastword $(MAKEFILE_LIST)))) @@ -160,7 +160,7 @@ TMP_DIR=$$(mktemp -d) ;\ cd $$TMP_DIR ;\ go mod init tmp ;\ echo "Downloading $(2)" ;\ -GOBIN=$(PROJECT_DIR)/bin go get $(2) ;\ +GOBIN=$(PROJECT_DIR)/bin go install -mod=readonly $(2) ;\ rm -rf $$TMP_DIR ;\ } endef diff --git a/config/crd/bases/sriovnetwork.openshift.io_sriovibnetworks.yaml b/config/crd/bases/sriovnetwork.openshift.io_sriovibnetworks.yaml index 6137e52c7..d619d5362 100644 --- a/config/crd/bases/sriovnetwork.openshift.io_sriovibnetworks.yaml +++ b/config/crd/bases/sriovnetwork.openshift.io_sriovibnetworks.yaml @@ -1,10 +1,9 @@ - --- apiVersion: apiextensions.k8s.io/v1 kind: CustomResourceDefinition metadata: annotations: - controller-gen.kubebuilder.io/version: v0.4.1 + controller-gen.kubebuilder.io/version: v0.9.0 creationTimestamp: null name: sriovibnetworks.sriovnetwork.openshift.io spec: @@ -71,9 +70,3 @@ spec: storage: true subresources: status: {} -status: - acceptedNames: - kind: "" - plural: "" - conditions: [] - storedVersions: [] diff --git a/config/crd/bases/sriovnetwork.openshift.io_sriovnetworknodepolicies.yaml b/config/crd/bases/sriovnetwork.openshift.io_sriovnetworknodepolicies.yaml index f9b7ecfdf..5b2492bf7 100644 --- a/config/crd/bases/sriovnetwork.openshift.io_sriovnetworknodepolicies.yaml +++ b/config/crd/bases/sriovnetwork.openshift.io_sriovnetworknodepolicies.yaml @@ -1,10 +1,9 @@ - --- apiVersion: apiextensions.k8s.io/v1 kind: CustomResourceDefinition metadata: annotations: - controller-gen.kubebuilder.io/version: v0.4.1 + controller-gen.kubebuilder.io/version: v0.9.0 creationTimestamp: null name: sriovnetworknodepolicies.sriovnetwork.openshift.io spec: @@ -128,9 +127,3 @@ spec: storage: true subresources: status: {} -status: - acceptedNames: - kind: "" - plural: "" - conditions: [] - storedVersions: [] diff --git a/config/crd/bases/sriovnetwork.openshift.io_sriovnetworknodestates.yaml b/config/crd/bases/sriovnetwork.openshift.io_sriovnetworknodestates.yaml index 8ccd4ef29..86dc2cab0 100644 --- a/config/crd/bases/sriovnetwork.openshift.io_sriovnetworknodestates.yaml +++ b/config/crd/bases/sriovnetwork.openshift.io_sriovnetworknodestates.yaml @@ -1,10 +1,9 @@ - --- apiVersion: apiextensions.k8s.io/v1 kind: CustomResourceDefinition metadata: annotations: - controller-gen.kubebuilder.io/version: v0.4.1 + controller-gen.kubebuilder.io/version: v0.9.0 creationTimestamp: null name: sriovnetworknodestates.sriovnetwork.openshift.io spec: @@ -151,9 +150,3 @@ spec: storage: true subresources: status: {} -status: - acceptedNames: - kind: "" - plural: "" - conditions: [] - storedVersions: [] diff --git a/config/crd/bases/sriovnetwork.openshift.io_sriovnetworkpoolconfigs.yaml b/config/crd/bases/sriovnetwork.openshift.io_sriovnetworkpoolconfigs.yaml index 275f23773..0aaf6029a 100644 --- a/config/crd/bases/sriovnetwork.openshift.io_sriovnetworkpoolconfigs.yaml +++ b/config/crd/bases/sriovnetwork.openshift.io_sriovnetworkpoolconfigs.yaml @@ -1,10 +1,9 @@ - --- apiVersion: apiextensions.k8s.io/v1 kind: CustomResourceDefinition metadata: annotations: - controller-gen.kubebuilder.io/version: v0.4.1 + controller-gen.kubebuilder.io/version: v0.9.0 creationTimestamp: null name: sriovnetworkpoolconfigs.sriovnetwork.openshift.io spec: @@ -58,9 +57,3 @@ spec: storage: true subresources: status: {} -status: - acceptedNames: - kind: "" - plural: "" - conditions: [] - storedVersions: [] diff --git a/config/crd/bases/sriovnetwork.openshift.io_sriovnetworks.yaml b/config/crd/bases/sriovnetwork.openshift.io_sriovnetworks.yaml index b0c84e17a..17cdcb7ce 100644 --- a/config/crd/bases/sriovnetwork.openshift.io_sriovnetworks.yaml +++ b/config/crd/bases/sriovnetwork.openshift.io_sriovnetworks.yaml @@ -1,10 +1,9 @@ - --- apiVersion: apiextensions.k8s.io/v1 kind: CustomResourceDefinition metadata: annotations: - controller-gen.kubebuilder.io/version: v0.4.1 + controller-gen.kubebuilder.io/version: v0.9.0 creationTimestamp: null name: sriovnetworks.sriovnetwork.openshift.io spec: @@ -103,9 +102,3 @@ spec: storage: true subresources: status: {} -status: - acceptedNames: - kind: "" - plural: "" - conditions: [] - storedVersions: [] diff --git a/config/crd/bases/sriovnetwork.openshift.io_sriovoperatorconfigs.yaml b/config/crd/bases/sriovnetwork.openshift.io_sriovoperatorconfigs.yaml index 04f3143cc..b47354a88 100644 --- a/config/crd/bases/sriovnetwork.openshift.io_sriovoperatorconfigs.yaml +++ b/config/crd/bases/sriovnetwork.openshift.io_sriovoperatorconfigs.yaml @@ -1,10 +1,9 @@ - --- apiVersion: apiextensions.k8s.io/v1 kind: CustomResourceDefinition metadata: annotations: - controller-gen.kubebuilder.io/version: v0.4.1 + controller-gen.kubebuilder.io/version: v0.9.0 creationTimestamp: null name: sriovoperatorconfigs.sriovnetwork.openshift.io spec: @@ -83,9 +82,3 @@ spec: storage: true subresources: status: {} -status: - acceptedNames: - kind: "" - plural: "" - conditions: [] - storedVersions: [] From d106b90a8e60b8bd51fa30833fc942175d02e449 Mon Sep 17 00:00:00 2001 From: Sebastian Sch Date: Sun, 29 May 2022 17:42:55 +0300 Subject: [PATCH 2/2] Add context to drain functions Signed-off-by: Sebastian Sch --- .github/workflows/go.yml | 4 ++-- pkg/daemon/daemon.go | 1 + 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/.github/workflows/go.yml b/.github/workflows/go.yml index 6387d2c51..7f17f11fe 100644 --- a/.github/workflows/go.yml +++ b/.github/workflows/go.yml @@ -10,9 +10,9 @@ jobs: steps: - name: Set up Go 1.18 - uses: actions/setup-go@v2 + uses: actions/setup-go@v3 with: - go-version: 1.18.2 + go-version: '>=1.18.2' - name: Check out code into the Go module directory uses: actions/checkout@v2 diff --git a/pkg/daemon/daemon.go b/pkg/daemon/daemon.go index 619352b4f..7fcf8bbdc 100644 --- a/pkg/daemon/daemon.go +++ b/pkg/daemon/daemon.go @@ -164,6 +164,7 @@ func New( }, Out: writer{glog.Info}, ErrOut: writer{glog.Error}, + Ctx: context.Background(), }, workqueue: workqueue.NewNamedRateLimitingQueue(workqueue.NewMaxOfRateLimiter( &workqueue.BucketRateLimiter{Limiter: rate.NewLimiter(rate.Limit(updateDelay), 1)},