From 097beef3d0776748d7fa6d1ddf1f04c00ee0a1e5 Mon Sep 17 00:00:00 2001 From: Kaustav Majumder Date: Mon, 11 Mar 2024 11:33:17 +0530 Subject: [PATCH] bundle: added prometheus operator dependencies Signed-off-by: Kaustav Majumder --- .gitignore | 1 + Makefile | 7 +++++++ ...df-operator-manager-config_v1_configmap.yaml | 6 ++++++ .../odf-operator.clusterserviceversion.yaml | 2 +- bundle/metadata/dependencies.yaml | 4 ++++ catalog/index.yaml | 11 +++++++++++ config/manager/manager.env | 6 ++++++ controllers/defaults.go | 14 ++++++++++++++ controllers/subscriptions.go | 17 ++++++++++++++++- hack/make-bundle-vars.mk | 13 +++++++++++++ 10 files changed, 79 insertions(+), 2 deletions(-) diff --git a/.gitignore b/.gitignore index e71fa3387..b5b5c7ecc 100644 --- a/.gitignore +++ b/.gitignore @@ -31,3 +31,4 @@ catalog/noobaa.yaml catalog/ocs.yaml catalog/odf.yaml catalog/rook.yaml +catalog/prometheus.yaml diff --git a/Makefile b/Makefile index a32071cb4..a509988cd 100644 --- a/Makefile +++ b/Makefile @@ -94,6 +94,12 @@ ROOK_SUBSCRIPTION_CHANNEL=$(ROOK_SUBSCRIPTION_CHANNEL) ROOK_SUBSCRIPTION_STARTINGCSV=$(ROOK_SUBSCRIPTION_STARTINGCSV) ROOK_SUBSCRIPTION_CATALOGSOURCE=$(ROOK_SUBSCRIPTION_CATALOGSOURCE) ROOK_SUBSCRIPTION_CATALOGSOURCE_NAMESPACE=$(ROOK_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 @@ -175,6 +181,7 @@ catalog: opm ## Generate catalog manifests and then validate generated files. $(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 $(ROOK_BUNDLE_IMG) $(OPM_RENDER_OPTS) > catalog/rook.yaml + $(OPM) render --output=yaml $(PROMETHEUS_BUNDLE_IMG) $(OPM_RENDER_OPTS) > catalog/prometheus.yaml $(OPM) validate catalog .PHONY: catalog-build diff --git a/bundle/manifests/odf-operator-manager-config_v1_configmap.yaml b/bundle/manifests/odf-operator-manager-config_v1_configmap.yaml index 83b23904e..63f68086d 100644 --- a/bundle/manifests/odf-operator-manager-config_v1_configmap.yaml +++ b/bundle/manifests/odf-operator-manager-config_v1_configmap.yaml @@ -24,6 +24,12 @@ data: OCS_SUBSCRIPTION_NAME: ocs-operator OCS_SUBSCRIPTION_PACKAGE: ocs-operator OCS_SUBSCRIPTION_STARTINGCSV: ocs-operator.v4.15.0 + PROMETHEUS_SUBSCRIPTION_CATALOGSOURCE: odf-catalogsource + PROMETHEUS_SUBSCRIPTION_CATALOGSOURCE_NAMESPACE: openshift-marketplace + PROMETHEUS_SUBSCRIPTION_CHANNEL: beta + PROMETHEUS_SUBSCRIPTION_NAME: odf-prometheus-operator + PROMETHEUS_SUBSCRIPTION_PACKAGE: odf-prometheus-operator + PROMETHEUS_SUBSCRIPTION_STARTINGCSV: odf-prometheus-operator.v4.10.0 ROOK_SUBSCRIPTION_CATALOGSOURCE: odf-catalogsource ROOK_SUBSCRIPTION_CATALOGSOURCE_NAMESPACE: openshift-marketplace ROOK_SUBSCRIPTION_CHANNEL: alpha diff --git a/bundle/manifests/odf-operator.clusterserviceversion.yaml b/bundle/manifests/odf-operator.clusterserviceversion.yaml index 649f53b5c..84db46e52 100644 --- a/bundle/manifests/odf-operator.clusterserviceversion.yaml +++ b/bundle/manifests/odf-operator.clusterserviceversion.yaml @@ -35,7 +35,7 @@ metadata: categories: Storage console.openshift.io/plugins: '["odf-console"]' containerImage: quay.io/ocs-dev/odf-operator:latest - createdAt: "2024-03-13T06:42:11Z" + createdAt: "2024-03-21T13:04:01Z" description: OpenShift Data Foundation provides a common control plane for storage solutions on OpenShift Container Platform. features.operators.openshift.io/token-auth-aws: "true" diff --git a/bundle/metadata/dependencies.yaml b/bundle/metadata/dependencies.yaml index fcc70820a..6fc6ac864 100644 --- a/bundle/metadata/dependencies.yaml +++ b/bundle/metadata/dependencies.yaml @@ -15,3 +15,7 @@ dependencies: value: packageName: csi-addons version: "0.7.0" +- type: olm.package + value: + packageName: odf-prometheus-operator + version: "4.10.0" diff --git a/catalog/index.yaml b/catalog/index.yaml index 60a4722c2..ce8ef9530 100644 --- a/catalog/index.yaml +++ b/catalog/index.yaml @@ -63,3 +63,14 @@ package: rook-ceph-operator name: alpha entries: - name: rook-ceph-operator.v4.15.0 + +--- +defaultChannel: beta +name: odf-prometheus-operator +schema: olm.package +--- +schema: olm.channel +package: odf-prometheus-operator +name: beta +entries: + - name: odf-prometheus-operator.v4.10.0 diff --git a/config/manager/manager.env b/config/manager/manager.env index cc4de8a44..687e32d13 100644 --- a/config/manager/manager.env +++ b/config/manager/manager.env @@ -28,3 +28,9 @@ ROOK_SUBSCRIPTION_CHANNEL=alpha ROOK_SUBSCRIPTION_STARTINGCSV=rook-ceph-operator.v4.15.0 ROOK_SUBSCRIPTION_CATALOGSOURCE=odf-catalogsource ROOK_SUBSCRIPTION_CATALOGSOURCE_NAMESPACE=openshift-marketplace +PROMETHEUS_SUBSCRIPTION_NAME=odf-prometheus-operator +PROMETHEUS_SUBSCRIPTION_PACKAGE=odf-prometheus-operator +PROMETHEUS_SUBSCRIPTION_CHANNEL=beta +PROMETHEUS_SUBSCRIPTION_STARTINGCSV=odf-prometheus-operator.v4.10.0 +PROMETHEUS_SUBSCRIPTION_CATALOGSOURCE=odf-catalogsource +PROMETHEUS_SUBSCRIPTION_CATALOGSOURCE_NAMESPACE=openshift-marketplace diff --git a/controllers/defaults.go b/controllers/defaults.go index 32d2cb704..90821b2c2 100644 --- a/controllers/defaults.go +++ b/controllers/defaults.go @@ -58,6 +58,13 @@ var ( "ROOK_SUBSCRIPTION_STARTINGCSV": "rook-ceph-operator.v4.15.0", "ROOK_SUBSCRIPTION_CATALOGSOURCE": "odf-catalogsource", "ROOK_SUBSCRIPTION_CATALOGSOURCE_NAMESPACE": "openshift-marketplace", + + "PROMETHEUS_SUBSCRIPTION_NAME": "odf-prometheus-operator", + "PROMETHEUS_SUBSCRIPTION_PACKAGE": "odf-prometheus-operator", + "PROMETHEUS_SUBSCRIPTION_CHANNEL": "beta", + "PROMETHEUS_SUBSCRIPTION_STARTINGCSV": "prometheus-operator.v4.10.0", + "PROMETHEUS_SUBSCRIPTION_CATALOGSOURCE": "odf-catalogsource", + "PROMETHEUS_SUBSCRIPTION_CATALOGSOURCE_NAMESPACE": "openshift-marketplace", } OperatorNamespace = GetEnvOrDefault("OPERATOR_NAMESPACE") @@ -96,6 +103,13 @@ var ( RookSubscriptionStartingCSV = GetEnvOrDefault("ROOK_SUBSCRIPTION_STARTINGCSV") RookSubscriptionCatalogSource = GetEnvOrDefault("ROOK_SUBSCRIPTION_CATALOGSOURCE") RookSubscriptionCatalogSourceNamespace = GetEnvOrDefault("ROOK_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 c0e230b9a..08b9b594b 100644 --- a/controllers/subscriptions.go +++ b/controllers/subscriptions.go @@ -400,7 +400,22 @@ func GetStorageClusterSubscriptions() []*operatorv1alpha1.Subscription { }, } - return []*operatorv1alpha1.Subscription{ocsSubscription, rookSubscription, noobaaSubscription, 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{ocsSubscription, rookSubscription, noobaaSubscription, csiAddonsSubscription, prometheusSubscription} } // GetFlashSystemClusterSubscription return subscription for FlashSystemCluster diff --git a/hack/make-bundle-vars.mk b/hack/make-bundle-vars.mk index 62e653828..f8724071d 100644 --- a/hack/make-bundle-vars.mk +++ b/hack/make-bundle-vars.mk @@ -102,6 +102,13 @@ ROOK_BUNDLE_IMG_TAG ?= v4.15.0 ROOK_BUNDLE_IMG_LOCATION ?= quay.io/ocs-dev ROOK_BUNDLE_IMG ?= $(ROOK_BUNDLE_IMG_LOCATION)/$(ROOK_BUNDLE_IMG_NAME):$(ROOK_BUNDLE_IMG_TAG) +# To be changed when odf-prometheus-operator bundle exists +PROMETHEUS_BUNDLE_NAME ?= odf-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) $(ROOK_BUNDLE_IMG) @@ -151,6 +158,12 @@ ROOK_SUBSCRIPTION_STARTINGCSV ?= $(ROOK_BUNDLE_NAME).$(ROOK_BUNDLE_IMG_TAG) ROOK_SUBSCRIPTION_CATALOGSOURCE ?= $(OPERATOR_CATALOGSOURCE) ROOK_SUBSCRIPTION_CATALOGSOURCE_NAMESPACE ?= $(OPERATOR_CATALOGSOURCE_NAMESPACE) +PROMETHEUS_SUBSCRIPTION_NAME ?= $(PROMETHEUS_BUNDLE_NAME) +PROMETHEUS_SUBSCRIPTION_PACKAGE ?= $(PROMETHEUS_BUNDLE_NAME) +PROMETHEUS_SUBSCRIPTION_CHANNEL ?= beta +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