const container = require('@google-cloud/container');
const client = new container.v1.ClusterManagerClient();
const {
PROJECT, ZONE, CLUSTER, POOL,
} = process.env;
const config = {
projectId: PROJECT,
clusterId: CLUSTER,
zone: ZONE,
nodePoolId: POOL,
};
const turnOffCluster = async () => {
const [operation] = await client.setNodePoolAutoscaling(
{ ...config, autoscaling: { enabled: false } },
);
await operation.promise();
await client.setNodePoolSize({ ...config, nodeCount: 0 });
};
turnOffCluster();
We need that in order to be able to wait until the autoscaling is completely applied to later be able to resize the pool to 0.
Environment details
@google-cloud/containerversion: 2.2.0Steps to reproduce
(node:58270) UnhandledPromiseRejectionWarning: TypeError: operation.promise is not a functionExpected behaviour
The operation.promise() should return a promise as it is specified in the documentation https://googleapis.dev/nodejs/container/latest/v1.ClusterManagerClient.html#setNodePoolAutoscaling
We need that in order to be able to wait until the autoscaling is completely applied to later be able to resize the pool to 0.