🚀 Big News: Socket Acquires Coana to Bring Reachability Analysis to Every Appsec Team.Learn more
Socket
DemoInstallSign in
Socket

k8s-ops

Package Overview
Dependencies
Maintainers
1
Versions
8
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

k8s-ops

Collective useful k8s ops features built on top of kubernetes-client

1.0.7
latest
Source
npm
Version published
Weekly downloads
0
-100%
Maintainers
1
Weekly downloads
 
Created
Source

k8s-ops

Collective useful k8s ops features built on top of awesome kubernetes-client

Installation

Install via npm:

$ npm i k8s-ops --save

Example

const { Apis, K8SAuthType, Features, DeploymentStatusType, Transformers } = require('k8s-ops')
const { hpa: HPA, deploy: Deploy, pod: Pod } = Features

const namespace = 'kube-system'

const apis = Apis(K8SAuthType.FromKubeconfig, namespace)
const hpa = HPA(apis, 'your-hpa')

hpa.scale({ minReplicas: 5, maxReplicas: 9 }) // Scale HPA with given min/max replicas
  .then(() => hpa.assertScale({ minReplicas: 5, maxReplicas: 9 })) // check if scale is set correctly
  .then(console.log)

const deploy = Deploy(apis, 'heapster')

deploy.assertStatus(DeploymentStatusType.AsDesired) // check if all pods are all up-to-date and available
  .then(console.log)

deploy.pods(Transformers.pod.readyAt) //Using optional transformer to get more consize data and you can implement your own
  .then(console.log)

const pod = Pod(apis, 'your-pod-755b9c7968-r889w')

pod.terminate().then(console.log)

pod.res.get().then(console.log) // use kubernetes-client's objects' feature directly by accessing .res

FAQs

Package last updated on 29 May 2018

Did you know?

Socket

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.

Install

Related posts