Skip to content

Commit 0285666

Browse files
authored
Merge pull request #2486 from ryantking/feature/go18-install
✨ Remove deprecated go get from Makefile templates
2 parents 98a3df8 + b0c7cd8 commit 0285666

File tree

42 files changed

+3835
-1768
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

42 files changed

+3835
-1768
lines changed

docs/book/install-and-build.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -67,11 +67,11 @@ ${cmd} /tmp/mdbook.${ext}
6767
chmod +x /tmp/mdbook
6868

6969
echo "grabbing the latest released controller-gen"
70-
go get sigs.k8s.io/controller-tools/cmd/controller-gen@v0.5.0
70+
go install sigs.k8s.io/controller-tools/cmd/controller-gen@v0.8.0
7171

7272
# make sure we add the go bin directory to our path
7373
gobin=$(go env GOBIN)
74-
gobin=${GOBIN:-$(go env GOPATH)/bin} # GOBIN won't always be set :-/
74+
gobin=${GOBIN:-$(go env GOPATH)/bin} # GOBIN won't always be set :-/
7575

7676
export PATH=${gobin}:$PATH
7777
verb=${1:-build}

docs/book/src/component-config-tutorial/testdata/project/Makefile

Lines changed: 56 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
# Image URL to use all building/pushing image targets
33
IMG ?= controller:latest
44
# ENVTEST_K8S_VERSION refers to the version of kubebuilder assets to be downloaded by envtest binary.
5-
ENVTEST_K8S_VERSION = 1.22
5+
ENVTEST_K8S_VERSION = 1.23
66

77
# Get the currently used golang install path (in GOPATH/bin, unless GOBIN is set)
88
ifeq (,$(shell go env GOBIN))
@@ -17,6 +17,7 @@ endif
1717
SHELL = /usr/bin/env bash -o pipefail
1818
.SHELLFLAGS = -ec
1919

20+
.PHONY: all
2021
all: build
2122

2223
##@ General
@@ -32,78 +33,101 @@ all: build
3233
# More info on the awk command:
3334
# http://linuxcommand.org/lc3_adv_awk.php
3435

36+
.PHONY: help
3537
help: ## Display this help.
3638
@awk 'BEGIN {FS = ":.*##"; printf "\nUsage:\n make \033[36m<target>\033[0m\n"} /^[a-zA-Z_0-9-]+:.*?##/ { printf " \033[36m%-15s\033[0m %s\n", $$1, $$2 } /^##@/ { printf "\n\033[1m%s\033[0m\n", substr($$0, 5) } ' $(MAKEFILE_LIST)
3739

3840
##@ Development
3941

42+
.PHONY: manifests
4043
manifests: controller-gen ## Generate WebhookConfiguration, ClusterRole and CustomResourceDefinition objects.
4144
$(CONTROLLER_GEN) rbac:roleName=manager-role crd webhook paths="./..." output:crd:artifacts:config=config/crd/bases
4245

46+
.PHONY: generate
4347
generate: controller-gen ## Generate code containing DeepCopy, DeepCopyInto, and DeepCopyObject method implementations.
4448
$(CONTROLLER_GEN) object:headerFile="hack/boilerplate.go.txt" paths="./..."
4549

50+
.PHONY: fmt
4651
fmt: ## Run go fmt against code.
4752
go fmt ./...
4853

54+
.PHONY: vet
4955
vet: ## Run go vet against code.
5056
go vet ./...
5157

58+
.PHONY: test
5259
test: manifests generate fmt vet envtest ## Run tests.
5360
KUBEBUILDER_ASSETS="$(shell $(ENVTEST) use $(ENVTEST_K8S_VERSION) -p path)" go test ./... -coverprofile cover.out
5461

5562
##@ Build
5663

64+
.PHONY: build
5765
build: generate fmt vet ## Build manager binary.
5866
go build -o bin/manager main.go
5967

68+
.PHONY: run
6069
run: manifests generate fmt vet ## Run a controller from your host.
6170
go run ./main.go
6271

72+
.PHONY: docker-build
6373
docker-build: test ## Build docker image with the manager.
6474
docker build -t ${IMG} .
6575

76+
.PHONY: docker-push
6677
docker-push: ## Push docker image with the manager.
6778
docker push ${IMG}
6879

6980
##@ Deployment
7081

82+
ifndef ignore-not-found
83+
ignore-not-found = false
84+
endif
85+
86+
.PHONY: install
7187
install: manifests kustomize ## Install CRDs into the K8s cluster specified in ~/.kube/config.
7288
$(KUSTOMIZE) build config/crd | kubectl apply -f -
7389

