Skip to content

Commit

Permalink
fix: return the correct loki service names (#521)
Browse files Browse the repository at this point in the history
Signed-off-by: Shweta Padubidri <spadubid@redhat.com>
  • Loading branch information
shwetaap authored Jun 21, 2024
1 parent 204ef6f commit 351ead5
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 8 deletions.
4 changes: 2 additions & 2 deletions pkg/controllers/uiplugin/components.go
Original file line number Diff line number Diff line change
Expand Up @@ -444,10 +444,10 @@ func newKorrel8rConfigMap(name string, namespace string, info UIPluginInfo) (*co
korrel8rData := map[string]string{"Metric": "thanos-querier", "MetricAlert": "alertmanager-main", "Log": "logging-loki-gateway-http", "Netflow": "loki-gateway-http", "MonitoringNs": "openshift-monitoring", "LoggingNs": OpenshiftLoggingNs, "NetobservNs": OpenshiftNetobservNs}

if info.LokiServiceNames[OpenshiftLoggingNs] != "" {
korrel8rData["LoggingNs"] = info.LokiServiceNames[OpenshiftLoggingNs]
korrel8rData["Log"] = info.LokiServiceNames[OpenshiftLoggingNs]
}
if info.LokiServiceNames[OpenshiftNetobservNs] != "" {
korrel8rData["NetobservNs"] = info.LokiServiceNames[OpenshiftNetobservNs]
korrel8rData["Netflow"] = info.LokiServiceNames[OpenshiftNetobservNs]
}

var korrel8rConfigYAMLTmpl = template.Must(template.ParseFS(korrel8rConfigYAMLTmplFile, "config/korrel8r.yaml"))
Expand Down
8 changes: 2 additions & 6 deletions pkg/controllers/uiplugin/troubleshooting_panel.go
Original file line number Diff line number Diff line change
Expand Up @@ -101,14 +101,10 @@ func getLokiServiceName(ctx context.Context, k client.Client, ns string) (string
}

// Accumulate services that contain "gateway" in their names
var gatewayServices []corev1.Service
for _, service := range serviceList.Items {
if strings.Contains(service.Name, "gateway") {
gatewayServices = append(gatewayServices, service)
if strings.Contains(service.Name, "gateway-http") && service.Labels["app.kubernetes.io/component"] == "lokistack-gateway" {
return service.Name, nil
}
}
if len(gatewayServices) > 0 {
return gatewayServices[0].Name, nil
}
return "", nil
}

0 comments on commit 351ead5

Please sign in to comment.