Skip to content

Commit

Permalink
controllers: add logic to create a odf-dependencies subscription
Browse files Browse the repository at this point in the history
Signed-off-by: Nitin Goyal <nigoyal@redhat.com>
  • Loading branch information
iamniting committed Nov 14, 2024
1 parent 9119c1e commit 87ac048
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 2 deletions.
14 changes: 14 additions & 0 deletions controllers/defaults.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,13 @@ var (
DefaultValMap = map[string]string{
"OPERATOR_NAMESPACE": "openshift-storage",

"ODF_DEPS_SUBSCRIPTION_NAME": "odf-dependencies",
"ODF_DEPS_SUBSCRIPTION_PACKAGE": "odf-dependencies",
"ODF_DEPS_SUBSCRIPTION_CHANNEL": "alpha",
"ODF_DEPS_SUBSCRIPTION_STARTINGCSV": "odf-dependencies.v4.18.0",
"ODF_DEPS_SUBSCRIPTION_CATALOGSOURCE": "odf-catalogsource",
"ODF_DEPS_SUBSCRIPTION_CATALOGSOURCE_NAMESPACE": "openshift-marketplace",

"NOOBAA_SUBSCRIPTION_NAME": "noobaa-operator",
"NOOBAA_SUBSCRIPTION_PACKAGE": "noobaa-operator",
"NOOBAA_SUBSCRIPTION_CHANNEL": "alpha",
Expand Down Expand Up @@ -90,6 +97,13 @@ var (

OperatorNamespace = GetEnvOrDefault("OPERATOR_NAMESPACE")

OdfDepsSubscriptionName = GetEnvOrDefault("ODF_DEPS_SUBSCRIPTION_NAME")
OdfDepsSubscriptionPackage = GetEnvOrDefault("ODF_DEPS_SUBSCRIPTION_PACKAGE")
OdfDepsSubscriptionChannel = GetEnvOrDefault("ODF_DEPS_SUBSCRIPTION_CHANNEL")
OdfDepsSubscriptionStartingCSV = GetEnvOrDefault("ODF_DEPS_SUBSCRIPTION_STARTINGCSV")
OdfDepsSubscriptionCatalogSource = GetEnvOrDefault("ODF_DEPS_SUBSCRIPTION_CATALOGSOURCE")
OdfDepsSubscriptionCatalogSourceNamespace = GetEnvOrDefault("ODF_DEPS_SUBSCRIPTION_CATALOGSOURCE_NAMESPACE")

OcsSubscriptionName = GetEnvOrDefault("OCS_SUBSCRIPTION_NAME")
OcsSubscriptionPackage = GetEnvOrDefault("OCS_SUBSCRIPTION_PACKAGE")
OcsSubscriptionChannel = GetEnvOrDefault("OCS_SUBSCRIPTION_CHANNEL")
Expand Down
20 changes: 18 additions & 2 deletions controllers/subscriptions.go
Original file line number Diff line number Diff line change
Expand Up @@ -262,7 +262,7 @@ func GetVendorCsvNames(cli client.Client, kind odfv1alpha1.StorageKind) ([]strin
if kind == VendorFlashSystemCluster() {
csvNames = []string{IbmSubscriptionStartingCSV}
} else if kind == VendorStorageCluster() {
csvNames = []string{OcsSubscriptionStartingCSV, RookSubscriptionStartingCSV, NoobaaSubscriptionStartingCSV,
csvNames = []string{OdfDepsSubscriptionStartingCSV, OcsSubscriptionStartingCSV, RookSubscriptionStartingCSV, NoobaaSubscriptionStartingCSV,
PrometheusSubscriptionStartingCSV, RecipeSubscriptionStartingCSV}

isProvider, err = isProviderMode(cli)
Expand Down Expand Up @@ -432,6 +432,22 @@ func GetSubscriptions(k odfv1alpha1.StorageKind) []*operatorv1alpha1.Subscriptio

// GetStorageClusterSubscription return subscription for StorageCluster
func GetStorageClusterSubscriptions() []*operatorv1alpha1.Subscription {

odfDepsSubscription := &operatorv1alpha1.Subscription{
ObjectMeta: metav1.ObjectMeta{
Name: OdfDepsSubscriptionName,
Namespace: OperatorNamespace,
},
Spec: &operatorv1alpha1.SubscriptionSpec{
CatalogSource: OdfDepsSubscriptionCatalogSource,
CatalogSourceNamespace: OdfDepsSubscriptionCatalogSourceNamespace,
Package: OdfDepsSubscriptionPackage,
Channel: OdfDepsSubscriptionChannel,
StartingCSV: OdfDepsSubscriptionStartingCSV,
InstallPlanApproval: operatorv1alpha1.ApprovalAutomatic,
},
}

noobaaSubscription := &operatorv1alpha1.Subscription{
ObjectMeta: metav1.ObjectMeta{
Name: NoobaaSubscriptionName,
Expand Down Expand Up @@ -584,7 +600,7 @@ func GetStorageClusterSubscriptions() []*operatorv1alpha1.Subscription {
},
}

return []*operatorv1alpha1.Subscription{ocsSubscription, rookSubscription, noobaaSubscription,
return []*operatorv1alpha1.Subscription{odfDepsSubscription, ocsSubscription, rookSubscription, noobaaSubscription,
csiAddonsSubscription, cephCsiSubscription, ocsClientSubscription, prometheusSubscription, recipeSubscription}
}

Expand Down

0 comments on commit 87ac048

Please sign in to comment.