74-
uninstall: manifests kustomize ## Uninstall CRDs from the K8s cluster specified in ~/.kube/config.
75-
$(KUSTOMIZE) build config/crd | kubectl delete -f -
90+
.PHONY: uninstall
91+
uninstall: manifests kustomize ## Uninstall CRDs from the K8s cluster specified in ~/.kube/config. Call with ignore-not-found=true to ignore resource not found errors during deletion.
92+
$(KUSTOMIZE) build config/crd | kubectl delete --ignore-not-found=$(ignore-not-found) -f -
7693

94+
.PHONY: deploy
7795
deploy: manifests kustomize ## Deploy controller to the K8s cluster specified in ~/.kube/config.
7896
cd config/manager && $(KUSTOMIZE) edit set image controller=${IMG}
7997
$(KUSTOMIZE) build config/default | kubectl apply -f -
8098

81-
undeploy: ## Undeploy controller from the K8s cluster specified in ~/.kube/config.
82-
$(KUSTOMIZE) build config/default | kubectl delete -f -
83-
84-
85-
CONTROLLER_GEN = $(shell pwd)/bin/controller-gen
86-
controller-gen: ## Download controller-gen locally if necessary.
87-
$(call go-get-tool,$(CONTROLLER_GEN),sigs.k8s.io/controller-tools/cmd/[email protected])
88-
89-
KUSTOMIZE = $(shell pwd)/bin/kustomize
90-
kustomize: ## Download kustomize locally if necessary.
91-
$(call go-get-tool,$(KUSTOMIZE),sigs.k8s.io/kustomize/kustomize/[email protected])
92-
93-
ENVTEST = $(shell pwd)/bin/setup-envtest
94-
envtest: ## Download envtest-setup locally if necessary.
95-
$(call go-get-tool,$(ENVTEST),sigs.k8s.io/controller-runtime/tools/setup-envtest@latest)
96-
97-
# go-get-tool will 'go get' any package $2 and install it to $1.
98-
PROJECT_DIR := $(shell dirname $(abspath $(lastword $(MAKEFILE_LIST))))
99-
define go-get-tool
100-
@[ -f $(1) ] || { \
101-
set -e ;\
102-
TMP_DIR=$$(mktemp -d) ;\
103-
cd $$TMP_DIR ;\
104-
go mod init tmp ;\
105-
echo "Downloading $(2)" ;\
106-
GOBIN=$(PROJECT_DIR)/bin go get $(2) ;\
107-
rm -rf $$TMP_DIR ;\
108-
}
109-
endef
99+
.PHONY: undeploy
100+
undeploy: ## Undeploy controller from the K8s cluster specified in ~/.kube/config. Call with ignore-not-found=true to ignore resource not found errors during deletion.
101+
$(KUSTOMIZE) build config/default | kubectl delete --ignore-not-found=$(ignore-not-found) -f -
102+
103+
##@ Build Dependencies
104+
105+
## Location to install dependencies to
106+
LOCALBIN ?= $(shell pwd)/bin
107+
$(LOCALBIN): ## Ensure that the directory exists
108+
mkdir -p $(LOCALBIN)
109+
110+
## Tool Binaries
111+
KUSTOMIZE ?= $(LOCALBIN)/kustomize
112+
CONTROLLER_GEN ?= $(LOCALBIN)/controller-gen
113+
ENVTEST ?= $(LOCALBIN)/setup-envtest
114+
115+
## Tool Versions
116+
KUSTOMIZE_VERSION ?= v3.8.7
117+
CONTROLLER_TOOLS_VERSION ?= v0.8.0
118+
119+
KUSTOMIZE_INSTALL_SCRIPT ?= "https://raw.githubusercontent.com/kubernetes-sigs/kustomize/master/hack/install_kustomize.sh"
120+
.PHONY: kustomize
121+
kustomize: $(KUSTOMIZE) ## Download kustomize locally if necessary.
122+
$(KUSTOMIZE):
123+
curl -s $(KUSTOMIZE_INSTALL_SCRIPT) | bash -s -- $(subst v,,$(KUSTOMIZE_VERSION)) $(LOCALBIN)
124+
125+
.PHONY: controller-gen
126+
controller-gen: $(CONTROLLER_GEN) ## Download controller-gen locally if necessary.
127+
$(CONTROLLER_GEN):
128+
GOBIN=$(LOCALBIN) go install sigs.k8s.io/controller-tools/cmd/controller-gen@$(CONTROLLER_TOOLS_VERSION)
129+
130+
.PHONY: envtest
131+
envtest: $(ENVTEST) ## Download envtest-setup locally if necessary.
132+
$(ENVTEST):
133+
GOBIN=$(LOCALBIN) go install sigs.k8s.io/controller-runtime/tools/setup-envtest@latest

