From d0d937405a8a08ba8eac7c4dd452e0641ad6805b Mon Sep 17 00:00:00 2001 From: Lucas Holmquist Date: Wed, 24 Apr 2019 08:30:55 -0400 Subject: [PATCH] feat: add the service instance endpoint (#125) fixes #121 --- lib/openshift-rest-client.js | 5 +++++ lib/specs/service-catalog-crd.json | 17 +++++++++++++++++ 2 files changed, 22 insertions(+) create mode 100644 lib/specs/service-catalog-crd.json diff --git a/lib/openshift-rest-client.js b/lib/openshift-rest-client.js index 06447f3..14a2570 100644 --- a/lib/openshift-rest-client.js +++ b/lib/openshift-rest-client.js @@ -25,6 +25,8 @@ const path = require('path'); const { Client, config, alias } = require('kubernetes-client'); const { getTokenFromBasicAuth } = require('./basic-auth-request'); +const serviceCatalogCRD = require('./specs/service-catalog-crd.json'); + // A list of shorthand aliases const resourceAliases = { 'apps.openshift.io': ['app'], @@ -85,6 +87,9 @@ async function openshiftClient (settings = {}) { // TODO: need to be able to pass in the config object here const client = new Client({ config: kubeconfig || config.fromKubeconfig(), spec, getNames: getNames }); + + // CRD with the service instance stuff, but only to this client, not the cluster + client.addCustomResourceDefinition(serviceCatalogCRD); return client; } diff --git a/lib/specs/service-catalog-crd.json b/lib/specs/service-catalog-crd.json new file mode 100644 index 0000000..deb956a --- /dev/null +++ b/lib/specs/service-catalog-crd.json @@ -0,0 +1,17 @@ +{ + "kind": "CustomResourceDefinition", + "spec": { + "scope": "Namespaced", + "version": "v1beta1", + "group": "servicecatalog.k8s.io", + "names": { + "shortNames": [ + "si" + ], + "kind": "ServiceInstance", + "plural": "serviceinstances", + "singular": "serviceinstance" + } + }, + "apiVersion": "servicecatalog.k8s.io/v1beta1" +}