Skip to content
This repository has been archived by the owner on Mar 8, 2023. It is now read-only.

How can i make it work with all namespaces #2

Closed
debianmaster opened this issue Jun 7, 2017 · 5 comments
Closed

How can i make it work with all namespaces #2

debianmaster opened this issue Jun 7, 2017 · 5 comments

Comments

@debianmaster
Copy link

I tried watching all namespaces but this seem to work only with default namespace
how can watch all namespaces?

const OpenShiftClient = require('./lib/index.js')
const Api = require('kubernetes-client');

const JSONStream = require('json-stream');

const jsonStreamDC = new JSONStream();
const jsonStreamROUTE = new JSONStream();
const jsonStreamSVC = new JSONStream();

const oapi = new OpenShiftClient.OApi(OpenShiftClient.config.fromKubeconfig());
const api =  new Api.Core(Api.config.fromKubeconfig());


const streamDC = oapi.ns.deploymentconfigs.get({ qs: { watch: true } });
streamDC.pipe(jsonStreamDC);
jsonStreamDC.on('data', object => {
  //if(object.type=='ADDED')	
  //console.log("\n",object.object.metadata.name)
});

const streamSVC = api.ns.services.get({ qs: { watch: true } });
streamSVC.pipe(jsonStreamSVC);
jsonStreamSVC.on('data', object => {
  //if(object.type=='ADDED')	
  //console.log("\n",object.object.metadata.name)
});


const streamROUTE = oapi.ns.routes.get({ qs: { watch: true } });
streamROUTE.pipe(jsonStreamROUTE);
jsonStreamROUTE.on('data', object => {
  console.log('test');
  console.log('Route:', JSON.stringify(object, null, 2));
});
@debianmaster
Copy link
Author

This is also working :) thanks for the quick turn around on openshift-client.
Do you plan to publish it to npm registry ?

@silasbw
Copy link
Owner

silasbw commented Jun 7, 2017

I don't plan on publishing it. I don't use openshift (yet :) ). I intend for this to be an example of how to extend kubernetes-client without forking it. If you think it's a good approach, feel free to adopt/copy the approach for https://github.com/debianmaster/openshift-client / https://www.npmjs.com/package/openshift-client

@debianmaster
Copy link
Author

i will add other openshift specific objects and will publish.
thanks for your time.

@silasbw
Copy link
Owner

silasbw commented Jun 7, 2017

👍

@debianmaster
Copy link
Author

just for the record, i published here https://github.com/debianmaster/openshift-client

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants