dina
dina

Reputation: 4289

how to run gcloud container command using api

I am using this gcloud command to resize my GKE cluster

   gcloud container clusters resize $CLUSTER_NAME --num-nodes=0

how can I achieve the same using the api?

I found @google-cloud/container library, what function should I be using?

Upvotes: 0

Views: 155

Answers (1)

dina
dina

Reputation: 4289

const container = require('@google-cloud/container');
const client = new container.v1.ClusterManagerClient();

const request = {
    projectId: 'my-project-id',
    zone: 'us-central1-f',
    clusterId: 'my-cluster-id',
    nodePoolId: 'default-pool',
    nodeCount: 0
};

client.setNodePoolSize(request, (err, res) => {
    console.log(err);
    console.log(res);
});

see also api reference

Upvotes: 1

Related Questions