Skip to content

Commit

Permalink
Added prometheus operator dependencies
Browse files Browse the repository at this point in the history
Signed-off-by: Kaustav Majumder <[email protected]>
  • Loading branch information
Kaustav Majumder committed Mar 11, 2024
1 parent 2a65118 commit 7cf5c1f
Show file tree
Hide file tree
Showing 5 changed files with 55 additions and 2 deletions.
7 changes: 7 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -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
Expand Down
4 changes: 4 additions & 0 deletions bundle/metadata/dependencies.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,7 @@ dependencies:
value:
packageName: csi-addons
version: "0.7.0"
- type: olm.package
value:
packageName: prometheus-operator
version: "4.10.0"
14 changes: 14 additions & 0 deletions controllers/defaults.go
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down Expand Up @@ -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 (
Expand Down
17 changes: 16 additions & 1 deletion controllers/subscriptions.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
15 changes: 14 additions & 1 deletion hack/make-bundle-vars.mk
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 7cf5c1f

Please sign in to comment.