googleapis / googleapis/google-cloud-node
How set scheduling maxRunDuration or terminationTime while creating a instance
- Dominant language
- TypeScript
- Stars
- 3.2k
- Forks
- 712
- Avg merge
- 2d 3h
- Merged PRs (30d)
- 99
Description
I'm using @google-cloud/compute: "4.0.1"
I need my project to create a new Spot Instance, but when the task finishes, the instance should be deleted, not stopped.
The problem is that, looking at api interfaces in typescript, the scheduling configuration does not support maxRunDuration or terminationTime, I have tried many things, here is what my scheduling configuration looks like:
```
const compute = require('@google-cloud/compute');
const instancesClient = new compute.InstancesClient();
...
const schedulingConfig = {
provisioningModel: 'SPOT',
automaticRestart: false,
instanceTerminationAction: 'DELETE',
onHostMaintenance: 'DELETE',
preemptible: true,
maxRunDuration: {
seconds: 6000,
},
terminationTime: '2023-10-16T13:40:00Z',
};
const [response] = await instancesClient.insert({
project: cloudProjectId,
zone: cloudZone,
instanceResource: {
name: instanceName,
scheduling: schedulingConfig,
machineType,
disks,
serviceAccounts,
metadata,
networkInterfaces,
},
});
```
Any ideas on how to do this?
Contributor guide
Assessment
This issue has not been assessed yet.