@@ -73,6 +73,17 @@ test: generate fmt vet manifests
73
73
-coverprofile=${PWD} /coverage/unit-test-pkg_vn-agent_server_test.out )
74
74
@cd ${PWD}
75
75
76
+
77
+ # run `make install-envtest` to refresh the required binaries in case the envTest fails.
78
+ K8S_VERSION ?= 1.19.2
79
+ FULL_K8S_VERSION ?= Kubernetes v$(K8S_VERSION )
80
+ install-envtest :
81
+ ifneq ($(FULL_K8S_VERSION ) , $(shell /usr/local/kubebuilder/bin/kube-apiserver --version) )
82
+ sudo mkdir -p /usr/local/kubebuilder
83
+ curl -sSLo envtest-bins.tar.gz "https://storage.googleapis.com/kubebuilder-tools/kubebuilder-tools-${K8S_VERSION}-$(shell go env GOOS)-$(shell go env GOARCH).tar.gz"
84
+ sudo tar -C /usr/local/kubebuilder --strip-components=1 -zvxf envtest-bins.tar.gz && rm envtest-bins.tar.gz
85
+ endif
86
+
76
87
.PHONY : coverage
77
88
coverage : # # combine coverage after test
78
89
@mkdir -p coverage
@@ -91,35 +102,17 @@ run: generate fmt vet
91
102
92
103
# Install CRDs into a cluster
93
104
install : manifests
94
- kubectl apply -f config/crds
105
+ kubectl apply -f config/crd
95
106
96
107
# Deploy controller in the configured Kubernetes cluster in ~/.kube/config
97
108
deploy : manifests
98
- kubectl apply -f config/crds
109
+ kubectl apply -f config/crd
99
110
kustomize build config/default | kubectl apply -f -
100
111
101
112
# Generate manifests e.g. CRD, RBAC etc.
102
113
manifests : controller-gen
103
114
$(CONTROLLER_GEN ) $(CRD_OPTIONS ) rbac:roleName=manager-role paths=" ./..." output:crd:none
104
115
hack/make-rules/replace-null.sh
105
- # To work around a known controller gen issue
106
- # https://github.com/kubernetes-sigs/kubebuilder/issues/1544
107
- ifeq (, $(shell which yq) )
108
- @echo "Please install yq for yaml patching. Get it from here: https://github.com/mikefarah/yq"
109
- @exit
110
- else
111
- @{ \
112
- yq w -i config/crds/tenancy.x-k8s.io_clusterversions.yaml "spec.validation.openAPIV3Schema.properties.spec.properties.apiServer.properties.statefulset.properties.spec.properties.template.properties.spec.properties.containers.items.properties.ports.items.required[1]" protocol;\
113
- yq w -i config/crds/tenancy.x-k8s.io_clusterversions.yaml "spec.validation.openAPIV3Schema.properties.spec.properties.controllerManager.properties.statefulset.properties.spec.properties.template.properties.spec.properties.containers.items.properties.ports.items.required[1]" protocol;\
114
- yq w -i config/crds/tenancy.x-k8s.io_clusterversions.yaml "spec.validation.openAPIV3Schema.properties.spec.properties.etcd.properties.statefulset.properties.spec.properties.template.properties.spec.properties.containers.items.properties.ports.items.required[1]" protocol;\
115
- yq w -i config/crds/tenancy.x-k8s.io_clusterversions.yaml "spec.validation.openAPIV3Schema.properties.spec.properties.apiServer.properties.statefulset.properties.spec.properties.template.properties.spec.properties.initContainers.items.properties.ports.items.required[1]" protocol;\
116
- yq w -i config/crds/tenancy.x-k8s.io_clusterversions.yaml "spec.validation.openAPIV3Schema.properties.spec.properties.controllerManager.properties.statefulset.properties.spec.properties.template.properties.spec.properties.initContainers.items.properties.ports.items.required[1]" protocol;\
117
- yq w -i config/crds/tenancy.x-k8s.io_clusterversions.yaml "spec.validation.openAPIV3Schema.properties.spec.properties.etcd.properties.statefulset.properties.spec.properties.template.properties.spec.properties.initContainers.items.properties.ports.items.required[1]" protocol;\
118
- yq w -i config/crds/tenancy.x-k8s.io_clusterversions.yaml "spec.validation.openAPIV3Schema.properties.spec.properties.apiServer.properties.service.properties.spec.properties.ports.items.required[1]" protocol;\
119
- yq w -i config/crds/tenancy.x-k8s.io_clusterversions.yaml "spec.validation.openAPIV3Schema.properties.spec.properties.controllerManager.properties.service.properties.spec.properties.ports.items.required[1]" protocol;\
120
- yq w -i config/crds/tenancy.x-k8s.io_clusterversions.yaml "spec.validation.openAPIV3Schema.properties.spec.properties.etcd.properties.service.properties.spec.properties.ports.items.required[1]" protocol;\
121
- }
122
- endif
123
116
124
117
# Run go fmt against code
125
118
fmt :
0 commit comments