guard around kube actions for endpoint inspect (#8430)

pull/8454/head
Matt Hook 2023-02-07 23:13:52 +13:00 committed by GitHub
parent 2dddc1c6b9
commit e2168d21c7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 17 additions and 15 deletions

View File

@ -52,8 +52,9 @@ func (handler *Handler) endpointInspect(w http.ResponseWriter, r *http.Request)
} }
} }
if endpointutils.IsKubernetesEndpoint(endpoint) {
isServerMetricsDetected := endpoint.Kubernetes.Flags.IsServerMetricsDetected isServerMetricsDetected := endpoint.Kubernetes.Flags.IsServerMetricsDetected
if endpointutils.IsKubernetesEndpoint(endpoint) && !isServerMetricsDetected && handler.K8sClientFactory != nil { if !isServerMetricsDetected && handler.K8sClientFactory != nil {
endpointutils.InitialMetricsDetection( endpointutils.InitialMetricsDetection(
endpoint, endpoint,
handler.DataStore.Endpoint(), handler.DataStore.Endpoint(),
@ -69,6 +70,7 @@ func (handler *Handler) endpointInspect(w http.ResponseWriter, r *http.Request)
handler.K8sClientFactory, handler.K8sClientFactory,
) )
} }
}
return response.JSON(w, endpoint) return response.JSON(w, endpoint)
} }