Giter Site home page Giter Site logo

travisghansen / node-red-contrib-kubernetes-client Goto Github PK

View Code? Open in Web Editor NEW
9.0 3.0 3.0 240 KB

Node-RED node for interacting with Kubernetes clusters

License: MIT License

HTML 30.73% JavaScript 69.27%
node-red node-red-contrib kubernetes k8s node-red-flow api nodered

node-red-contrib-kubernetes-client's Introduction

node-red-contrib-kubernetes-client

A Node-RED node that supports interacting with Kubernetes API via watches and HTTP requests.

GitHub

Install

npm install --save node-red-contrib-kubernetes-client

Documentation

The nodes are properly documented in Node-RED itself. In short there are 2 nodes:

  • kubernetes-client-watch - produces messages for configured watch endpoints.
  • kubernetes-client-http - allows complete interaction with Kubernetes API via ALL HTTP endpoints and verbs etc.

Watches ouput a msg.payload with the following structure (as a json object in Node-RED but shared here as yaml for readability):

# example event
---
type: ADDED || MODIFIED || DELETED || ERROR
object:
  kind: ...
  apiVersion: ...
  metadata:
    ...
  ...

# example error
---
type: ERROR
object:
  kind: Status
  apiVersion: v1
  metadata: {}
  status: Failure
  message: 'too old resource version: 1 (78390381)'
  reason: Gone
  code: 410

msg.payload.object contains the full resource from Kubernetes.

Development

Some helpful command variants for testing/developing:

# show event output structure
kubectl -v6 get nodes --watch --output-watch-events -o yaml

# manually specify URL
kubectl -v6 get --raw '/api/v1/nodes?resourceVersion=1&watch=true'

# watch response error structure
---
type: ERROR
object:
  kind: Status
  apiVersion: v1
  metadata: {}
  status: Failure
  message: 'too old resource version: 1 (78383979)'
  reason: Gone
  code: 410

License

See license (MIT).

node-red-contrib-kubernetes-client's People

Contributors

dependabot[bot] avatar travisghansen avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

node-red-contrib-kubernetes-client's Issues

UnhandledPromiseRejectionWarning: TypeError: node.watch.on is not a function

I just tried this node, but I am getting following error from watch node as soon as it is launched. Is this a version incompatibility or such? Here are my version
10 Jun 18:07:01 - [info] Node-RED version: v1.0.6
10 Jun 18:07:01 - [info] Node.js version: v14.4.0
10 Jun 18:07:01 - [info] Linux 4.15.0-101-generic x64 LE

10 Jun 18:04:14 - [info] [kubernetes-client-watch:f4e2057d.ef7178] watching https://myhost:6443/api/v1/pods from resourceVersion: 258446
(node:6676) UnhandledPromiseRejectionWarning: TypeError: node.watch.on is not a function
at KubernetesClientWatchNode.node.startWatch (/home/ubuntu/.node-red/node_modules/node-red-contrib-kubernetes-client/src/index.js:336:18)
at processTicksAndRejections (internal/process/task_queues.js:97:5)
(Use node --trace-warnings ... to show where the warning was created)
(node:6676) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag --unhandled-rejections=strict (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 1)

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.