Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update to Kubernetes v1.18.2 #207

Merged
merged 3 commits into from Oct 16, 2020
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
23 changes: 14 additions & 9 deletions Makefile
Expand Up @@ -8,7 +8,7 @@ VERSION_FILE ?= VERSION-DEV
include $(VERSION_FILE)

# Produce CRDs that work back to Kubernetes 1.11 (no version conversion)
CRD_OPTIONS ?= "crd:trivialVersions=true"
CRD_OPTIONS ?= "crd:trivialVersions=true,crdVersions=v1"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How far behind, the generated CRDs should be supported? crdVersions v1beta1 is still needed for kubernetes < 1.16

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it's up to the user to generate the v1beta1 version of the application CRD.
I added a comment to show how to set the CRD_OPTIONS for the v1beta1 version.


# Releases should modify and double check these vars.
VER ?= v${app_major}.${app_minor}.${app_patch}
Expand Down Expand Up @@ -49,8 +49,8 @@ all: generate fix vet fmt manifests test lint license misspell tidy bin/kube-app
## Tooling Binaries
## --------------------------------------

$(TOOLBIN)/controller-gen:
GOBIN=$(TOOLBIN) GO111MODULE=on go get sigs.k8s.io/controller-tools/cmd/controller-gen@v0.2.5
$(TOOLBIN)/controller-gen: $(TOOLBIN)/kubectl
GOBIN=$(TOOLBIN) GO111MODULE=on go get sigs.k8s.io/controller-tools/cmd/controller-gen@v0.3.0
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should this be updated to v0.4.0? When I originally created this commit, v0.4.0 was not out.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

controller-gen@v0.4.0 seems to be incompatible with client-go@v0.18.2. I got the following error when updating to v0.4.0:

17:14 $ make manifests 
/usr/local/google/home/nanyu/go/src/sigs.k8s.io/application/hack/tools/bin/controller-gen \
        "crd:trivialVersions=true,crdVersions=v1" \
        rbac:roleName=kube-app-manager-role \
        paths=./... \
        output:crd:artifacts:config=config/crd/bases \
        output:crd:dir=config/crd/bases \
        output:webhook:dir=config/webhook \
        webhook
../../../../pkg/mod/k8s.io/client-go@v0.18.2/discovery/discovery_client.go:30:2: module github.com/googleapis/gnostic@latest found (v0.5.1), but does not contain package github.com/googleapis/gnostic/OpenAPIv2
../../../../pkg/mod/k8s.io/kube-openapi@v0.0.0-20200805222855-6aeccd4b50c6/pkg/util/proto/document.go:24:2: case-insensitive import collision: "github.com/googleapis/gnostic/openapiv2" and "github.com/googleapis/gnostic/OpenAPIv2"
Error: not all generators ran successfully
run `controller-gen crd:trivialVersions=true,crdVersions=v1 rbac:roleName=kube-app-manager-role paths=./... output:crd:artifacts:config=config/crd/bases output:crd:dir=config/crd/bases output:webhook:dir=config/webhook webhook -w` to see all available markers, or `controller-gen crd:trivialVersions=true,crdVersions=v1 rbac:roleName=kube-app-manager-role paths=./... output:crd:artifacts:config=config/crd/bases output:crd:dir=config/crd/bases output:webhook:dir=config/webhook webhook -h` for usage

I would keep using v0.3.0 with K8s v1.18.2

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I refreshed all the dependencies and it worked now with controller-gen v0.4.0.


$(TOOLBIN)/golangci-lint:
GOBIN=$(TOOLBIN) GO111MODULE=on go get github.com/golangci/golangci-lint/cmd/golangci-lint@v1.23.6
Expand All @@ -59,16 +59,17 @@ $(TOOLBIN)/mockgen:
GOBIN=$(TOOLBIN) GO111MODULE=on go get github.com/golang/mock/mockgen@v1.3.1

$(TOOLBIN)/conversion-gen:
GOBIN=$(TOOLBIN) GO111MODULE=on go get k8s.io/code-generator/cmd/conversion-gen@v0.17.0
GOBIN=$(TOOLBIN) GO111MODULE=on go get k8s.io/code-generator/cmd/conversion-gen@v0.18.2
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

May be use the latest v0.18.9 ?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

DONE.


$(TOOLBIN)/kubebuilder $(TOOLBIN)/etcd $(TOOLBIN)/kube-apiserver $(TOOLBIN)/kubectl:
cd $(TOOLS_DIR); ./install_kubebuilder.sh
cp $(TOOLBIN)/kubectl $(HOME)/bin

$(TOOLBIN)/kustomize:
cd $(TOOLS_DIR); ./install_kustomize.sh

$(TOOLBIN)/kind:
GOBIN=$(TOOLBIN) GO111MODULE=on go get sigs.k8s.io/kind@v0.6.0
GOBIN=$(TOOLBIN) GO111MODULE=on go get sigs.k8s.io/kind@v0.8.1

$(TOOLBIN)/addlicense:
GOBIN=$(TOOLBIN) GO111MODULE=on go get github.com/google/addlicense
Expand Down Expand Up @@ -101,11 +102,10 @@ test: $(TOOLBIN)/etcd $(TOOLBIN)/kube-apiserver $(TOOLBIN)/kubectl
go test -v ./api/... ./controllers/... -coverprofile $(COVER_FILE)

# Run e2e-tests
K8S_VERSION := "v1.16.4"
K8S_VERSION := "v1.18.2"

.PHONY: e2e-setup
e2e-setup: $(TOOLBIN)/kind
KUBECONFIG=$(shell $(TOOLBIN)/kind get kubeconfig-path --name="kind") \
$(TOOLBIN)/kind create cluster \
-v 4 --retain --wait=1m \
--config e2e/kind-config.yaml \
Expand All @@ -116,7 +116,7 @@ e2e-cleanup: $(TOOLBIN)/kind
$(TOOLBIN)/kind delete cluster

.PHONY: e2e-test
e2e-test: generate fmt vet manifests $(TOOLBIN)/kind $(TOOLBIN)/kustomize $(TOOLBIN)/kubectl
e2e-test: generate fmt vet $(TOOLBIN)/kind $(TOOLBIN)/kustomize $(TOOLBIN)/kubectl
go test -v ./e2e/main_test.go

.PHONY: local-e2e-test
Expand Down Expand Up @@ -242,11 +242,12 @@ undeploy-wordpress: $(TOOLBIN)/kustomize $(TOOLBIN)/kubectl
## --------------------------------------

.PHONY: generate
generate: ## Generate code
generate: license ## Generate code
$(MAKE) generate-go
$(MAKE) manifests
$(MAKE) generate-resources
VERSION_FILE=VERSION $(MAKE) generate-resources
$(MAKE) license

# Generate manifests e.g. CRD, RBAC etc.
.PHONY: manifests
Expand All @@ -259,6 +260,10 @@ manifests: $(TOOLBIN)/controller-gen
output:crd:dir=$(CRD_ROOT) \
output:webhook:dir=$(WEBHOOK_ROOT) \
webhook
@for f in config/crd/bases/*.yaml; do \
kubectl annotate --overwrite -f $$f --local=true -o yaml api-approved.kubernetes.io=https://github.com/kubernetes-sigs/application/pull/2 > $$f.bk; \
mv $$f.bk $$f; \
done

.PHONY: generate-resources
generate-resources: $(TOOLBIN)/kustomize
Expand Down