How to use the @kubernetes/client-node.AppsV1Api function in @kubernetes/client-node

To help you get started, we’ve selected a few @kubernetes/client-node 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 DanWahlin / DockerAndKubernetesCourseCode / samples / blue-green / dashboard / dist / dashboard.js View on Github external
"use strict";
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
    function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
    return new (P || (P = Promise))(function (resolve, reject) {
        function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
        function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
        function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
        step((generator = generator.apply(thisArg, _arguments || [])).next());
    });
};
Object.defineProperty(exports, "__esModule", { value: true });
const k8s = require("@kubernetes/client-node");
const Table = require("easy-table");
const kc = new k8s.KubeConfig();
kc.loadFromDefault();
const appsV1Api = kc.makeApiClient(k8s.AppsV1Api);
const coreV1Api = kc.makeApiClient(k8s.CoreV1Api);
const roles = ['blue', 'green'];
getDeployments().catch(console.error.bind(console));
function getDeployments() {
    return __awaiter(this, void 0, void 0, function* () {
        const deploymentsRes = yield appsV1Api.listNamespacedDeployment('default');
        let deployments = [];
        for (const deployment of deploymentsRes.body.items) {
            let role = deployment.spec.template.metadata.labels.role;
            if (role && roles.includes(role)) {
                deployments.push({
                    name: deployment.metadata.name,
                    role,
                    status: deployment.status.conditions[0].status,
                    image: deployment.spec.template.spec.containers[0].image,
                    ports: [],
github DanWahlin / DockerAndKubernetesCourseCode / samples / blue-green / dashboard / dashboard.ts View on Github external
import * as k8s from '@kubernetes/client-node';
import * as Table from 'easy-table';

const kc = new k8s.KubeConfig();
kc.loadFromDefault();

const appsV1Api = kc.makeApiClient(k8s.AppsV1Api);
const coreV1Api = kc.makeApiClient(k8s.CoreV1Api);
const roles = ['blue', 'green'];

getDeployments().catch(console.error.bind(console));

async function getDeployments() {
    const deploymentsRes = await appsV1Api.listNamespacedDeployment('default');
    let deployments = [];
    for (const deployment of deploymentsRes.body.items) {
        let role = deployment.spec.template.metadata.labels.role;
        if (role && roles.includes(role)) {
            deployments.push({ 
                name: deployment.metadata.name, 
                role,
                status: deployment.status.conditions[0].status,
                image: deployment.spec.template.spec.containers[0].image,
github open-rpa / openflow / OpenFlow / src / KubeUtil.ts View on Github external
constructor() {
        const kc = new k8s.KubeConfig();
        kc.loadFromCluster();
        this.CoreV1Api = kc.makeApiClient(k8s.CoreV1Api);
        this.AppsV1Api = kc.makeApiClient(k8s.AppsV1Api);
        this.ExtensionsV1beta1Api = kc.makeApiClient(k8s.ExtensionsV1beta1Api);
    }
github qlik-oss / mira / src / orchestration / KubernetesClient.js View on Github external
constructor() {
    const kc = new k8s.KubeConfig();
    kc.loadFromCluster();
    this.k8sAppsApi = kc.makeApiClient(k8s.AppsV1Api);
    this.k8sCoreApi = kc.makeApiClient(k8s.CoreV1Api);
  }