1
0
Fork 0
mirror of https://github.com/portainer/portainer.git synced 2025-08-10 08:15:25 +02:00

guard around kube actions for endpoint inspect

This commit is contained in:
Matt Hook 2023-02-01 14:44:52 +13:00
parent 2216d2cdd2
commit 59141ec37d

View file

@ -52,22 +52,24 @@ func (handler *Handler) endpointInspect(w http.ResponseWriter, r *http.Request)
}
}
isServerMetricsDetected := endpoint.Kubernetes.Flags.IsServerMetricsDetected
if endpointutils.IsKubernetesEndpoint(endpoint) && !isServerMetricsDetected && handler.K8sClientFactory != nil {
endpointutils.InitialMetricsDetection(
endpoint,
handler.DataStore.Endpoint(),
handler.K8sClientFactory,
)
}
if endpointutils.IsKubernetesEndpoint(endpoint) {
isServerMetricsDetected := endpoint.Kubernetes.Flags.IsServerMetricsDetected
if !isServerMetricsDetected && handler.K8sClientFactory != nil {
endpointutils.InitialMetricsDetection(
endpoint,
handler.DataStore.Endpoint(),
handler.K8sClientFactory,
)
}
isServerStorageDetected := endpoint.Kubernetes.Flags.IsServerStorageDetected
if !isServerStorageDetected && handler.K8sClientFactory != nil {
endpointutils.InitialStorageDetection(
endpoint,
handler.DataStore.Endpoint(),
handler.K8sClientFactory,
)
isServerStorageDetected := endpoint.Kubernetes.Flags.IsServerStorageDetected
if !isServerStorageDetected && handler.K8sClientFactory != nil {
endpointutils.InitialStorageDetection(
endpoint,
handler.DataStore.Endpoint(),
handler.K8sClientFactory,
)
}
}
return response.JSON(w, endpoint)