@@ -28,8 +28,8 @@ BUNDLE_METADATA_OPTS ?= $(BUNDLE_CHANNELS) $(BUNDLE_DEFAULT_CHANNEL)
28
28
# This variable is used to construct full image tags for bundle and catalog images.
29
29
#
30
30
# For example, running 'make bundle-build bundle-push catalog-build catalog-push' will build and push both
31
- # sigstore.dev/sdk-init- bundle:$VERSION and sigstore.dev/sdk-init -catalog:$VERSION.
32
- IMAGE_TAG_BASE ?= sigstore.dev/sdk-init
31
+ # sigstore.dev/model-validation-operator- bundle:$VERSION and sigstore.dev/model-validation-operator -catalog:$VERSION.
32
+ IMAGE_TAG_BASE ?= sigstore.dev/model-validation-operator
33
33
34
34
# BUNDLE_IMG defines the image:tag used for the bundle.
35
35
# You can use it as an arg. (E.g make bundle-build BUNDLE_IMG=<some-registry>/<project-name-bundle>:<tag>)
48
48
49
49
# Set the Operator SDK version to use. By default, what is installed on the system is used.
50
50
# This is useful for CI or a project to utilize a specific version of the operator-sdk toolkit.
51
- OPERATOR_SDK_VERSION ?= v1.39.2
51
+ OPERATOR_SDK_VERSION ?= v1.40.0
52
52
# Image URL to use all building/pushing image targets
53
53
IMG ?= controller:latest
54
- # ENVTEST_K8S_VERSION refers to the version of kubebuilder assets to be downloaded by envtest binary.
55
- ENVTEST_K8S_VERSION = 1.31.0
56
- ENVTEST_VERSION ?= release-0.17
57
54
58
55
# Get the currently used golang install path (in GOPATH/bin, unless GOBIN is set)
59
56
ifeq (,$(shell go env GOBIN) )
@@ -112,12 +109,15 @@ vet: ## Run go vet against code.
112
109
go vet ./...
113
110
114
111
.PHONY : test
115
- test : manifests generate fmt vet envtest # # Run tests.
112
+ test : manifests generate fmt vet setup- envtest # # Run tests.
116
113
KUBEBUILDER_ASSETS=" $( shell $( ENVTEST) use $( ENVTEST_K8S_VERSION) --bin-dir $( LOCALBIN) -p path) " go test $$(go list ./... | grep -v /e2e ) -coverprofile cover.out
117
114
118
- # Utilize Kind or modify the e2e tests to load the image locally, enabling compatibility with other vendors.
119
- .PHONY : test-e2e # Run the e2e tests against a Kind k8s instance that is spun up.
120
- test-e2e :
115
+ # TODO(user): To use a different vendor for e2e tests, modify the setup under 'tests/e2e'.
116
+ # The default setup assumes Kind is pre-installed and builds/loads the Manager Docker image locally.
117
+ # CertManager is installed by default; skip with:
118
+ # - CERT_MANAGER_INSTALL_SKIP=true
119
+ .PHONY : test-e2e
120
+ test-e2e : manifests generate fmt vet # # Run the e2e tests. Expected an isolated environment using Kind.
121
121
go test ./test/e2e/ -v -ginkgo.v
122
122
123
123
.PHONY : lint
@@ -128,6 +128,10 @@ lint: golangci-lint ## Run golangci-lint linter
128
128
lint-fix : golangci-lint # # Run golangci-lint linter and perform fixes
129
129
$(GOLANGCI_LINT ) run --fix
130
130
131
+ .PHONY : lint-config
132
+ lint-config : golangci-lint # # Verify golangci-lint linter configuration
133
+ $(GOLANGCI_LINT ) config verify
134
+
131
135
# #@ Build
132
136
133
137
.PHONY : build
@@ -142,8 +146,8 @@ run: manifests generate fmt vet ## Run a controller from your host.
142
146
# (i.e. docker build --platform linux/arm64). However, you must enable docker buildKit for it.
143
147
# More info: https://docs.docker.com/develop/develop-images/build_enhancements/
144
148
.PHONY : docker-build
145
- docker-build : test # # Build docker image with the manager.
146
- $(CONTAINER_TOOL ) build -t ${IMG} .
149
+ docker-build : # # Build docker image with the manager.
150
+ $(CONTAINER_TOOL ) build -f Containerfile - t ${IMG} .
147
151
148
152
.PHONY : docker-push
149
153
docker-push : # # Push docker image with the manager.
@@ -160,10 +164,10 @@ PLATFORMS ?= linux/arm64,linux/amd64,linux/s390x,linux/ppc64le
160
164
docker-buildx : # # Build and push docker image for the manager for cross-platform support
161
165
# copy existing Dockerfile and insert --platform=${BUILDPLATFORM} into Dockerfile.cross, and preserve the original Dockerfile
162
166
sed -e ' 1 s/\(^FROM\)/FROM --platform=\$$\{BUILDPLATFORM\}/; t' -e ' 1,// s//FROM --platform=\$$\{BUILDPLATFORM\}/' Dockerfile > Dockerfile.cross
163
- - $(CONTAINER_TOOL ) buildx create --name sdk-init -builder
164
- $(CONTAINER_TOOL ) buildx use sdk-init -builder
167
+ - $(CONTAINER_TOOL ) buildx create --name model-validation-operator -builder
168
+ $(CONTAINER_TOOL ) buildx use model-validation-operator -builder
165
169
- $(CONTAINER_TOOL ) buildx build --push --platform=$(PLATFORMS ) --tag ${IMG} -f Dockerfile.cross .
166
- - $(CONTAINER_TOOL ) buildx rm sdk-init -builder
170
+ - $(CONTAINER_TOOL ) buildx rm model-validation-operator -builder
167
171
rm Dockerfile.cross
168
172
169
173
.PHONY : build-installer
@@ -204,16 +208,20 @@ $(LOCALBIN):
204
208
205
209
# # Tool Binaries
206
210
KUBECTL ?= kubectl
211
+ KIND ?= kind
207
212
KUSTOMIZE ?= $(LOCALBIN ) /kustomize
208
213
CONTROLLER_GEN ?= $(LOCALBIN ) /controller-gen
209
214
ENVTEST ?= $(LOCALBIN ) /setup-envtest
210
215
GOLANGCI_LINT = $(LOCALBIN ) /golangci-lint
211
216
212
217
# # Tool Versions
213
- KUSTOMIZE_VERSION ?= v5.4.3
214
- CONTROLLER_TOOLS_VERSION ?= v0.16.1
215
- ENVTEST_VERSION ?= release-0.19
216
- GOLANGCI_LINT_VERSION ?= v1.59.1
218
+ KUSTOMIZE_VERSION ?= v5.6.0
219
+ CONTROLLER_TOOLS_VERSION ?= v0.17.2
220
+ # ENVTEST_VERSION is the version of controller-runtime release branch to fetch the envtest setup script (i.e. release-0.20)
221
+ ENVTEST_VERSION ?= $(shell go list -m -f "{{ .Version }}" sigs.k8s.io/controller-runtime | awk -F'[v.]' '{printf "release-% d.% d", $$2, $$3}')
222
+ # ENVTEST_K8S_VERSION is the version of Kubernetes to use for setting up ENVTEST binaries (i.e. 1.31)
223
+ ENVTEST_K8S_VERSION ?= $(shell go list -m -f "{{ .Version }}" k8s.io/api | awk -F'[v.]' '{printf "1.% d", $$3}')
224
+ GOLANGCI_LINT_VERSION ?= v1.63.4
217
225
218
226
.PHONY : kustomize
219
227
kustomize : $(KUSTOMIZE ) # # Download kustomize locally if necessary.
@@ -225,6 +233,14 @@ controller-gen: $(CONTROLLER_GEN) ## Download controller-gen locally if necessar
225
233
$(CONTROLLER_GEN ) : $(LOCALBIN )
226
234
$(call go-install-tool,$(CONTROLLER_GEN ) ,sigs.k8s.io/controller-tools/cmd/controller-gen,$(CONTROLLER_TOOLS_VERSION ) )
227
235
236
+ .PHONY : setup-envtest
237
+ setup-envtest : envtest # # Download the binaries required for ENVTEST in the local bin directory.
238
+ @echo " Setting up envtest binaries for Kubernetes version $( ENVTEST_K8S_VERSION) ..."
239
+ @$(ENVTEST ) use $(ENVTEST_K8S_VERSION ) --bin-dir $(LOCALBIN ) -p path || { \
240
+ echo " Error: Failed to set up envtest binaries for version $( ENVTEST_K8S_VERSION) ." ; \
241
+ exit 1; \
242
+ }
243
+
228
244
.PHONY : envtest
229
245
envtest : $(ENVTEST ) # # Download setup-envtest locally if necessary.
230
246
$(ENVTEST ) : $(LOCALBIN )
@@ -277,7 +293,7 @@ bundle: manifests kustomize operator-sdk ## Generate bundle manifests and metada
277
293
278
294
.PHONY : bundle-build
279
295
bundle-build : # # Build the bundle image.
280
- docker build -f bundle.Dockerfile -t $(BUNDLE_IMG ) .
296
+ $( CONTAINER_TOOL ) build -f bundle.Dockerfile -t $(BUNDLE_IMG ) .
281
297
282
298
.PHONY : bundle-push
283
299
bundle-push : # # Push the bundle image.
@@ -292,7 +308,7 @@ ifeq (,$(shell which opm 2>/dev/null))
292
308
set -e ;\
293
309
mkdir -p $(dir $(OPM)) ;\
294
310
OS=$(shell go env GOOS) && ARCH=$(shell go env GOARCH) && \
295
- curl -sSLo $(OPM) https://github.com/operator-framework/operator-registry/releases/download/v1.23 .0/$${OS}-$${ARCH}-opm ;\
311
+ curl -sSLo $(OPM) https://github.com/operator-framework/operator-registry/releases/download/v1.55 .0/$${OS}-$${ARCH}-opm ;\
296
312
chmod +x $(OPM) ;\
297
313
}
298
314
else
@@ -317,7 +333,7 @@ endif
317
333
# https://github.com/operator-framework/community-operators/blob/7f1438c/docs/packaging-operator.md#updating-your-existing-operator
318
334
.PHONY : catalog-build
319
335
catalog-build : opm # # Build a catalog image.
320
- $(OPM ) index add --container-tool docker --mode semver --tag $(CATALOG_IMG ) --bundles $(BUNDLE_IMGS ) $(FROM_INDEX_OPT )
336
+ $(OPM ) index add --container-tool $( CONTAINER_TOOL ) --mode semver --tag $(CATALOG_IMG ) --bundles $(BUNDLE_IMGS ) $(FROM_INDEX_OPT )
321
337
322
338
# Push the catalog image.
323
339
.PHONY : catalog-push
0 commit comments