From 546d6a0ed55aae1760d67963cadaed5edc8c1926 Mon Sep 17 00:00:00 2001
From: Jeremy Stanley <fungi@yuggoth.org>
Date: Fri, 23 Aug 2024 17:00:59 +0000
Subject: [PATCH] Switch Rackspace Flex authentication to project_id

For some reason (cache lookup timeouts?) using the project name and
domain wasn't working initially (but did begin working some time
after also logging into the Skyline dashboard). As a matter of
robustness, use the project IDs instead which worked immediately
with no problem.

Since we needed to add new values in our private hostvars for this,
go ahead and separate out the hostvars used for other items too as
future-proofing. These have all been added on the bridge now.

While we're here, do some cleanup of unnecessary default values
pointed out on the previous review.

Change-Id: I850ef61932e9818495fa99e1d13360693f82edd8
---
 .../templates/clouds/bridge_all_clouds.yaml.j2 | 18 ++++++------------
 .../templates/clouds/nodepool_clouds.yaml.j2   |  9 +++------
 .../group_vars/control-plane-clouds.yaml.j2    |  6 ++++++
 .../zuul/templates/group_vars/nodepool.yaml.j2 |  3 +++
 4 files changed, 18 insertions(+), 18 deletions(-)

diff --git a/playbooks/templates/clouds/bridge_all_clouds.yaml.j2 b/playbooks/templates/clouds/bridge_all_clouds.yaml.j2
index adfb71977b..be15b05077 100644
--- a/playbooks/templates/clouds/bridge_all_clouds.yaml.j2
+++ b/playbooks/templates/clouds/bridge_all_clouds.yaml.j2
@@ -75,25 +75,19 @@ clouds:
       - name: SJC3
     auth:
       auth_url: 'https://keystone.api.sjc3.rackspacecloud.com/v3'
-      project_name: '{{ clouds.openstackci_rax_project_id }}_Flex'
-      project_domain_name: rackspace_cloud_domain
-      username: '{{ clouds.openstackci_rax_username }}'
-      password: '{{ clouds.openstackci_rax_key }}'
+      project_id: '{{ clouds.opendevci_raxflex_project_id }}'
+      username: '{{ clouds.opendevci_raxflex_username }}'
+      password: '{{ clouds.opendevci_raxflex_key }}'
       user_domain_name: rackspace_cloud_domain
-    interface: public
-    identity_api_version: '3'
   opendevzuul-raxflex:
     regions:
       - name: SJC3
     auth:
       auth_url: 'https://keystone.api.sjc3.rackspacecloud.com/v3'
-      project_name: '{{ clouds.openstackjenkins_rax_project_id }}_Flex'
-      project_domain_name: rackspace_cloud_domain
-      username: '{{ clouds.openstackjenkins_rax_username }}'
-      password: '{{ clouds.openstackjenkins_rax_key }}'
+      project_id: '{{ clouds.opendevzuul_raxflex_project_id }}'
+      username: '{{ clouds.opendevzuul_raxflex_username }}'
+      password: '{{ clouds.opendevzuul_raxflex_key }}'
       user_domain_name: rackspace_cloud_domain
-    interface: public
-    identity_api_version: '3'
   openstackjenkins-ovh:
     regions:
       - GRA1
diff --git a/playbooks/templates/clouds/nodepool_clouds.yaml.j2 b/playbooks/templates/clouds/nodepool_clouds.yaml.j2
index 576f4865e3..df7ffdea08 100644
--- a/playbooks/templates/clouds/nodepool_clouds.yaml.j2
+++ b/playbooks/templates/clouds/nodepool_clouds.yaml.j2
@@ -55,13 +55,10 @@ clouds:
               prefix: 'nodepool.task.raxflex-sjc3'
     auth:
       auth_url: 'https://keystone.api.sjc3.rackspacecloud.com/v3'
-      project_name: '{{ nodepool_rackspace_project }}_Flex'
-      project_domain_name: rackspace_cloud_domain
-      username: '{{ nodepool_rackspace_username }}'
-      password: '{{ nodepool_rackspace_key }}'
+      project_id: '{{ nodepool_raxflex_project }}'
+      username: '{{ nodepool_raxflex_username }}'
+      password: '{{ nodepool_raxflex_key }}'
       user_domain_name: rackspace_cloud_domain
-    interface: public
-    identity_api_version: '3'
   ovh:
     profile: ovh
     # OVH has a weird new ipv6 setup that we can't handle properly
diff --git a/playbooks/zuul/templates/group_vars/control-plane-clouds.yaml.j2 b/playbooks/zuul/templates/group_vars/control-plane-clouds.yaml.j2
index 4f280df4a1..6f41ea61c7 100644
--- a/playbooks/zuul/templates/group_vars/control-plane-clouds.yaml.j2
+++ b/playbooks/zuul/templates/group_vars/control-plane-clouds.yaml.j2
@@ -6,9 +6,15 @@ clouds:
   openstackci_rax_username: user
   openstackci_rax_key: apikey
   openstackci_rax_project_id: project
+  opendevci_raxflex_username: user
+  opendevci_raxflex_key: apikey
+  opendevci_raxflex_project_id: project
   openstackjenkins_rax_username: user
   openstackjenkins_rax_key: apikey
   openstackjenkins_rax_project_id: project
+  opendevzuul_raxflex_username: user
+  opendevzuul_raxflex_key: apikey
+  opendevzuul_raxflex_project_id: project
   openstackjenkins_ovh_username: user
   openstackjenkins_ovh_password: password
   openstackjenkins_ovh_project_name: project
diff --git a/playbooks/zuul/templates/group_vars/nodepool.yaml.j2 b/playbooks/zuul/templates/group_vars/nodepool.yaml.j2
index f62bf67cb9..bfbff90fa7 100644
--- a/playbooks/zuul/templates/group_vars/nodepool.yaml.j2
+++ b/playbooks/zuul/templates/group_vars/nodepool.yaml.j2
@@ -33,6 +33,9 @@ nodepool_rackspace_username: user
 nodepool_rackspace_key: apikey
 nodepool_rackspace_password: password
 nodepool_rackspace_project: project
+nodepool_raxflex_username: user
+nodepool_raxflex_key: apikey
+nodepool_raxflex_project: project
 nodepool_ovh_username: user
 nodepool_ovh_password: password
 nodepool_ovh_project: project