This code checks if any GCP (Google Cloud Platform) nodes have an active preempt operation. It uses the gcloud command-line tool to interact with GCP APIs and retrieve the necessary information.
The SLI lists all preempt node operations that have a status that does not match "DONE", counts the total nodes in this state, and pushes the metric.
The Taskset lists all preempt node operations that have a status that does not match "DONE" and returns the following details in json format:
- startTime
- targetLink
- statusMessage
- progress
- zone
- selfLink
The following permissions are required on the GCP service account used with the gcloud utility:
- 'compute.globalOperations.list'