Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
Signed-off-by: Coleen Iona Quadros <[email protected]>
  • Loading branch information
coleenquadros committed Nov 11, 2024
1 parent 109d14c commit 932df51
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 43 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -123,25 +123,6 @@ func (r *PlacementRuleReconciler) Reconcile(ctx context.Context, req ctrl.Reques
return ctrl.Result{}, nil
}

// ACM 8509: Special case for hub/local cluster metrics collection
// We want to ensure that the local-cluster is always in the managedClusterList
// In the case when hubSelfManagement is enabled, we will delete it from the list and modify the object
// to cater to the use case of deploying in open-cluster-management-observability namespace
managedClusterList.Delete("local-cluster")
if _, ok := managedClusterList.Load("local-cluster"); !ok {
obj := &clusterv1.ManagedCluster{
ObjectMeta: metav1.ObjectMeta{
Name: "local-cluster",
Namespace: config.GetDefaultNamespace(),
Labels: map[string]string{
"openshiftVersion": "mimical",
},
},
}
installMetricsWithoutAddon = true
updateManagedClusterList(obj)
}

if !deleteAll && !mco.Spec.ObservabilityAddonSpec.EnableMetrics {
reqLogger.Info("EnableMetrics is set to false. Delete Observability addons")
deleteAll = true
Expand Down Expand Up @@ -181,7 +162,9 @@ func (r *PlacementRuleReconciler) Reconcile(ctx context.Context, req ctrl.Reques
return ctrl.Result{}, err
}

if !deleteAll && installMetricsWithoutAddon {
if !installMetricsWithoutAddon {
// Delete only once
installMetricsWithoutAddon = true
err = deleteObsAddon(r.Client, localClusterName)
if err != nil {
log.Error(err, "Failed to delete observabilityaddon")
Expand Down
23 changes: 0 additions & 23 deletions tests/pkg/utils/mco_oba.go
Original file line number Diff line number Diff line change
Expand Up @@ -95,29 +95,6 @@ func CheckAllOBAsEnabled(opt TestOptions) error {
return nil
}

func CheckAllOBADisabled(opt TestOptions) error {
clusters, err := ListManagedClusters(opt)
if err != nil {
return err
}
for _, cluster := range clusters {
// skip the check for local-cluster
if cluster == "local-cluster" {
klog.V(1).Infof("Skip OBA status for managedcluster: %v", cluster)
continue
}
err = CheckOBAStatus(opt, cluster, ManagedClusterAddOnDisabledMessage)
if err != nil {
return err
}
err = CheckManagedClusterAddonsStatus(opt, cluster, ManagedClusterAddOnDisabledMessage)
if err != nil {
return err
}
}
return nil
}

func CheckAllOBAsDeleted(opt TestOptions) error {
clusters, err := ListManagedClusters(opt)
if err != nil {
Expand Down

0 comments on commit 932df51

Please sign in to comment.