Skip to content

Commit

Permalink
remove obs add on for local-cluster
Browse files Browse the repository at this point in the history
Signed-off-by: Coleen Iona Quadros <[email protected]>
  • Loading branch information
coleenquadros committed Feb 21, 2024
1 parent a1cb5ef commit 8c84f5c
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -574,6 +574,8 @@ func createUpdateResourcesForHubMetricsCollection(c client.Client, manifests []w
func deleteHubMetricsCollectionDeployments(c client.Client) error {
for _, manifest := range hubManifestCopy {
obj := manifest.RawExtension.Object.(client.Object)
log.Info("Coleen Deleting resource", "kind", obj.GetObjectKind().GroupVersionKind().Kind, "name", obj.GetName(), "namespace", obj.GetNamespace())

err := c.Delete(context.TODO(), obj)
if err != nil && !k8serrors.IsNotFound(err) {
log.Error(err, "Failed to delete resource", "kind", obj.GetObjectKind().GroupVersionKind().Kind)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -182,15 +182,15 @@ func (r *PlacementRuleReconciler) Reconcile(ctx context.Context, req ctrl.Reques
}

if installMetricsWithoutAddon {

Check failure on line 184 in operators/multiclusterobservability/controllers/placementrule/placementrule_controller.go

View workflow job for this annotation

GitHub Actions / Formatters + Linters (Static Analysis) for Go

SA9003: empty branch (staticcheck)
obsAddonList.Items = append(obsAddonList.Items, mcov1beta1.ObservabilityAddon{
ObjectMeta: metav1.ObjectMeta{
Name: obsAddonName,
Namespace: config.GetDefaultNamespace(),
Labels: map[string]string{
ownerLabelKey: ownerLabelValue,
},
},
})
//obsAddonList.Items = append(obsAddonList.Items, mcov1beta1.ObservabilityAddon{
// ObjectMeta: metav1.ObjectMeta{
// Name: obsAddonName,
// Namespace: config.GetDefaultNamespace(),
// Labels: map[string]string{
// ownerLabelKey: ownerLabelValue,
// },
// },
//})
}

if !deleteAll {
Expand Down Expand Up @@ -491,13 +491,17 @@ func createManagedClusterRes(
hubInfo *corev1.Secret,
installProm bool,
) error {
err := createObsAddon(c, namespace)
if err != nil {
log.Error(err, "Failed to create observabilityaddon")
return err
//ACM-8509: Special case for hub/local cluster metrics collection
// Do not create ObservabilityAddon for local-cluster
if namespace == config.GetDefaultNamespace() {
err := createObsAddon(c, namespace)
if err != nil {
log.Error(err, "Failed to create observabilityaddon")
return err
}
}

err = createRolebindings(c, namespace, name)
err := createRolebindings(c, namespace, name)
if err != nil {
return err
}
Expand Down

0 comments on commit 8c84f5c

Please sign in to comment.