Skip to content

Conversation

@Tatsinnit
Copy link
Member

@Tatsinnit Tatsinnit commented May 26, 2025

This work is headlamp integration into AKS VSC scenario using headlamps, in-cluster installation approach. (Opening this early as Draft)

Prima facie, we have utilized this enabling mechanism: https://headlamp.dev/docs/latest/installation/in-cluster/#using-simple-yaml

We just need to iron out the U/X but the main hook around this is already and leaving this open as Draft as advancement on what we have a align this for release in coming week or 2.

Thanks.

Gently fyi and cc: @tejhan, @qpetraroia ❤️ 🥷

@Tatsinnit Tatsinnit self-assigned this May 26, 2025
@Tatsinnit Tatsinnit added the enhancement 🚀 New feature or request or improvements on existing code. label May 26, 2025
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR introduces headlamp integration into the AKS VSC scenario, adding support for deploying Headlamp as part of the in-cluster installation mechanism. Key changes include new headlamp-related tests and UI components, updated messaging for headlamp state, and integration with VS Code commands and panels.

Reviewed Changes

Copilot reviewed 12 out of 12 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
webview-ui/src/manualTest/main.tsx Added headlamp scenario retrieval for manual testing
webview-ui/src/manualTest/headlampTests.tsx Defined headlamp test scenarios using the new Headlamp component
webview-ui/src/main.tsx Integrated headlamp UI component into the main application
webview-ui/src/Headlamp/* Created Headlamp component, state management, and styles
src/webview-contract/* Added webview definitions and types for Headlamp
src/panels/HeadlampPanel.ts Introduced panel and data provider for headlamp deployments
src/extension.ts Registered the deployHeadlamp command in the extension activation
src/commands/oservabilitytools/deployHeadlamp/deployHeadlamp.ts Implemented a command to deploy Headlamp using kubectl and display its panel
package.json Updated menus and command contributions for headlamp integration

Comment on lines +86 to +137
// below function isn't being used anymore - can maybe be removed unless refactor
void deployHeadlampInCluster;
async function deployHeadlampInCluster(
kubectl: k8s.APIAvailable<k8s.KubectlV1>,
clusterNode: AksClusterTreeNode,
clusterKubeConfig: string,
): Promise<void> {
const clusterName = clusterNode.name;
console.log(`Deploying Headlamp in cluster ${clusterName}.`);

const sessionProvider = await getReadySessionProvider();
if (failed(sessionProvider)) {
vscode.window.showErrorMessage(sessionProvider.error);
return;
}

const extension = getExtension();
if (failed(extension)) {
vscode.window.showErrorMessage(extension.error);
return;
}

await tmpfile.withOptionalTempFile<Errorable<k8s.KubectlV1.ShellResult>>(
clusterKubeConfig,
"YAML",
async (kubeConfigFile) => {
// Clean up running instance (without an error if it doesn't yet exist).
// const deleteResult = await invokeKubectlCommand(
// kubectl,
// kubeConfigFile,
// "delete ns aks-periscope --ignore-not-found=true",
// );
// if (failed(deleteResult)) return deleteResult;

// Deploy headlamp.
const applyResult = await invokeKubectlCommand(
kubectl,
kubeConfigFile,
`apply -k https://raw.githubusercontent.com/kinvolk/headlamp/main/kubernetes-headlamp-ingress-sample.yaml`,
);
if (failed(applyResult)) return applyResult;

// kubectl port-forward -n kube-system service/headlamp 8080:80
return invokeKubectlCommand(
kubectl,
kubeConfigFile,
" port-forward -n kube-system service/headlamp 8080:80",
);
},
);
}

Copy link

Copilot AI May 26, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The unused reference to 'deployHeadlampInCluster' can be removed to clean up the code. Consider deleting it and its associated function if it is no longer required.

Suggested change
// below function isn't being used anymore - can maybe be removed unless refactor
void deployHeadlampInCluster;
async function deployHeadlampInCluster(
kubectl: k8s.APIAvailable<k8s.KubectlV1>,
clusterNode: AksClusterTreeNode,
clusterKubeConfig: string,
): Promise<void> {
const clusterName = clusterNode.name;
console.log(`Deploying Headlamp in cluster ${clusterName}.`);
const sessionProvider = await getReadySessionProvider();
if (failed(sessionProvider)) {
vscode.window.showErrorMessage(sessionProvider.error);
return;
}
const extension = getExtension();
if (failed(extension)) {
vscode.window.showErrorMessage(extension.error);
return;
}
await tmpfile.withOptionalTempFile<Errorable<k8s.KubectlV1.ShellResult>>(
clusterKubeConfig,
"YAML",
async (kubeConfigFile) => {
// Clean up running instance (without an error if it doesn't yet exist).
// const deleteResult = await invokeKubectlCommand(
// kubectl,
// kubeConfigFile,
// "delete ns aks-periscope --ignore-not-found=true",
// );
// if (failed(deleteResult)) return deleteResult;
// Deploy headlamp.
const applyResult = await invokeKubectlCommand(
kubectl,
kubeConfigFile,
`apply -k https://raw.githubusercontent.com/kinvolk/headlamp/main/kubernetes-headlamp-ingress-sample.yaml`,
);
if (failed(applyResult)) return applyResult;
// kubectl port-forward -n kube-system service/headlamp 8080:80
return invokeKubectlCommand(
kubectl,
kubeConfigFile,
" port-forward -n kube-system service/headlamp 8080:80",
);
},
);
}
// (Removed unused deployHeadlampInCluster declaration and function)

Copilot uses AI. Check for mistakes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement 🚀 New feature or request or improvements on existing code.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants