diff --git a/Makefile b/Makefile index 071303230..a52c5d624 100644 --- a/Makefile +++ b/Makefile @@ -88,6 +88,12 @@ IBM_SUBSCRIPTION_CHANNEL=$(IBM_SUBSCRIPTION_CHANNEL) IBM_SUBSCRIPTION_STARTINGCSV=$(IBM_SUBSCRIPTION_STARTINGCSV) IBM_SUBSCRIPTION_CATALOGSOURCE=$(IBM_SUBSCRIPTION_CATALOGSOURCE) IBM_SUBSCRIPTION_CATALOGSOURCE_NAMESPACE=$(IBM_SUBSCRIPTION_CATALOGSOURCE_NAMESPACE) +PROMETHEUS_SUBSCRIPTION_NAME=$(PROMETHEUS_SUBSCRIPTION_NAME) +PROMETHEUS_SUBSCRIPTION_PACKAGE=$(PROMETHEUS_SUBSCRIPTION_PACKAGE) +PROMETHEUS_SUBSCRIPTION_CHANNEL=$(PROMETHEUS_SUBSCRIPTION_CHANNEL) +PROMETHEUS_SUBSCRIPTION_STARTINGCSV=$(PROMETHEUS_SUBSCRIPTION_STARTINGCSV) +PROMETHEUS_SUBSCRIPTION_CATALOGSOURCE=$(PROMETHEUS_SUBSCRIPTION_CATALOGSOURCE) +PROMETHEUS_SUBSCRIPTION_CATALOGSOURCE_NAMESPACE=$(PROMETHEUS_SUBSCRIPTION_CATALOGSOURCE_NAMESPACE) endef export MANAGER_ENV_VARS @@ -168,6 +174,7 @@ catalog: opm ## Generate catalog manifests and then validate generated files. $(OPM) render --output=yaml $(IBM_BUNDLE_IMG) $(OPM_RENDER_OPTS) > catalog/ibm.yaml $(OPM) render --output=yaml $(NOOBAA_BUNDLE_IMG) $(OPM_RENDER_OPTS) > catalog/noobaa.yaml $(OPM) render --output=yaml $(CSIADDONS_BUNDLE_IMG) $(OPM_RENDER_OPTS) > catalog/csiaddons.yaml + $(OPM) render --output=yaml $(PROMETHEUS_BUNDLE_IMG) $(OPM_RENDER_OPTS) > catalog/prometheus.yaml $(OPM) validate catalog .PHONY: catalog-build diff --git a/bundle/metadata/dependencies.yaml b/bundle/metadata/dependencies.yaml index c3dc4117b..0dfb6b77a 100644 --- a/bundle/metadata/dependencies.yaml +++ b/bundle/metadata/dependencies.yaml @@ -11,3 +11,7 @@ dependencies: value: packageName: csi-addons version: "0.7.0" +- type: olm.package + value: + packageName: prometheus-operator + version: "4.10.0" diff --git a/controllers/defaults.go b/controllers/defaults.go index 1161194d6..cdd2b749d 100644 --- a/controllers/defaults.go +++ b/controllers/defaults.go @@ -51,6 +51,13 @@ var ( "IBM_SUBSCRIPTION_STARTINGCSV": "ibm-storage-odf-operator.v1.4.0", "IBM_SUBSCRIPTION_CATALOGSOURCE": "odf-catalogsource", "IBM_SUBSCRIPTION_CATALOGSOURCE_NAMESPACE": "openshift-marketplace", + // TODO - to be confirmed + "PROMETHEUS_SUBSCRIPTION_NAME": "prometheus-operator", + "PROMETHEUS_SUBSCRIPTION_PACKAGE": "prometheus-operator", + "PROMETHEUS_SUBSCRIPTION_CHANNEL": "alpha", + "PROMETHEUS_SUBSCRIPTION_STARTINGCSV": "prometheus-operator.v4.14.0", + "PROMETHEUS_SUBSCRIPTION_CATALOGSOURCE": "odf-catalogsource", + "PROMETHEUS_SUBSCRIPTION_CATALOGSOURCE_NAMESPACE": "openshift-marketplace", } OperatorNamespace = GetEnvOrDefault("OPERATOR_NAMESPACE") @@ -82,6 +89,13 @@ var ( IbmSubscriptionStartingCSV = GetEnvOrDefault("IBM_SUBSCRIPTION_STARTINGCSV") IbmSubscriptionCatalogSource = GetEnvOrDefault("IBM_SUBSCRIPTION_CATALOGSOURCE") IbmSubscriptionCatalogSourceNamespace = GetEnvOrDefault("IBM_SUBSCRIPTION_CATALOGSOURCE_NAMESPACE") + + PrometheusSubscriptionName = GetEnvOrDefault("PROMETHEUS_SUBSCRIPTION_NAME") + PrometheusSubscriptionPackage = GetEnvOrDefault("PROMETHEUS_SUBSCRIPTION_PACKAGE") + PrometheusSubscriptionChannel = GetEnvOrDefault("PROMETHEUS_SUBSCRIPTION_CHANNEL") + PrometheusSubscriptionStartingCSV = GetEnvOrDefault("PROMETHEUS_SUBSCRIPTION_STARTINGCSV") + PrometheusSubscriptionCatalogSource = GetEnvOrDefault("PROMETHEUS_SUBSCRIPTION_CATALOGSOURCE") + PrometheusSubscriptionCatalogSourceNamespace = GetEnvOrDefault("PROMETHEUS_SUBSCRIPTION_CATALOGSOURCE_NAMESPACE") ) const ( diff --git a/controllers/subscriptions.go b/controllers/subscriptions.go index 836eb5d24..ca7ed3396 100644 --- a/controllers/subscriptions.go +++ b/controllers/subscriptions.go @@ -283,7 +283,22 @@ func GetStorageClusterSubscriptions() []*operatorv1alpha1.Subscription { }, } - return []*operatorv1alpha1.Subscription{noobaaSubscription, ocsSubscription, csiAddonsSubscription} + prometheusSubscription := &operatorv1alpha1.Subscription{ + ObjectMeta: metav1.ObjectMeta{ + Name: PrometheusSubscriptionName, + Namespace: OperatorNamespace, + }, + Spec: &operatorv1alpha1.SubscriptionSpec{ + CatalogSource: PrometheusSubscriptionCatalogSource, + CatalogSourceNamespace: PrometheusSubscriptionCatalogSourceNamespace, + Package: PrometheusSubscriptionPackage, + Channel: PrometheusSubscriptionChannel, + StartingCSV: PrometheusSubscriptionStartingCSV, + InstallPlanApproval: operatorv1alpha1.ApprovalAutomatic, + }, + } + + return []*operatorv1alpha1.Subscription{noobaaSubscription, ocsSubscription, csiAddonsSubscription, prometheusSubscription} } // GetFlashSystemClusterSubscription return subscription for FlashSystemCluster diff --git a/hack/make-bundle-vars.mk b/hack/make-bundle-vars.mk index 1de7e2e04..1a680918d 100644 --- a/hack/make-bundle-vars.mk +++ b/hack/make-bundle-vars.mk @@ -96,9 +96,15 @@ ODF_CONSOLE_IMG_TAG ?= latest ODF_CONSOLE_IMG_LOCATION ?= quay.io/ocs-dev ODF_CONSOLE_IMG ?= $(ODF_CONSOLE_IMG_LOCATION)/$(ODF_CONSOLE_IMG_NAME):$(ODF_CONSOLE_IMG_TAG) +PROMETHEUS_BUNDLE_NAME ?= prometheus-operator +PROMETHEUS_BUNDLE_IMG_NAME ?= $(PROMETHEUS_BUNDLE_NAME)-bundle +PROMETHEUS_BUNDLE_IMG_TAG ?= v4.10.0 +PROMETHEUS_BUNDLE_IMG_LOCATION ?= quay.io/ocs-dev +PROMETHEUS_BUNDLE_IMG ?= $(PROMETHEUS_BUNDLE_IMG_LOCATION)/$(PROMETHEUS_BUNDLE_IMG_NAME):$(PROMETHEUS_BUNDLE_IMG_TAG) + # A space-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). # These images MUST exist in a registry and be pull-able. -BUNDLE_IMGS ?= $(BUNDLE_IMG) $(OCS_BUNDLE_IMG) $(IBM_BUNDLE_IMG) $(NOOBAA_BUNDLE_IMG) $(CSIADDONS_BUNDLE_IMG) +BUNDLE_IMGS ?= $(BUNDLE_IMG) $(OCS_BUNDLE_IMG) $(IBM_BUNDLE_IMG) $(NOOBAA_BUNDLE_IMG) $(CSIADDONS_BUNDLE_IMG) $(PROMETHEUS_BUNDLE_IMG) # Set CATALOG_BASE_IMG to an existing catalog image tag to add $BUNDLE_IMGS to that image. ifneq ($(origin CATALOG_BASE_IMG), undefined) @@ -138,6 +144,13 @@ IBM_SUBSCRIPTION_STARTINGCSV ?= $(IBM_BUNDLE_NAME).v$(IBM_BUNDLE_IMG_TAG) IBM_SUBSCRIPTION_CATALOGSOURCE ?= $(OPERATOR_CATALOGSOURCE) IBM_SUBSCRIPTION_CATALOGSOURCE_NAMESPACE ?= $(OPERATOR_CATALOGSOURCE_NAMESPACE) +PROMETHEUS_SUBSCRIPTION_NAME ?= $(PROMETHEUS_BUNDLE_NAME) +PROMETHEUS_SUBSCRIPTION_PACKAGE ?= $(PROMETHEUS_BUNDLE_NAME) +PROMETHEUS_SUBSCRIPTION_CHANNEL ?= $(DEFAULT_CHANNEL) +PROMETHEUS_SUBSCRIPTION_STARTINGCSV ?= $(PROMETHEUS_BUNDLE_NAME).$(PROMETHEUS_BUNDLE_IMG_TAG) +PROMETHEUS_SUBSCRIPTION_CATALOGSOURCE ?= $(OPERATOR_CATALOGSOURCE) +PROMETHEUS_SUBSCRIPTION_CATALOGSOURCE_NAMESPACE ?= $(OPERATOR_CATALOGSOURCE_NAMESPACE) + # kube rbac proxy image variables CLUSTER_ENV ?= openshift KUBE_RBAC_PROXY_IMG ?= gcr.io/kubebuilder/kube-rbac-proxy:v0.13.1