How to use the vscode-kubernetes-tools-api.extension function in vscode-kubernetes-tools-api

To help you get started, we’ve selected a few vscode-kubernetes-tools-api examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github redhat-developer / vscode-openshift-tools / src / extension.ts View on Github external
async function isOpenShift(): Promise {
    const kubectl = await k8s.extension.kubectl.v1;
    if (kubectl.available) {
        const sr = await kubectl.api.invokeCommand('api-versions');
        if (!sr || sr.code !== 0) {
            return false;
        }
        return sr.stdout.includes("apps.openshift.io/v1");  // Naive check to keep example simple!
    }
}
github redhat-developer / vscode-tekton / src / extension.ts View on Github external
async function isTekton(): Promise {
    const kubectl = await k8s.extension.kubectl.v1;
    if (kubectl.available) {
        const sr = await kubectl.api.invokeCommand('api-versions');
        if (!sr || sr.code !== 0) {
            return false;
        }
        return sr.stdout.includes("tekton.dev/v1alpha1");  // Naive check to keep example simple!
    }
}
github redhat-developer / vscode-openshift-tools / src / k8s / common.ts View on Github external
export async function getChildrenNode(command: string, kind: string, abbreviation: string): Promise {
    const kubectl = await k8s.extension.kubectl.v1;
    if (kubectl.available) {
        const result = await kubectl.api.invokeCommand(`${command}`);
        const builds = result.stdout.split('\n')
            .filter((value) => value !== '')
            .map((item: string) => new Node(item.split(',')[0], item.split(',')[1], Number.parseInt(item.split(',')[2]), kind, abbreviation));
        return builds;
    }
    return [];
}
github redhat-developer / vscode-tekton / src / tekton / pipeline.ts View on Github external
async function PipelineResourceReturn(name: string): Promise {
            let pipeR: any[] = [];
            const element = context[0].resources.find(e => e.name === name);
            const kubectl = await k8s.extension.kubectl.v1;
            if (kubectl.available) {
                const k8output = await kubectl.api.invokeCommand('get pipelineresources -o json');
                try {
                    pipeR = JSON.parse(k8output.stdout).items;
                } catch (ignore) {

                }
            }
            let pipeResources = pipeR.map(value => ({
                name: value.metadata.name,
                type: value.spec.type,
            })).filter(function (obj) {
                return obj.type === element.type;
            });

            return pipeResources;

vscode-kubernetes-tools-api

Documents and encapsulates the API for the Kubernetes extension for Visual Studio Code

MIT
Latest version published 4 years ago

Package Health Score

49 / 100
Full package analysis

Popular vscode-kubernetes-tools-api functions