Unverified Commit ad865023 authored by Sebastian Malton's avatar Sebastian Malton Committed by GitHub
Browse files

Fix KubernetesClusters overriding entity names too often (#3524)

Signed-off-by: default avatarSebastian Malton <sebastian@malton.name>
parent e43961ec
master api-manager-claenup asdasd better-release-script bug/port-forward-missing build-flatpak bundled-extensions-update catalog-entity-detail-registry cleanup-pod-details-container consolidate-running-of-setups-on-application-start dependabot/npm_and_yarn/react-select-5.3.2 dependabot/npm_and_yarn/react-window-1.8.7 dependabot/npm_and_yarn/types/node-14.18.16 dependabot/npm_and_yarn/types/webpack-env-1.16.4 di-stores docs/api-all-exported enhancement-node-vertical-metric-bars enhancement/group-app-preferences-by-extension entity-settings extension-auto-update extension-dir extension-discovery-changes extension-startup extensions/lens-version-check feat/add-bg-to-cluster-status feat/add-tests-for-main-extension-api-and-catalog-entity-registry feat/new-api feature/auto-update feature/context-providers feature/kube-api-manager feature/navigate-back-ui-button fix-change-os-theme-crash fix-lint-error fix-linter-errors fix-optimise-update-events-from-buffer fix-reload-list-items-on-mount fix-remove-watch-flush-headers fix-reseting-select-value fix-resource-applier fix/allown-entity-id fix/consistent-inputs fix/log-store-loading fix/ns-selector-performance-issue fix/pod-logs-storage fix/rewatch-if-resume fix/search_input_autofocus front-end-routes-ocp front-end-routes-ocp-2 front-end-routes-ocp-3 helm-repo-manager helm-repo-manager-removal helm-routes issue-1909 issue-3276 issue-3374 issue-3498 issue-3797 issue-3896 issue-4633 issue-4766 issue-4829 issue-4997 issue-5141 issue-5165 issue-5173 issue-5177 issue-5238 more-places-to-check-for-updates port-forward-pod-deleted prometheus/victoria-metrics-single refactor-settings-layout-styles release/v5.2 release/v5.2.4 release/v5.2.7-beta.0 release/v5.3 release/v5.4 remove-unused-telemetry show-extension-preferences-in-separate-page single-logger squashed-update-injectable test/remove-sentry testing/issue-4314 testing/virtual-select top-bar-registry turn-on-strict ui-table-empty-state-lines update-bundled-extensions update-electon-builder-to-3-0-8 validate-cluster-model verify-quit-events websocket-catalog-sync welcome-banners-rounded-corners welcome-menu-registry v5.5.0-beta.0 v5.4.6 v5.4.5 v5.4.4 v5.4.3 v5.4.2 v5.4.1 v5.4.0 v5.4.0-beta.5 v5.4.0-beta.4 v5.4.0-beta.3 v5.4.0-beta.2 v5.4.0-beta.1 v5.4.0-beta.0 v5.4.0-alpha.1 v5.4.0-alpha.0 v5.3.4 v5.3.3 v5.3.2 v5.3.1 v5.3.0 v5.3.0-beta.4 v5.3.0-beta.3 v5.3.0-beta.2 v5.3.0-beta.1 v5.3.0-beta.0 v5.3.0-alpha.11 v5.3.0-alpha.10 v5.3.0-alpha.9 v5.3.0-alpha.8 v5.3.0-alpha.7 v5.3.0-alpha.6 v5.3.0-alpha.5 v5.3.0-alpha.4 v5.3.0-alpha.3 v5.3.0-alpha.2 v5.3.0-alpha.1 v5.3.0-alpha.0 v5.2.7 v5.2.6 v5.2.6-beta.1 v5.2.6-beta.0 v5.2.5 v5.2.4 v5.2.3 v5.2.2 v5.2.1 v5.2.0 v5.2.0-rc.1 v5.2.0-beta.4 v5.2.0-beta.3 v5.2.0-beta.2 v5.2.0-beta.1
No related merge requests found
Showing with 14 additions and 5 deletions
+14 -5
......@@ -111,7 +111,15 @@ export class ClusterManager extends Singleton {
};
entity.metadata.distro = cluster.distribution;
entity.metadata.kubeVersion = cluster.version;
entity.metadata.name = cluster.name;
if (cluster.preferences?.clusterName) {
/**
* Only set the name if the it is overriden in preferences. If it isn't
* set then the name of the entity has been explicitly set by its source
*/
entity.metadata.name = cluster.preferences.clusterName;
}
entity.spec.metrics ||= { source: "local" };
if (entity.spec.metrics.source === "local") {
......@@ -164,14 +172,15 @@ export class ClusterManager extends Singleton {
if (!cluster) {
try {
/**
* Add the bare minimum of data to ClusterStore. And especially no
* preferences, as those might be configured by the entity's source
*/
this.store.addCluster({
id: entity.metadata.uid,
preferences: {
clusterName: entity.metadata.name
},
kubeConfigPath: entity.spec.kubeconfigPath,
contextName: entity.spec.kubeconfigContext,
accessibleNamespaces: entity.spec.accessibleNamespaces
accessibleNamespaces: entity.spec.accessibleNamespaces ?? [],
});
} catch (error) {
if (error.code === "ENOENT" && error.path === entity.spec.kubeconfigPath) {
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment