50
50
# This is useful for CI or a project to utilize a specific version of the operator-sdk toolkit.
51
51
OPERATOR_SDK_VERSION ?= v1.39.2
52
52
53
+ # Container tool to use for building and pushing images
54
+ CONTAINER_TOOL ?= docker
55
+
53
56
# Image URL to use all building/pushing image targets
54
57
IMG ?= controller:latest
55
58
@@ -81,11 +84,11 @@ run: helm-operator ## Run against the configured Kubernetes cluster in ~/.kube/c
81
84
82
85
.PHONY : docker-build
83
86
docker-build : # # Build docker image with the manager.
84
- docker build -t ${IMG} .
87
+ $( CONTAINER_TOOL ) build -t ${IMG} .
85
88
86
89
.PHONY : docker-push
87
90
docker-push : # # Push docker image with the manager.
88
- docker push ${IMG}
91
+ $( CONTAINER_TOOL ) push ${IMG}
89
92
90
93
# PLATFORMS defines the target platforms for the manager image be build to provide support to multiple
91
94
# architectures. (i.e. make docker-buildx IMG=myregistry/mypoperator:0.0.1). To use this option you need to:
@@ -96,10 +99,10 @@ docker-push: ## Push docker image with the manager.
96
99
PLATFORMS ?= linux/arm64,linux/amd64,linux/s390x,linux/ppc64le
97
100
.PHONY : docker-buildx
98
101
docker-buildx : # # Build and push docker image for the manager for cross-platform support
99
- - docker buildx create --name project-v3-builder
100
- docker buildx use project-v3-builder
101
- - docker buildx build --push --platform=$(PLATFORMS ) --tag ${IMG} -f Dockerfile .
102
- - docker buildx rm project-v3-builder
102
+ - $( CONTAINER_TOOL ) buildx create --name project-v3-builder
103
+ $( CONTAINER_TOOL ) buildx use project-v3-builder
104
+ - $( CONTAINER_TOOL ) buildx build --push --platform=$(PLATFORMS ) --tag ${IMG} -f Dockerfile .
105
+ - $( CONTAINER_TOOL ) buildx rm project-v3-builder
103
106
104
107
# #@ Deployment
105
108
@@ -171,6 +174,7 @@ OPERATOR_SDK = $(shell which operator-sdk)
171
174
endif
172
175
endif
173
176
177
+
174
178
.PHONY : bundle
175
179
bundle : kustomize operator-sdk # # Generate bundle manifests and metadata, then validate generated files.
176
180
$(OPERATOR_SDK ) generate kustomize manifests --interactive=false -q
@@ -180,7 +184,7 @@ bundle: kustomize operator-sdk ## Generate bundle manifests and metadata, then v
180
184
181
185
.PHONY : bundle-build
182
186
bundle-build : # # Build the bundle image.
183
- docker build -f bundle.Dockerfile -t $(BUNDLE_IMG ) .
187
+ $( CONTAINER_TOOL ) build -f bundle.Dockerfile -t $(BUNDLE_IMG ) .
184
188
185
189
.PHONY : bundle-push
186
190
bundle-push : # # Push the bundle image.
@@ -219,7 +223,7 @@ endif
219
223
# https://github.com/operator-framework/community-operators/blob/7f1438c/docs/packaging-operator.md#updating-your-existing-operator
220
224
.PHONY : catalog-build
221
225
catalog-build : opm # # Build a catalog image.
222
- $(OPM ) index add --container-tool docker --mode semver --tag $(CATALOG_IMG ) --bundles $(BUNDLE_IMGS ) $(FROM_INDEX_OPT )
226
+ $(OPM ) index add --container-tool $( CONTAINER_TOOL ) --mode semver --tag $(CATALOG_IMG ) --bundles $(BUNDLE_IMGS ) $(FROM_INDEX_OPT )
223
227
224
228
# Push the catalog image.
225
229
.PHONY : catalog-push
0 commit comments