1
0
mirror of https://github.com/lensapp/lens.git synced 2025-05-20 05:10:56 +00:00

Fix impl of 'Fix metrics configuration via catalog'

Signed-off-by: Sebastian Malton <sebastian@malton.name>
This commit is contained in:
Sebastian Malton 2021-11-04 10:22:41 -04:00
parent 0e1df10488
commit a5841b049d

View File

@ -192,9 +192,20 @@ export class ClusterManager extends Singleton {
cluster.accessibleNamespaces = entity.spec.accessibleNamespaces;
}
if (entity.spec.metrics.source !== "local") {
cluster.preferences.prometheusProvider ||= { type: entity.spec.metrics?.prometheus?.type ?? "" };
cluster.preferences.prometheus = entity.spec.metrics.prometheus.address;
if (entity.spec.metrics) {
const { source, prometheus } = entity.spec.metrics;
if (source !== "local" && prometheus) {
const { type, address } = prometheus;
if (type) {
cluster.preferences.prometheusProvider = { type };
}
if (address) {
cluster.preferences.prometheus = address;
}
}
}
this.updateEntityFromCluster(cluster);