docs/book/src/component-config-tutorial/testdata/project/api/v2/zz_generated.deepcopy.go

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

docs/book/src/component-config-tutorial/testdata/project/config/crd/bases/config.tutorial.kubebuilder.io_projectconfigs.yaml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,9 @@
1-
21
---
32
apiVersion: apiextensions.k8s.io/v1
43
kind: CustomResourceDefinition
54
metadata:
65
annotations:
7-
controller-gen.kubebuilder.io/version: v0.6.1
6+
controller-gen.kubebuilder.io/version: v0.8.0
87
creationTimestamp: null
98
name: projectconfigs.config.tutorial.kubebuilder.io
109
spec:

docs/book/src/component-config-tutorial/testdata/project/config/manager/manager.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,8 @@ spec:
1919
replicas: 1
2020
template:
2121
metadata:
22+
annotations:
23+
kubectl.kubernetes.io/default-container: manager
2224
labels:
2325
control-plane: controller-manager
2426
spec:

docs/book/src/component-config-tutorial/testdata/project/config/samples/config_v2_projectconfig.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,4 @@ kind: ProjectConfig
33
metadata:
44
name: projectconfig-sample
55
spec:
6-
# Add fields here
6+
# TODO(user): Add fields here

docs/book/src/component-config-tutorial/testdata/project/go.mod

Lines changed: 34 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -3,68 +3,68 @@ module tutorial.kubebuilder.io/project
33
go 1.17
44

55
require (
6-
k8s.io/apimachinery v0.21.2
7-
k8s.io/client-go v0.21.2
8-
sigs.k8s.io/controller-runtime v0.9.2
6+
k8s.io/apimachinery v0.23.0
7+
k8s.io/client-go v0.23.0
8+
sigs.k8s.io/controller-runtime v0.11.0
99
)
1010

