Report nodepool resource stats gauges in scheduler

We currently report nodepool resource usage whenever we use or return
nodes.  This now happens on the executors, and they don't have a
global view of all nodes used.  The schedulers do, and they already
have a periodic stats reporting method.

Shift the reporting of node resource gauges to the scheduler.  To make
this efficient, use a tree cache for nodes.  Because node records
alone don't have enough information to tie them back to a tenant or
project, use the new user_data field on the Node object to store that
info when we mark a node in use.  Also, store the zuul system id on
the node, so that we can ensure we're only reporting nodes that belong
to us.

Update the node list in the REST API to use the cache as well, and
also filter its results by zuul system id and tenant.

Depends-On: https://review.opendev.org/807362
Change-Id: I9d0987b250b8fb54b3b937c86db327d255e54abd
This commit is contained in:
James E. Blair
2021-09-03 13:23:44 -07:00
parent b41f467340
commit aee6ef6f7f
10 changed files with 318 additions and 140 deletions

View File

@@ -0,0 +1,6 @@
---
upgrade:
- |
Nodepool 4.3.0 is now required. Zuul stores additional
information in node records in preparation for supporting multiple
schedulers.