node model: adapt to node_properties

The nodes are receiving flags from Nodepool
via the node_properties attribute on the
Node instance. These node_properties need to
end up in the nodepool dictionary produced by Zuul
when generating the inventory.yaml file. By having
the properties in the inventory.yaml file, it is possible
at job runtime or in the post analysis to determine certain
details about the node that is/was used for the job.

Change-Id: I977107332ef3fe4d168c419fbcb9c6cd2607b580
This commit is contained in:
Tudor Tabacel
2024-09-12 21:00:44 +02:00
parent 6bf69f7e02
commit 4088732b85
4 changed files with 13 additions and 2 deletions

View File

@ -1461,6 +1461,14 @@ executor running the job is available:
A private IPv6 address of the node.
.. var:: node_properties
Arbitrary mapping of node properties, such as boolean flags representing
criteria that were taken into account when a node is allocated to Zuul by
Nodepool. Notable properties are `spot` for when a node is an AWS spot
instance or `fleet` when the node was created by Nodepool using the AWS
fleet API.
SSH Keys
--------

View File

@ -1301,7 +1301,8 @@ class FakeNodepool(object):
image_id=None,
host_keys=host_keys,
executor='fake-nodepool',
hold_expiration=None)
hold_expiration=None,
node_properties={"spot": False})
if self.resources:
data['resources'] = self.resources
if self.remote_ansible:

View File

@ -2119,7 +2119,8 @@ class AnsibleJob(object):
public_ipv4=node.public_ipv4,
private_ipv4=node.private_ipv4,
public_ipv6=node.public_ipv6,
private_ipv6=node.private_ipv6)))
private_ipv6=node.private_ipv6,
node_properties=node.node_properties)))
# Ansible >=2.8 introduced "auto" as an
# ansible_python_interpreter argument that looks up

View File

@ -1895,6 +1895,7 @@ class Node(ConfigObject):
self.attributes = {}
self.tenant_name = None
self.requestor = None
self.node_properties = {}
@property
def state(self):