fix(#941): support PagerDuty incident lookup for HCP clusters - #942
fix(#941): support PagerDuty incident lookup for HCP clusters#942fullsend-ai-coder[bot] wants to merge 1 commit into
Conversation
HCP clusters use region-based PagerDuty services rather than per-cluster services keyed by DNS base domain. This caused osdctl cluster context and org context to return zero PD incidents for HCP clusters. For HCP clusters, use the cluster's region ID to query PD services and filter incidents by matching cluster ID in the first trigger log entry's EventDetails. Classic clusters continue to use the existing DNS-based lookup unchanged. Changes: - pkg/provider/pagerduty: add WithClusterID builder method and incidentMatchesCluster filter that checks EventDetails for cluster_id when clusterID is set on the client - cmd/cluster/context: detect HCP clusters in setup() to use region-based PD service query and cluster ID filtering - cmd/org/context: extend NewPDClient to accept clusterID, detect HCP clusters in FetchContext to use region-based lookup with cluster ID filtering Note: golangci-lint was not available in the sandbox. go vet and gofmt passed on all changed packages. Closes #941
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: fullsend-ai-coder[bot] The full list of commands accepted by this bot can be found here. DetailsNeeds approval from an approver in each of these files:Approvers can indicate their approval by writing |
|
Hi @fullsend-ai-coder[bot]. Thanks for your PR. I'm waiting for a openshift member to verify that this patch is reasonable to test. If it is, they should reply with Regular contributors should join the org to skip this step. Once the patch is verified, the new status will be reflected by the I understand the commands that are listed here. DetailsInstructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. |
|
/ok-to-test |
|
@fullsend-ai-coder[bot]: all tests passed! Full PR test history. Your PR dashboard. DetailsInstructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. I understand the commands that are listed here. |
Summary
osdctl cluster contextandosdctl org contextcommandsEventDetailsApproach
PagerDuty provider (
pkg/provider/pagerduty):WithClusterID()builder method on the PD clientclusterIDis set,GetFiringAlertsForClusterincludesfirst_trigger_log_entriesin the PD API request and filters incidents by checkingEventDetailsfor a matching cluster ID (supportscluster_id,clusterID, andcluster-idkey names)clusterIDis empty (classic clusters), behavior is unchangedCluster context (
cmd/cluster/context.go):setup(), detects HCP clusters viacluster.Hypershift().Enabled()and uses the region ID instead of DNS base domain for the PD service querygenerateContextData(), passes the cluster ID to the PD client for HCP clustersOrg context (
cmd/org/context.go):NewPDClientfunction signature to accept bothbaseDomainandclusterIDFetchContext, detects HCP clusters and passes region + cluster ID for filteringTesting
incidentMatchesClustercovering all key name variants, non-matching, nil EventDetails, and missing key scenariosGetFiringAlertsForClusterwith cluster ID filtering: matching, non-matching, alternate keys, and classic (empty clusterID) behaviorNewPDClientsignature in org contextCloses #941
Post-script verification
agent/941-hcp-pagerduty-incidents)13f62d5fbd5f130e861aa956a4709499d18144e9..HEAD)