@@ -9,13 +9,7 @@ CONTAINER_ENGINE?=docker
9
9
# To re-generate a bundle for another specific version without changing the standard setup, you can:
10
10
# - use the VERSION as arg of the bundle target (e.g make bundle VERSION=0.0.2)
11
11
# - use environment variables to overwrite this value (e.g export VERSION=0.0.2)
12
- VERSION ?= 0.3.0
13
-
14
- ifndef PRODUCT_VERSION
15
- PRODUCT_VERSION := $(shell git describe --tags --dirty --broken)
16
- endif
17
-
18
- CONTAINER_ENGINE? =docker
12
+ VERSION ?= $(shell git describe --tags --dirty --broken | cut -c 2-)
19
13
20
14
# CHANNELS define the bundle channels used in the bundle.
21
15
# Add a new line here if you would like to change its default config. (E.g CHANNELS = "preview,fast,stable")
@@ -48,19 +42,16 @@ BUNDLE_METADATA_OPTS ?= $(BUNDLE_CHANNELS) $(BUNDLE_DEFAULT_CHANNEL)
48
42
49
43
# Base registry for the operator, bundle, catalog images
50
44
REGISTRY ?= quay.io/mongodb
51
- # Image URL to use all building/pushing image targets
52
- IMG ?= $(REGISTRY ) /mongodb-atlas-kubernetes-dbaas
53
- OPERATOR_REGISTRY ?= $(IMG )
54
-
55
- OPERATOR_IMG ?= $(IMG ) :$(VERSION )
56
- # OPERATOR_IMG ?= $(IMG):latest
57
-
58
- BUNDLE_IMG ?= $(IMG ) -bundle:$(VERSION )
59
- # BUNDLE_IMG ?= $(IMG)-bundle:latest
60
-
61
- CATALOG_IMG ?= $(IMG ) -catalog:$(VERSION )
62
- # CATALOG_IMG ?= ${IMG}-catalog:latest
63
-
45
+ # BUNDLE_IMG defines the image:tag used for the bundle.
46
+ # You can use it as an arg. (E.g make bundle-build BUNDLE_IMG=<some-registry>/<project-name-bundle>:<tag>)
47
+ BUNDLE_IMG ?= $(REGISTRY ) /mongodb-atlas-kubernetes-operator-prerelease-bundle:$(VERSION )
48
+
49
+ # IMG ?= mongodb-atlas-kubernetes-operator:latest
50
+ # BUNDLE_REGISTRY ?= $(REGISTRY)/mongodb-atlas-operator-bundle
51
+ OPERATOR_REGISTRY ?= $(REGISTRY ) /mongodb-atlas-kubernetes-operator-prerelease
52
+ CATALOG_REGISTRY ?= $(REGISTRY ) /mongodb-atlas-kubernetes-operator-prerelease-catalog
53
+ OPERATOR_IMAGE ?= ${OPERATOR_REGISTRY}:${VERSION}
54
+ CATALOG_IMAGE ?= ${CATALOG_REGISTRY}:${VERSION}
64
55
TARGET_NAMESPACE ?= mongodb-atlas-operator-system-test
65
56
66
57
# Image URL to use all building/pushing image targets
@@ -185,46 +176,39 @@ rm -rf $$TMP_DIR ;\
185
176
endef
186
177
187
178
.PHONY : bundle
188
- bundle : manifests kustomize # # Generate bundle manifests and metadata, update security context for OpenShift, then validate generated files.
179
+ bundle : manifests kustomize # # Generate bundle manifests and metadata, then validate generated files.
189
180
@echo " Building bundle $( VERSION) "
190
181
operator-sdk generate kustomize manifests -q --apis-dir=pkg/api
191
- cd config/manager && $(KUSTOMIZE ) edit set image controller=$(OPERATOR_IMG )
192
- $(KUSTOMIZE ) build --load-restrictor LoadRestrictionsNone config/manifests | operator-sdk generate bundle -q --overwrite --manifests -- version $(VERSION ) $(BUNDLE_METADATA_OPTS )
182
+ cd config/manager && $(KUSTOMIZE ) edit set image controller=$(IMG )
183
+ $(KUSTOMIZE ) build --load-restrictor LoadRestrictionsNone config/manifests | operator-sdk generate bundle -q --overwrite --version $(VERSION ) $(BUNDLE_METADATA_OPTS )
193
184
operator-sdk bundle validate ./bundle
194
185
195
186
.PHONY : image
196
- image : manager # # Build the operator image
197
- $(CONTAINER_ENGINE ) build -t $(OPERATOR_IMG ) .
198
- $(CONTAINER_ENGINE ) push $(OPERATOR_IMG )
187
+ image : # # Build the operator image
188
+ $(CONTAINER_ENGINE ) build --build-arg VERSION= $( VERSION ) - t $(OPERATOR_IMAGE ) .
189
+ $(CONTAINER_ENGINE ) push $(OPERATOR_IMAGE )
199
190
200
191
.PHONY : bundle-build
201
192
bundle-build : # # Build the bundle image.
202
193
$(CONTAINER_ENGINE ) build -f bundle.Dockerfile -t $(BUNDLE_IMG ) .
203
194
204
195
.PHONY : bundle-push
205
- bundle-push : # # Push the bundle image.
196
+ bundle-push :
206
197
$(CONTAINER_ENGINE ) push $(BUNDLE_IMG )
207
198
208
- # A comma-separated list of bundle images (e.g. make catalog-build BUNDLE_IMGS=example.com/operator-bundle:v0.1.0,example.com/operator-bundle:v0.2.0).
209
- # These images MUST exist in a registry and be pull-able.
210
- BUNDLE_IMGS ?= $(BUNDLE_IMG )
211
-
212
199
.PHONY : catalog-build
213
200
CATALOG_DIR ?= ./scripts/openshift/atlas-catalog
214
- # catalog-build: IMG=
215
- catalog-build : # # bundle bundle-push ## Build file-based bundle
216
- $(MAKE ) image IMG=$(IMG )
201
+ catalog-build : image
217
202
CATALOG_DIR=$(CATALOG_DIR ) \
218
203
CHANNEL=$(DEFAULT_CHANNEL ) \
219
- CATALOG_IMAGE=$(CATALOG_IMG ) \
204
+ CATALOG_IMAGE=$(CATALOG_IMAGE ) \
220
205
BUNDLE_IMAGE=$(BUNDLE_IMG ) \
221
206
VERSION=$(VERSION ) \
222
- CONTAINER_ENGINE=$(CONTAINER_ENGINE ) \
223
207
./scripts/build_catalog.sh
224
208
225
209
.PHONY : catalog-push
226
210
catalog-push :
227
- $(CONTAINER_ENGINE ) push $(CATALOG_IMG )
211
+ $(CONTAINER_ENGINE ) push $(CATALOG_IMAGE )
228
212
229
213
.PHONY : build-subscription
230
214
build-subscription :
@@ -242,7 +226,6 @@ build-catalogsource:
242
226
243
227
.PHONY : deploy-olm
244
228
# Deploy atlas operator to the running openshift cluster with OLM
245
- deploy-olm : export IMG=$(OPERATOR_IMAGE )
246
229
deploy-olm : bundle-build bundle-push catalog-build catalog-push build-catalogsource build-subscription
247
230
oc -n openshift-marketplace delete catalogsource mongodb-atlas-kubernetes-local --ignore-not-found
248
231
oc delete namespace $(TARGET_NAMESPACE ) --ignore-not-found
@@ -258,7 +241,7 @@ deploy-olm: bundle-build bundle-push catalog-build catalog-push build-catalogsou
258
241
259
242
.PHONY : image-push
260
243
image-push : # # Push the docker image
261
- $(CONTAINER_ENGINE ) push ${OPERATOR_IMG }
244
+ $(CONTAINER_ENGINE ) push ${IMG }
262
245
263
246
# Additional make goals
264
247
.PHONY : run-kind
0 commit comments