Page MenuHomePhabricator

Support Cloud VPS project references by ID as well as name
Open, Needs TriagePublicFeature

Description

Since T274268: Wind down use of project ID and project name equivalency in OpenStack was completed the historic practice of a Cloud VPS project's OpenStack Project ID and Project Name being the same human readable string value is no longer true. Humans still generally use readable names when talking about projects (e.g. zuul). OpenStack scripting is no however more likely to use the UUID derived Project ID value (e.g. c26d9d326bdf464fa1025939ded7e5a2).

The basic problem of references expecting project ID values was addressed in T379030: openstack: wmfkeystonehooks: project ids rather than names are being used in LDAP group creation for human users. The fix there was making sure that LDAP, instance FQDNs, and Puppet lookups use Project Name values rather than Project ID values. This was toil for @Andrew, but I think it put things in a better state for humans going forward.

The cookbook tooling that the WMCS team uses includes a --project <Project ID> argument that constrains the scope where the cookbook runs and also is used in !log messages sent to IRC for Stashbot to process. The use of Project ID here is a return of the problem from T379030 in that the value is needed when talking to the OpenStack APIs, but Stashbot expects Project Name.

[17:56]  <logmsgbot_cloud> !log bd808@cloudcumin1001 c26d9d326bdf464fa1025939ded7e5a2 START - Cookbook wmcs.openstack.cloudvirt.vm_console
[17:56]  < stashbot> bd808@cloudcumin1001: Unknown project "c26d9d326bdf464fa1025939ded7e5a2"

Event Timeline

@Andrew worked on a patch in https://gerrit.wikimedia.org/r/c/labs/tools/stashbot/+/1093997 that would have given Stashbot the capability to talk to the OpenStack API to get a list of Project Name values. That solution requires something providing OpenStack credentials to the running application. Finding a way to do that that satisfied everyone stalled out and became moot as other system changes were made. Resurrecting that work or a work-alike is going to require some source for credentials. We can chose to make this a problem for the Stashbot maintainers by putting the credentials into the same config files that now hold things like OAuth private keys. This has some fragility issues in the face of credential rotation, but as @aborrero said in a prior discussion that seems to have never happened yet, so it probably isn't a top concern.

A different way to approach this problem for the specific spicerack cookbook use case would be to change the cookbooks to lookup the Project Name based on the Project ID and use the name in IRC logging. That would happen around https://gerrit.wikimedia.org/r/plugins/gitiles/cloud/wmcs-cookbooks/+/0186ec0c7ac9867ba4f8937303e2c746472dd8b5/wmcs_libs/common.py#802