Skip to content

Commit

Permalink
Multi-cluster license format and package version updates (#3919)
Browse files Browse the repository at this point in the history
1. Update the license format in auto-generated deepcopy file
   and let it be updated by `make codegen`
2. Update controller-runtime version to v0.12.1
3. Update controller-gen version to v0.9.0
4. Update codegen image to kubernetes-1.24.0-build.0

Signed-off-by: Lan Luo <luola@vmware.com>
  • Loading branch information
luolanzone committed Jun 23, 2022
1 parent 2e22d2a commit e73b609
Show file tree
Hide file tree
Showing 21 changed files with 132 additions and 277 deletions.
3 changes: 2 additions & 1 deletion build/images/codegen/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,8 @@ RUN go get k8s.io/code-generator/cmd/client-gen@kubernetes-$K8S_VERSION && \
go get k8s.io/code-generator/cmd/go-to-protobuf/protoc-gen-gogo@kubernetes-$K8S_VERSION && \
go get github.com/golang/mock/mockgen@v1.4.4 && \
go get github.com/golang/protobuf/protoc-gen-go@v1.5.2 && \
go get golang.org/x/tools/cmd/goimports
go get golang.org/x/tools/cmd/goimports && \
go get sigs.k8s.io/controller-tools/cmd/controller-gen@v0.9.0

COPY --from=protoc /tmp/protoc/bin /usr/local/bin
COPY --from=protoc /tmp/protoc/include /usr/local/include
Expand Down
1 change: 1 addition & 0 deletions build/images/codegen/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ Here is the table of codegen images that have been uploaded:

| Tag | Change |
| :----------------------------- | --------------------------------------- |
| kubernetes-1.24.0-build.0 | Add controller-gen v0.9.0 |
| kubernetes-1.24.0 | Upgraded K8s libraries to v1.24.0 |
| kubernetes-1.21.0-build.1 | Upgraded protoc-gen-go to v1.5.2 |
| kubernetes-1.21.0-build.0 | Upgraded Go to v1.17 |
Expand Down
4 changes: 2 additions & 2 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ require (
github.com/miekg/dns v1.1.43
github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822
github.com/onsi/ginkgo v1.16.5
github.com/onsi/gomega v1.17.0
github.com/onsi/gomega v1.18.1
github.com/pkg/errors v0.9.1
github.com/prometheus/client_golang v1.12.1
github.com/prometheus/common v0.32.1
Expand Down Expand Up @@ -74,7 +74,7 @@ require (
k8s.io/kubectl v0.24.0
k8s.io/kubelet v0.24.0
k8s.io/utils v0.0.0-20220210201930-3a6ce19ff2f9
sigs.k8s.io/controller-runtime v0.11.2
sigs.k8s.io/controller-runtime v0.12.1
sigs.k8s.io/mcs-api v0.1.0
)

Expand Down
35 changes: 7 additions & 28 deletions go.sum

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion hack/update-codegen.sh
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ set -o errexit
set -o pipefail

ANTREA_ROOT="$( cd "$( dirname "${BASH_SOURCE[0]}" )/../" && pwd )"
IMAGE_NAME="antrea/codegen:kubernetes-1.24.0"
IMAGE_NAME="antrea/codegen:kubernetes-1.24.0-build.0"

function docker_run() {
docker pull ${IMAGE_NAME}
Expand Down
12 changes: 6 additions & 6 deletions multicluster/Makefile
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
# Produce CRDs that work back to Kubernetes 1.11 (no version conversion)
# For controller-gen, float value is not allowed by default as it is considered dangerous
# See https://github.com/kubernetes-sigs/controller-tools/issues/245
# However the ResourceExport/Import refers to ACNP type definition and the priority field in ACNP spec is type float64.
# Hence, before any ACNP spec bumps that changes the priorty field to a different type,
# the allowDangerousTypes flag is needed for CRD manifests to generate correctly.
CRD_OPTIONS ?= "crd:trivialVersions=true,allowDangerousTypes=true,preserveUnknownFields=false"
CRD_OPTIONS ?= "crd:allowDangerousTypes=true"

# Get the currently used golang install path (in GOPATH/bin, unless GOBIN is set)
ifeq (,$(shell go env GOBIN))
Expand All @@ -25,6 +24,7 @@ SHELL = /usr/bin/env bash -o pipefail
GO_VERSION := $(shell head -n 1 ../build/images/deps/go-version)
DOCKER_BUILD_ARGS = --build-arg GO_VERSION=$(GO_VERSION)

YEAR :=$(shell date "+%Y")
.PHONY: all
all: build

Expand Down Expand Up @@ -53,7 +53,7 @@ manifests: controller-gen ## Generate WebhookConfiguration, ClusterRole and Cust
$(CURDIR)/hack/generate-manifest.sh -m > build/yamls/antrea-multicluster-member.yml

generate: controller-gen ## Generate code containing DeepCopy, DeepCopyInto, and DeepCopyObject method implementations.
$(CONTROLLER_GEN) object:headerFile="hack/boilerplate.go.txt" paths="./..."
$(CONTROLLER_GEN) object:headerFile="hack/boilerplate.go.txt",year=$(YEAR) paths="./..."

fmt: ## Run go fmt against code.
go fmt ./...
Expand Down Expand Up @@ -82,7 +82,7 @@ else
endif
##@ Build

build: generate fmt vet ## Build manager binary.
build: fmt vet ## Build manager binary.
CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -o bin/antrea-mc-controller antrea.io/antrea/multicluster/cmd/...

run: manifests generate fmt vet ## Run a controller from your host.
Expand All @@ -92,7 +92,7 @@ run: manifests generate fmt vet ## Run a controller from your host.

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)

codegen:
./hack/update-codegen.sh
Expand All @@ -106,7 +106,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 $(2) ;\
rm -rf $$TMP_DIR ;\
}
endef
28 changes: 13 additions & 15 deletions multicluster/apis/multicluster/v1alpha1/zz_generated.deepcopy.go

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

Loading

0 comments on commit e73b609

Please sign in to comment.