Skip to content

Commit

Permalink
only create namespace if catalogSources are listed
Browse files Browse the repository at this point in the history
  • Loading branch information
loganmc10 committed Jun 26, 2023
1 parent a62fc9e commit 0fba38b
Showing 1 changed file with 13 additions and 11 deletions.
24 changes: 13 additions & 11 deletions internal/catalog/reconcile.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,17 +23,19 @@ func Reconcile(ctx context.Context, c client.Client, scheme *runtime.Scheme, rel
return err
}

marketplaceNamespace := &corev1.Namespace{ObjectMeta: metav1.ObjectMeta{Name: marketplaceNamespaceName}}
op, err := controllerutil.CreateOrPatch(ctx, c, marketplaceNamespace, func() error {
marketplaceNamespace.Annotations["workload.openshift.io/allowed"] = "management"
marketplaceNamespace.Labels["openshift.io/cluster-monitoring"] = "true"
return nil
})
if err != nil {
return err
}
if op != controllerutil.OperationResultNone {
logger.Info("Created Marketplace namespace", "Namespace", marketplaceNamespaceName, "OperationResult", op)
if relocation.Spec.CatalogSources != nil {
marketplaceNamespace := &corev1.Namespace{ObjectMeta: metav1.ObjectMeta{Name: marketplaceNamespaceName}}
op, err := controllerutil.CreateOrPatch(ctx, c, marketplaceNamespace, func() error {
marketplaceNamespace.Annotations["workload.openshift.io/allowed"] = "management"
marketplaceNamespace.Labels["openshift.io/cluster-monitoring"] = "true"
return nil
})
if err != nil {
return err
}
if op != controllerutil.OperationResultNone {
logger.Info("Created Marketplace namespace", "Namespace", marketplaceNamespaceName, "OperationResult", op)
}
}

for _, v := range relocation.Spec.CatalogSources {
Expand Down

0 comments on commit 0fba38b

Please sign in to comment.