Hacktoberfest 2026: le issue che i maintainer hanno segnato per ottobre, aperte e adatte ai principianti. Sfoglia le issue Hacktoberfest

osdctl rhobs logs: incorrect Grafana URL for HCP clusters

Aperta
#932 1 commento 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 3 giorni

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
3/5
Tempo stimato
1-2 giorni
Idoneità per principianti
72/100
Tipo di issue
Bug
Chiarezza
Specificata chiaramente
Stato di attività
Tranquilla
Stack tecnologico
go
Ambito
cli, observability

Direzione di ricerca

Inizia in cmd/rhobs/logs_cmd.go leggendo populateRhobsFetchers e GetDefaultGrafanaLogsUrl, quindi riproduci il problema con osdctl rhobs logs -C --url. Verifica che l’URL generato utilizzi il namespace HCP di GetHCPNamespace e l’ExternalID del cluster di gestione; il lavoro è completato quando, aprendolo, vengono mostrati i log del control plane HCP.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

lifecycle/stale

Summary

osdctl rhobs logs -C <hcp-cluster-id> --url generates an incorrect Grafana URL for HCP (Hosted Control Plane) clusters. The URL shows no logs when opened in a browser.

Root Cause

When given an HCP cluster ID, the command:

  1. Correctly resolves the RHOBS cell by looking up the management cluster (MC)
  2. But incorrectly uses the HCP cluster's openshift_cluster_id (external UUID) as the Loki filter

HCP control-plane logs run in a namespace on the MC (e.g. ocm-production-<hcp-id>-...) and are indexed in RHOBS under the MC's openshift_cluster_id, not the HCP cluster's.

The generated query is:

{k8s_namespace_name="default"} | openshift_cluster_id = "<hcp-external-uuid>"

This returns no logs because:

  • k8s_namespace_name="default" is not where HCP control-plane logs live
  • openshift_cluster_id = "<hcp-external-uuid>" is the wrong cluster label for RHOBS HCP logs

Expected Behavior

For an HCP cluster, the URL should use:

  • Namespace: the HCP control-plane namespace on the MC, e.g. ocm-production-<hcp-id>-<suffix> (available via GetHCPNamespace)
  • openshift_cluster_id: the MC's external UUID (available via GetManagementCluster(...).ExternalID())

Working Loki query (confirmed by user investigation):

{k8s_namespace_name="ocm-production-<hcp-id>-<suffix>"} | openshift_cluster_id = "<mc-external-uuid>"

Steps to Reproduce

osdctl rhobs logs -C <hcp-cluster-id> --url

Open the generated URL — shows "No logs found".

Compare with:

osdctl rhobs logs -C <mc-cluster-id> --url

Then manually set the namespace to the HCP namespace — shows logs correctly.

Affected Code

cmd/rhobs/logs_cmd.go — the GetDefaultGrafanaLogsUrl() method and the namespace flag default value ("default").

When populateRhobsFetchers is called with an HCP cluster ID, it sets monitoredClusterId to the MC's internal ID (correct for RHOBS cell resolution) but leaves clusterExternalId as the HCP cluster's external UUID (wrong for the Loki query).

Fix

In populateRhobsFetchers (or in the logs URL generation path), when the cluster is an HCP cluster:

  1. Fetch the HCP namespace via utils.GetHCPNamespace(clusterId)
  2. Fetch the MC's external UUID via utils.GetManagementCluster(clusterId).ExternalID()
  3. Use these to build the correct Loki stream selector and filter

Note: osdctl cluster context has already been patched with this workaround separately.

Lingua principale
Go
Stelle
47
Fork
146
Merge medio
1g 21h
PR unite (30g)
26

Preparare l'ambiente

Questo progetto non fornisce container di sviluppo, Dockerfile né guida per i contributori, quindi l'ambiente è a tuo carico: parti dal suo README e consulta la nostra guida al primo contributo per i passaggi generali.

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di openshift/osdctl

Tutte le issue di openshift/osdctl

Issue simili

Altre issue su Go

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.