Skip to content

Commit

Permalink
more
Browse files Browse the repository at this point in the history
  • Loading branch information
Flaque committed Nov 20, 2024
1 parent dac3698 commit 9e19646
Showing 1 changed file with 18 additions and 1 deletion.
19 changes: 18 additions & 1 deletion src/lib/clusters/clusters.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@ import type { Command } from "commander";
import { apiClient } from "../../apiClient.ts";
import { logAndQuit } from "../../helpers/errors.ts";
import { decryptSecret, getKeys } from "./keys.tsx";
import { createKubeConfigString } from "./kubeconfig.ts";
import { Box, render, Text } from "ink";
import React from "react";

export function registerClusters(program: Command) {
const clusters = program
Expand Down Expand Up @@ -183,6 +186,20 @@ async function listClusterUsersAction({ returnJson, token }: { returnJson?: bool
continue;
}
const res = decryptSecret(item.encrypted_token, privateKey);
console.log(res);

const kubeconfig = createKubeConfigString({
cluster: {
name: item.cluster.name,
kubernetesApiUrl: item.cluster.kubernetes_api_url || "",
certificateAuthorityData: item.cluster.kubernetes_ca_cert || "",
namespace: item.cluster.kubernetes_namespace || "",
},
user: {
name: item.username || "",
token: res,
},
});

console.log(kubeconfig, "\n#--\n\n");
}
}

0 comments on commit 9e19646

Please sign in to comment.