Skip to content

Commit

Permalink
chore: remove api /clusterconfigurations?name=ks-installer from server
Browse files Browse the repository at this point in the history
Signed-off-by: donniean <[email protected]>
  • Loading branch information
donniean committed Sep 25, 2024
1 parent 1c415d6 commit facab63
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 29 deletions.
11 changes: 4 additions & 7 deletions server/controllers/view.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ const {
getK8sRuntime,
getOAuthInfo,
getClusterRole,
getInstallerSpec,
getTheme,
} = require('../services/session');

Expand Down Expand Up @@ -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,
Expand All @@ -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,
Expand Down
22 changes: 0 additions & 22 deletions server/services/session.js
Original file line number Diff line number Diff line change
Expand Up @@ -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({
Expand Down Expand Up @@ -540,6 +519,5 @@ module.exports = {
getK8sRuntime,
createUser,
getClusterRole,
getInstallerSpec,
getTheme,
};

0 comments on commit facab63

Please sign in to comment.