This PR implements a working version of an incomplete metric population for Azure AKS. See the below "Todo" section for follow-up work.
A new method for obtain VM information is introduced.
[!NOTE]
This was born out of this much more complicated PR, but I've removed the caching and region-awareness elements. We are yet to decide if they should return.
Virtual Machines
A new subsystem of the aks package is introduced: machine_store. This is analogous to the already implemented price_store. Rather than pricing information for certain machine types and characteristics, machine_store is responsible for:
obtaining lists of VMs associated with AKS clusters in a given subscription
obtaining relevant information associated with those VMs, e.g. Machine Type, Region, etc
Population Strategy
Machines are populated in the following way:
a list of AKS clusters and the associated resource group(s) of their nodes' Virtual Machines is obtained
For each resource group containing nodes associated with the cluster, information about VirtualMachineScaleSets (the backing resource of an AKS node pool) and the VMs that make up that scale set is obtained
The VMs, along with their relevant information is stored in MachineMap
how machines and their relevant details are obtained and saved in a MachineMap
We can combine to generate prometheus metrics.
When the AKS collector is first registered, both the PriceMap and the MachineMap are populated. This is an expensive API call and is thus only done once every 24 hours.
After both PriceMap and MachineMap are populated, calls to Collect() (happening when the Prometheus /metrics endpoint is scraped) follow this pattern:
Iterate over MachineMap
for each machine in the map, get information from MachineMap
get pricing information from PriceMap
Todos
Grab the Machine "family somehow" (define what this means for Azure)
Introduce methodology to approximate CPU and RAM cost
AKS Virtual Machine Pricing Metric Population
This PR implements a working version of an incomplete metric population for Azure AKS. See the below "Todo" section for follow-up work.
A new method for obtain VM information is introduced.
Virtual Machines
A new subsystem of the
aks
package is introduced:machine_store
. This is analogous to the already implementedprice_store
. Rather than pricing information for certain machine types and characteristics,machine_store
is responsible for:Population Strategy
Machines are populated in the following way:
MachineMap
This information is refreshed periodically, currently every five minutes.
Putting it Together
Now that it is established:
PriceMap
- see previous PR for the gist of itMachineMap
We can combine to generate prometheus metrics.
When the AKS collector is first registered, both the PriceMap and the MachineMap are populated. This is an expensive API call and is thus only done once every 24 hours.
After both PriceMap and MachineMap are populated, calls to
Collect()
(happening when the Prometheus/metrics
endpoint is scraped) follow this pattern:Todos
Testing
note: removing cluster name and other sensitive items.
Quick price spot check