
Security News
Deno 2.2 Improves Dependency Management and Expands Node.js Compatibility
Deno 2.2 enhances Node.js compatibility, improves dependency management, adds OpenTelemetry support, and expands linting and task automation for developers.
vscode-kubernetes-tools-api
Advanced tools
Documents and encapsulates the API for the Kubernetes extension for Visual Studio Code
A NPM package providing documentation and helpers for using the Kubernetes extension for Visual Studio Code in your own VS Code extensions. You can use this to:
kubectl
features in a way that's consistent with the core extensionThe package includes TypeScript type declarations and JSDoc comments. For usage information and samples, see https://aka.ms/vscodekubeapi.
// Using TypeScript for sample purposes but it all works in JavaScript too!
import * as vscode from 'vscode';
import * as k8s from 'vscode-kubernetes-tools-api';
export function activate(context: vscode.ExtensionContext) {
const disposable = vscode.commands.registerCommand('k8stop.top', showResourceUsage);
context.subscriptions.push(disposable);
}
async function showResourceUsage(target?: any): Promise<void> {
// Standard pattern for accessing the APIs
const explorer = await k8s.extension.clusterExplorer.v1;
if (!explorer.available) {
vscode.window.showErrorMessage(`Command not available: ${explorer.reason}`);
return;
}
const kubectl = await k8s.extension.kubectl.v1;
if (!kubectl.available) {
vscode.window.showErrorMessage(`kubectl not available: ${kubectl.reason}`);
return;
}
// Example of using the Cluster Explorer API to figure out what was clicked
const node = explorer.api.resolveCommandTarget(target);
if (node && node.nodeType === 'resource' && node.resourceKind.manifestKind === 'Node') {
// Example of using the kubectl API to invoke a command
const topResult = await kubectl.api.invokeCommand(`top node ${node.name}`);
if (!topResult || topResult.code !== 0) {
vscode.window.showErrorMessage(`Can't get resource usage: ${topResult ? topResult.stderr : 'unable to run kubectl'}`);
return;
}
const topCommandOutput = topResult.stdout;
// show topCommandOutput as required;
}
}
This project welcomes contributions and suggestions. Most contributions require you to agree to a Contributor License Agreement (CLA) declaring that you have the right to, and actually do, grant us the rights to use your contribution. For details, visit https://cla.microsoft.com.
When you submit a pull request, a CLA-bot will automatically determine whether you need to provide a CLA and decorate the PR appropriately (e.g., label, comment). Simply follow the instructions provided by the bot. You will only need to do this once across all repos using our CLA.
This project has adopted the Microsoft Open Source Code of Conduct. For more information see the Code of Conduct FAQ or contact opencode@microsoft.com with any additional questions or comments.
1.1.0
Thanks to @amsoedal!
FAQs
Documents and encapsulates the API for the Kubernetes extension for Visual Studio Code
The npm package vscode-kubernetes-tools-api receives a total of 384 weekly downloads. As such, vscode-kubernetes-tools-api popularity was classified as not popular.
We found that vscode-kubernetes-tools-api demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 2 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Deno 2.2 enhances Node.js compatibility, improves dependency management, adds OpenTelemetry support, and expands linting and task automation for developers.
Security News
React's CRA deprecation announcement sparked community criticism over framework recommendations, leading to quick updates acknowledging build tools like Vite as valid alternatives.
Security News
Ransomware payment rates hit an all-time low in 2024 as law enforcement crackdowns, stronger defenses, and shifting policies make attacks riskier and less profitable.