Skip to content

Commit

Permalink
test
Browse files Browse the repository at this point in the history
  • Loading branch information
philipgough committed Sep 6, 2024
1 parent 41774f2 commit 3ebbe7a
Show file tree
Hide file tree
Showing 3 changed files with 35 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -610,6 +610,31 @@ func remove(list []string, s string) []string {
return result
}

func enqueueForCMOConfigMap(obsR *ObservabilityAddonReconciler) handler.EventHandler {

Check failure on line 613 in operators/endpointmetrics/controllers/observabilityendpoint/observabilityaddon_controller.go

View workflow job for this annotation

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

func `enqueueForCMOConfigMap` is unused (unused)
return handler.EnqueueRequestsFromMapFunc(
func(ctx context.Context, a client.Object) []reconcile.Request {

obsList := &oav1beta1.ObservabilityAddonList{}
err := obsR.Client.List(ctx, obsList)
if err != nil {
log.Error(err, "Failed to list ObservabilityAddon")
return nil
}
log.Info("Enqueue for CMO Config ObservabilityAddonList", "items", len(obsList.Items))

var requests []reconcile.Request
for _, obs := range obsList.Items {
requests = append(requests, reconcile.Request{
NamespacedName: types.NamespacedName{
Name: obs.Name,
Namespace: obs.Namespace,
},
})
}
return requests
})
}

// resourcePriority returns the priority of the resource.
// This is used to order the resources to be created in the correct order.
func resourcePriority(resource *unstructured.Unstructured) int {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@
// Copyright Contributors to the Open Cluster Management project
// Licensed under the Apache License 2.0

//go:build integration

package observabilityendpoint

import (
Expand Down Expand Up @@ -100,6 +98,12 @@ alertmanager-router-ca: |
Data: nil,
StringData: map[string]string{hubAmAccessorSecretKey: "lol"},
},
&oav1beta1.ObservabilityAddon{
ObjectMeta: metav1.ObjectMeta{
Name: "observability-addon",
Namespace: namespace,
},
},
}
if err := createResources(k8sClient, resourcesDeps...); err != nil {
t.Fatalf("Failed to create resources: %v", err)
Expand Down
4 changes: 4 additions & 0 deletions operators/endpointmetrics/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,10 @@ func main() {
{FieldSelector: fmt.Sprintf("metadata.name==%s,metadata.namespace!=%s",
operatorconfig.AllowlistCustomConfigMapName, "open-cluster-management-observability")},
},
v1.SchemeGroupVersion.WithKind("ConfigMap"): {
{FieldSelector: fmt.Sprintf("metadata.name==%s,metadata.namespace==%s",
"cluster-monitoring-config", "openshift-monitoring")},
},
appsv1.SchemeGroupVersion.WithKind("Deployment"): {
{FieldSelector: namespaceSelector},
},
Expand Down

0 comments on commit 3ebbe7a

Please sign in to comment.