Skip to content

Commit 6cb261b

Browse files
author
Max Jonas Werner
committed
UI: provide cluster namespace when fetching kbueconfig
When a cluster is created in a namespace that's different from the default one ("default") then downloading the kubeconfig failed because the UI didn't provide the cluster's namespace to the server. With this change, the namespace is provided as a query parameter.
1 parent aae28c5 commit 6cb261b

File tree

3 files changed

+4
-4
lines changed

3 files changed

+4
-4
lines changed

ui-cra/src/components/Clusters/ClusterDashboard.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ const ClusterDashboard = ({ clusterName }: Props) => {
5050
const history = useHistory();
5151

5252
const handleClick = () =>
53-
getKubeconfig(clusterName, `${clusterName}.kubeconfig`);
53+
getKubeconfig(clusterName, currentCluster?.namespace || "", `${clusterName}.kubeconfig`);
5454

5555
const info = [
5656
[

ui-cra/src/contexts/Clusters/Provider.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -61,8 +61,8 @@ const ClustersProvider: FC = ({ children }) => {
6161
);
6262

6363
const getKubeconfig = useCallback(
64-
(clusterName: string, filename: string) => {
65-
request('GET', `/v1/clusters/${clusterName}/kubeconfig`, {
64+
(clusterName: string, clusterNamespace: string, filename: string) => {
65+
request('GET', `/v1/clusters/${clusterName}/kubeconfig?cluster_namespace=${clusterNamespace}`, {
6666
headers: {
6767
Accept: 'application/octet-stream',
6868
},

ui-cra/src/contexts/Clusters/index.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ interface ClustersContext {
1818
data: DeleteClustersPRRequestEnriched,
1919
token: string,
2020
) => Promise<any>;
21-
getKubeconfig: (clusterName: string, fileName: string) => void;
21+
getKubeconfig: (clusterName: string, clusterNamespace: string, fileName: string) => void;
2222
getDashboardAnnotations: (cluster: GitopsClusterEnriched) => {
2323
[key: string]: string;
2424
};

0 commit comments

Comments
 (0)