Giter Club home page Giter Club logo

kubernetes's Introduction

The Internet Folks Logo

@theinternetfolks/kubernetes

GitHub license Maintainer Downloads

Library to help you interact with Docker or Kubernetes cluster in Node-based environments.

Installation

Install with npm

  npm install @theinternetfolks/kubernetes

Install with yarn

  yarn add @theinternetfolks/kubernetes

Usage

You initialize Kubernetes with your configuration, and then you can use any resources available.

Loading from Default

import { Kubernetes } from "@theinternetfolks/kubernetes";

const perform = async () => {
  const k8s = new Kubernetes(); // will load from default
  return k8s.Ingress.getAll();
};

Loading from File

import { Kubernetes } from "@theinternetfolks/kubernetes";

const perform = async () => {
  const k8s = new Kubernetes("config", "file"); // will load from a `config` file
  return k8s.Ingress.getAll();
};

Loading from String

import { Kubernetes } from "@theinternetfolks/kubernetes";

const perform = async () => {
  const config = await fs.readFile("config", "utf-8");
  const k8s = new Kubernetes(config, "string"); // will load from a `config` string
  return k8s.Ingress.getAll();
};

Table Of Content

Kubernetes

Kubernetes / Client

  • constructor(config: any, method: KubernetesBootstrapMethod)
  • public kc: k8s.KubeConfig
  • disconnect(): void

Kubernetes / Pod

  • async getAll(namespace: string = "default"): Promise<V1PodList>
  • async get(name: string, namespace: string = "default"): Promise<V1Pod>
  • async remove(name: string, namespace: string = "default", gracePeriodSeconds: number = 0): Promise<V1Pod>

Kubernetes / Deployment

  • async getAll(namespace: string = "default"): Promise<V1DeploymentList>
  • async get(name: string, namespace: string = "default"): Promise<V1Deployment>
  • async remove(name: string, namespace: string = "default"): Promise<V1Status>
  • async apply(specString: string): Promise<k8s.KubernetesObject[]>

Kubernetes / Ingress

  • async getAll(namespace: string = "default"): Promise<V1IngressList>
  • async get(name: string, namespace: string = "default"): Promise<V1Ingress>
  • async remove(name: string, namespace: string = "default"): Promise<V1Status>
  • async apply(specString: string | V1Ingress, namespace: string = "default"): Promise<V1Ingress>

Kubernetes / StatefulSet

  • async getAll(namespace: string = "default"): Promise<V1StatefulSetList>
  • async get(name: string, namespace: string = "default"): Promise<V1StatefulSet>
  • async remove(name: string, namespace: string = "default"): Promise<V1Status>

Docker

Build Images

static async build(tag: string, options: BuildOptions = {})

returns Promise<{ status: boolean; message: string; }>

Pull Images

static async pull(tag: string, options: PullOptions = {})

returns Promise<{ status: boolean; message: string; }>

Push Images

static async push(tag: string, options: Dockerode.ImagePushOptions = {})

returns Promise<{ status: boolean; message: string; }>

Running Tests

To run tests, run the following command

  yarn test
  • Used Mocha with Chai as Unit Tests
  • Private Repo and Tokens were used to carry out some pull and push tests in Docker

Test Coverage

License

MIT

kubernetes's People

Contributors

monkfromearth avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.