How to use the @kubernetes/client-node.Custom_objectsApi function in @kubernetes/client-node

To help you get started, we’ve selected a few @kubernetes/client-node examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github sandstorm / metacontroller-framework / src / index.ts View on Github external
validateKubernetesResources(singleOperatorName) {
            // 1) Delete/Create Namespace. NOTE: for some reason, we need to do this using the Kubectl Command Line;
            //    as I was not able to wait on the deleted namespace using the Kubernetes JS client.
            execSync("kubectl delete namespace metacontroller-dev || echo 'Namespace does not exist'", { stdio: 'inherit' });
            execSync("kubectl create namespace metacontroller-dev", { stdio: 'inherit' });

            const kc = new k8s.KubeConfig();
            kc.loadFromDefault();
            const k8sApi_apiExtensions = kc.makeApiClient(k8s.Apiextensions_v1beta1Api);
            const k8sApi_customObjects = kc.makeApiClient(k8s.Custom_objectsApi);
            const d = new k8s.V1DeleteOptions();
            d.propagationPolicy = 'Foreground';
            d.gracePeriodSeconds = 0;

            let nextPromise = Promise.resolve();
            args.operators.forEach(operatorDefinition => {
                if (singleOperatorName !== true && operatorDefinition.key !== singleOperatorName) {
                    console.log(`\n\nOPERATOR ${operatorDefinition.key}\n  - skipping`);
                    return;
                }
                const crd = YAML.parse(loadCustomResourceDefinition(operatorDefinition));
                crd.metadata.name += ".dev";
                crd.spec.group += ".dev";

                nextPromise = nextPromise
                    .then(() => console.log(`\n\nOPERATOR ${operatorDefinition.key}`))
github kyma-project / console / tests / ui-tests / setup / test-pluggable.js View on Github external
async fetch() {
    const apiClient = kubeConfig.makeApiClient(k8s.Custom_objectsApi);
    const { body } = await apiClient.listClusterCustomObject(
      'ui.kyma-project.io',
      'v1alpha1',
      'backendmodules',
    );
    const items = body.items.map(item => item.metadata.name);
    this.modules = items;
    this.fetched = true;
  }
github kubeflow / kubeflow / components / centraldashboard / app / k8s_service.ts View on Github external
constructor(private kubeConfig: k8s.KubeConfig) {
    console.info('Initializing Kubernetes configuration');
    this.kubeConfig.loadFromDefault();
    const context =
        this.kubeConfig.getContextObject(this.kubeConfig.getCurrentContext());
    if (context && context.namespace) {
      this.namespace = context.namespace;
    }
    this.coreAPI = this.kubeConfig.makeApiClient(k8s.Core_v1Api);
    this.customObjectsAPI =
        this.kubeConfig.makeApiClient(k8s.Custom_objectsApi);
  }