@@ -9,11 +9,8 @@ CONTAINER_ENGINE?=docker
99# To re-generate a bundle for another specific version without changing the standard setup, you can:
1010# - use the VERSION as arg of the bundle target (e.g make bundle VERSION=0.0.2)
1111# - use environment variables to overwrite this value (e.g export VERSION=0.0.2)
12- VERSION ?= 0.8.0
13-
14- ifndef PRODUCT_VERSION
15- PRODUCT_VERSION := $(shell git describe --tags --dirty --broken)
16- endif
12+ VERSION ?= $(shell git describe --tags --dirty --broken | cut -c 2-)
13+ PRODUCT_VERSION ?= $(shell git describe --tags --dirty --broken | cut -c 2-)
1714
1815# CHANNELS define the bundle channels used in the bundle.
1916# Add a new line here if you would like to change its default config. (E.g CHANNELS = "preview,fast,stable")
@@ -25,6 +22,14 @@ ifneq ($(origin CHANNELS), undefined)
2522BUNDLE_CHANNELS := --channels=$(CHANNELS )
2623endif
2724
25+ # Used by the olm-deploy if you running on Mac and deploy to K8S/Openshift
26+ ifndef TARGET_ARCH
27+ TARGET_ARCH := $(shell go env GOARCH)
28+ endif
29+ ifndef TARGET_OS
30+ TARGET_OS := $(shell go env GOOS)
31+ endif
32+
2833# DEFAULT_CHANNEL defines the default channel used in the bundle.
2934# Add a new line here if you would like to change its default config. (E.g DEFAULT_CHANNEL = "stable")
3035# To re-generate a bundle for any other default channel without changing the default setup, you can:
@@ -40,16 +45,21 @@ BUNDLE_METADATA_OPTS ?= $(BUNDLE_CHANNELS) $(BUNDLE_DEFAULT_CHANNEL)
4045REGISTRY ?= quay.io/mongodb
4146# BUNDLE_IMG defines the image:tag used for the bundle.
4247# You can use it as an arg. (E.g make bundle-build BUNDLE_IMG=<some-registry>/<project-name-bundle>:<tag>)
43- BUNDLE_IMG ?= $(REGISTRY ) /mongodb-atlas-controller -bundle:$(VERSION )
48+ BUNDLE_IMG ?= $(REGISTRY ) /mongodb-atlas-kubernetes-operator-prerelease -bundle:$(VERSION )
4449
45- # Image URL to use all building/pushing image targets
46- IMG ?= mongodb-atlas-controller:latest
50+ # IMG ?= mongodb-atlas-kubernetes-operator:latest
4751# BUNDLE_REGISTRY ?= $(REGISTRY)/mongodb-atlas-operator-bundle
48- OPERATOR_REGISTRY ?= $(REGISTRY ) /mongodb-atlas-operator
49- CATALOG_REGISTRY ?= $(REGISTRY ) /mongodb-atlas-catalog
52+ OPERATOR_REGISTRY ?= $(REGISTRY ) /mongodb-atlas-kubernetes- operator-prerelease
53+ CATALOG_REGISTRY ?= $(REGISTRY ) /mongodb-atlas-kubernetes-operator-prerelease- catalog
5054OPERATOR_IMAGE ?= ${OPERATOR_REGISTRY}:${VERSION}
5155CATALOG_IMAGE ?= ${CATALOG_REGISTRY}:${VERSION}
5256TARGET_NAMESPACE ?= mongodb-atlas-operator-system-test
57+
58+ # Image URL to use all building/pushing image targets
59+ ifndef IMG
60+ IMG := ${OPERATOR_REGISTRY}:${VERSION}
61+ endif
62+
5363# Get the currently used golang install path (in GOPATH/bin, unless GOBIN is set)
5464ifeq (,$(shell go env GOBIN) )
5565GOBIN =$(shell go env GOPATH) /bin
@@ -97,7 +107,7 @@ e2e-openshift-upgrade:
97107
98108.PHONY : manager
99109manager : generate fmt vet # # Build manager binary
100- go build -o bin/manager -ldflags=" -X main.version=$( PRODUCT_VERSION) " cmd/manager/main.go
110+ GOOS= $( TARGET_OS ) GOARCH= $( TARGET_ARCH ) go build -o bin/manager -ldflags=" -X main.version=$( PRODUCT_VERSION) " cmd/manager/main.go
101111
102112.PHONY : run
103113run : generate fmt vet manifests # # Run against the configured Kubernetes cluster in ~/.kube/config
@@ -167,6 +177,7 @@ endef
167177
168178.PHONY : bundle
169179bundle : manifests kustomize # # Generate bundle manifests and metadata, then validate generated files.
180+ @echo " Building bundle $( VERSION) "
170181 operator-sdk generate kustomize manifests -q --apis-dir=pkg/api
171182 cd config/manager && $(KUSTOMIZE ) edit set image controller=$(IMG )
172183 $(KUSTOMIZE ) build --load-restrictor LoadRestrictionsNone config/manifests | operator-sdk generate bundle -q --overwrite --version $(VERSION ) $(BUNDLE_METADATA_OPTS )
@@ -187,8 +198,7 @@ bundle-push:
187198
188199.PHONY : catalog-build
189200CATALOG_DIR ?= ./scripts/openshift/atlas-catalog
190- catalog-build : # # bundle bundle-push ## Build file-based bundle
191- $(MAKE ) image IMG=$(REGISTRY ) /mongodb-atlas-operator:$(VERSION )
201+ catalog-build : image
192202 CATALOG_DIR=$(CATALOG_DIR ) \
193203 CHANNEL=$(DEFAULT_CHANNEL ) \
194204 CATALOG_IMAGE=$(CATALOG_IMAGE ) \
@@ -211,11 +221,11 @@ build-subscription:
211221build-catalogsource :
212222 CATALOG_DIR=$(shell dirname "$(CATALOG_DIR ) ") \
213223 CATALOG_IMAGE=$(CATALOG_IMAGE ) \
224+ CATALOG_DISPLAY_NAME=" MongoDB Atlas operator $( VERSION) " \
214225 ./scripts/build_catalogsource.sh
215226
216227.PHONY : deploy-olm
217228# Deploy atlas operator to the running openshift cluster with OLM
218- deploy-olm : export IMG=$(REGISTRY ) /mongodb-atlas-operator:$(VERSION )
219229deploy-olm : bundle-build bundle-push catalog-build catalog-push build-catalogsource build-subscription
220230 oc -n openshift-marketplace delete catalogsource mongodb-atlas-kubernetes-local --ignore-not-found
221231 oc delete namespace $(TARGET_NAMESPACE ) --ignore-not-found
@@ -259,4 +269,4 @@ post-install-hook:
259269
260270.PHONY : x509-cert
261271x509-cert : # # Create X.509 cert at path tmp/x509/ (see docs/x509-user.md)
262- go run scripts/create_x509.go
272+ go run scripts/create_x509.go
0 commit comments