1111
require (
12-
cloud.google.com/go v0.54.0 // indirect
12+
cloud.google.com/go v0.81.0 // indirect
1313
github.com/Azure/go-autorest v14.2.0+incompatible // indirect
14-
github.com/Azure/go-autorest/autorest v0.11.12 // indirect
15-
github.com/Azure/go-autorest/autorest/adal v0.9.5 // indirect
14+
github.com/Azure/go-autorest/autorest v0.11.18 // indirect
15+
github.com/Azure/go-autorest/autorest/adal v0.9.13 // indirect
1616
github.com/Azure/go-autorest/autorest/date v0.3.0 // indirect
17-
github.com/Azure/go-autorest/logger v0.2.0 // indirect
17+
github.com/Azure/go-autorest/logger v0.2.1 // indirect
1818
github.com/Azure/go-autorest/tracing v0.6.0 // indirect
1919
github.com/beorn7/perks v1.0.1 // indirect
2020
github.com/cespare/xxhash/v2 v2.1.1 // indirect
2121
github.com/davecgh/go-spew v1.1.1 // indirect
22-
github.com/evanphx/json-patch v4.11.0+incompatible // indirect
23-
github.com/form3tech-oss/jwt-go v3.2.2+incompatible // indirect
24-
github.com/fsnotify/fsnotify v1.4.9 // indirect
25-
github.com/go-logr/logr v0.4.0 // indirect
26-
github.com/go-logr/zapr v0.4.0 // indirect
22+
github.com/evanphx/json-patch v4.12.0+incompatible // indirect
23+
github.com/form3tech-oss/jwt-go v3.2.3+incompatible // indirect
24+
github.com/fsnotify/fsnotify v1.5.1 // indirect
25+
github.com/go-logr/logr v1.2.0 // indirect
26+
github.com/go-logr/zapr v1.2.0 // indirect
2727
github.com/gogo/protobuf v1.3.2 // indirect
28-
github.com/golang/groupcache v0.0.0-20200121045136-8c9f03a8e57e // indirect
28+
github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da // indirect
2929
github.com/golang/protobuf v1.5.2 // indirect
3030
github.com/google/go-cmp v0.5.5 // indirect
3131
github.com/google/gofuzz v1.1.0 // indirect
3232
github.com/google/uuid v1.1.2 // indirect
3333
github.com/googleapis/gnostic v0.5.5 // indirect
34-
github.com/hashicorp/golang-lru v0.5.4 // indirect
3534
github.com/imdario/mergo v0.3.12 // indirect
36-
github.com/json-iterator/go v1.1.11 // indirect
35+
github.com/json-iterator/go v1.1.12 // indirect
3736
github.com/matttproud/golang_protobuf_extensions v1.0.2-0.20181231171920-c182affec369 // indirect
3837
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect
39-
github.com/modern-go/reflect2 v1.0.1 // indirect
38+
github.com/modern-go/reflect2 v1.0.2 // indirect
4039
github.com/pkg/errors v0.9.1 // indirect
4140
github.com/prometheus/client_golang v1.11.0 // indirect
4241
github.com/prometheus/client_model v0.2.0 // indirect
43-
github.com/prometheus/common v0.26.0 // indirect
42+
github.com/prometheus/common v0.28.0 // indirect
4443
github.com/prometheus/procfs v0.6.0 // indirect
4544
github.com/spf13/pflag v1.0.5 // indirect
4645
go.uber.org/atomic v1.7.0 // indirect
4746
go.uber.org/multierr v1.6.0 // indirect
48-
go.uber.org/zap v1.17.0 // indirect
49-
golang.org/x/crypto v0.0.0-20210220033148-5ea612d1eb83 // indirect
50-
golang.org/x/net v0.0.0-20210428140749-89ef3d95e781 // indirect
51-
golang.org/x/oauth2 v0.0.0-20200107190931-bf48bf16ab8d // indirect
52-
golang.org/x/sys v0.0.0-20210603081109-ebe580a85c40 // indirect
53-
golang.org/x/term v0.0.0-20210220032956-6a3ed077a48d // indirect
54-
golang.org/x/text v0.3.6 // indirect
55-
golang.org/x/time v0.0.0-20210611083556-38a9dc6acbc6 // indirect
47+
go.uber.org/zap v1.19.1 // indirect
48+
golang.org/x/crypto v0.0.0-20210817164053-32db794688a5 // indirect
49+
golang.org/x/net v0.0.0-20210825183410-e898025ed96a // indirect
50+
golang.org/x/oauth2 v0.0.0-20210819190943-2bc19b11175f // indirect
51+
golang.org/x/sys v0.0.0-20211029165221-6e7872819dc8 // indirect
52+
golang.org/x/term v0.0.0-20210615171337-6886f2dfbf5b // indirect
53+
golang.org/x/text v0.3.7 // indirect
54+
golang.org/x/time v0.0.0-20210723032227-1f47c861a9ac // indirect
5655
gomodules.xyz/jsonpatch/v2 v2.2.0 // indirect
5756
google.golang.org/appengine v1.6.7 // indirect
58-
google.golang.org/protobuf v1.26.0 // indirect
57+
google.golang.org/protobuf v1.27.1 // indirect
5958
gopkg.in/inf.v0 v0.9.1 // indirect
6059
gopkg.in/yaml.v2 v2.4.0 // indirect
6160
gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b // indirect
62-
k8s.io/api v0.21.2 // indirect
63-
k8s.io/apiextensions-apiserver v0.21.2 // indirect
64-
k8s.io/component-base v0.21.2 // indirect
65-
k8s.io/klog/v2 v2.8.0 // indirect
66-
k8s.io/kube-openapi v0.0.0-20210305001622-591a79e4bda7 // indirect
67-
k8s.io/utils v0.0.0-20210527160623-6fdb442a123b // indirect
68-
sigs.k8s.io/structured-merge-diff/v4 v4.1.0 // indirect
69-
sigs.k8s.io/yaml v1.2.0 // indirect
61+
k8s.io/api v0.23.0 // indirect
62+
k8s.io/apiextensions-apiserver v0.23.0 // indirect
63+
k8s.io/component-base v0.23.0 // indirect
64+
k8s.io/klog/v2 v2.30.0 // indirect
65+
k8s.io/kube-openapi v0.0.0-20211115234752-e816edb12b65 // indirect
66+
k8s.io/utils v0.0.0-20210930125809-cb0fa318a74b // indirect
67+
sigs.k8s.io/json v0.0.0-20211020170558-c049b76a60c6 // indirect
68+
sigs.k8s.io/structured-merge-diff/v4 v4.2.0 // indirect
69+
sigs.k8s.io/yaml v1.3.0 // indirect
7070
)

0 commit comments

Comments
 (0)