From facab63f3d62a9b6c57fe9d30017222e9a6535b5 Mon Sep 17 00:00:00 2001 From: donniean Date: Wed, 25 Sep 2024 10:38:19 +0800 Subject: [PATCH] chore: remove api /clusterconfigurations?name=ks-installer from server Signed-off-by: donniean --- server/controllers/view.js | 11 ++++------- server/services/session.js | 22 ---------------------- 2 files changed, 4 insertions(+), 29 deletions(-) diff --git a/server/controllers/view.js b/server/controllers/view.js index 0a4eed48031..fb7729d0ac2 100644 --- a/server/controllers/view.js +++ b/server/controllers/view.js @@ -10,7 +10,6 @@ const { getK8sRuntime, getOAuthInfo, getClusterRole, - getInstallerSpec, getTheme, } = require('../services/session'); @@ -181,17 +180,16 @@ const renderView = async ctx => { const clusterRole = await getClusterRole(ctx); const ksConfig = await getKSConfig(ctx); - const [user, runtime, installer, installedExtensions] = await Promise.all([ + const [user, runtime, installedExtensions] = await Promise.all([ getCurrentUser(ctx, clusterRole, ksConfig.multicluster), getK8sRuntime(ctx), - getInstallerSpec(ctx), getInstalledExtensions(ctx), ]); await renderIndex(ctx, { ksConfig: { ...ksConfig, - metrics_server: get(installer, 'metrics_server.enabled', false), + metrics_server: false, }, user, runtime, @@ -212,16 +210,15 @@ const renderV3View = async ctx => { const clusterRole = await getClusterRole(ctx); const ksConfig = await getKSConfig(ctx); - const [user, runtime, installer] = await Promise.all([ + const [user, runtime] = await Promise.all([ getCurrentUser(ctx, clusterRole, ksConfig.multicluster), getK8sRuntime(ctx), - getInstallerSpec(ctx), ]); await renderV3Index(ctx, { ksConfig: { ...ksConfig, - metrics_server: get(installer, 'metrics_server.enabled', false), + metrics_server: false, }, user, runtime, diff --git a/server/services/session.js b/server/services/session.js index 5d68afcae87..6695ca55351 100644 --- a/server/services/session.js +++ b/server/services/session.js @@ -485,27 +485,6 @@ const createUser = (params, token) => { }); }; -const getInstallerSpec = async ctx => { - const token = ctx.cookies.get('token'); - if (!token) { - return {}; - } - - try { - const result = await sendGatewayRequest({ - method: 'GET', - url: `/apis/installer.kubesphere.io/v1alpha1/clusterconfigurations?name=ks-installer`, - token, - }); - - return result.items[0].spec; - } catch (error) { - console.error(error); - } - - return {}; -}; - const getTheme = async () => { try { const theme = await sendGatewayRequest({ @@ -540,6 +519,5 @@ module.exports = { getK8sRuntime, createUser, getClusterRole, - getInstallerSpec, getTheme, };