From 9e2d9f6aefce653f54d35ae5174b4f9d7ce0866e Mon Sep 17 00:00:00 2001 From: Ian Wienand Date: Fri, 25 Nov 2022 10:15:13 +1100 Subject: [PATCH] bridge: switch OSC from container to local install Currently "openstack" command on bridge doesn't work, because we need cinder client pinned to an older version for RAX support. The upstream container uses the latest versions of everything and it fails to parse the "volume_api_version: 2" pin for RAX in the config file. In general, the version of openstackclient we can probably most likely rely on to work is the one from the launch-node virtualenv. It also means we just have one place to manage a broadly-compatible version, instead of trying to manage versions in separate containers, etc. This converts the /usr/local/bin/openstack command from calling into the container, to calling into the launch venv. Change-Id: I604d5c17268a8219d51d432ba21feeb2e752a693 --- .../roles/install-launch-node/tasks/main.yaml | 11 ++++++++++ .../roles/install-osc-container/README.rst | 1 - .../install-osc-container/files/openstack | 20 ------------------- .../install-osc-container/tasks/main.yaml | 8 -------- playbooks/service-bridge.yaml | 2 -- testinfra/test_bridge.py | 5 +++++ 6 files changed, 16 insertions(+), 31 deletions(-) delete mode 100644 playbooks/roles/install-osc-container/README.rst delete mode 100644 playbooks/roles/install-osc-container/files/openstack delete mode 100644 playbooks/roles/install-osc-container/tasks/main.yaml diff --git a/playbooks/roles/install-launch-node/tasks/main.yaml b/playbooks/roles/install-launch-node/tasks/main.yaml index 9927006f66..8a2c8dba9b 100644 --- a/playbooks/roles/install-launch-node/tasks/main.yaml +++ b/playbooks/roles/install-launch-node/tasks/main.yaml @@ -9,3 +9,14 @@ name: 'file:///home/zuul/src/opendev.org/opendev/system-config/launch' virtualenv: '/usr/launcher-venv' +# Admins use openstackclient on the bastion host to deal with cloud +# issues. The best version to use is the one from launch node, as +# whatever workarounds we need to talk to all clouds should be in that +# environment. For convenience link this version globally +- name: Link openstack client globally + file: + src: /usr/launcher-venv/bin/openstack + dest: /usr/local/bin/openstack + owner: root + group: root + state: link diff --git a/playbooks/roles/install-osc-container/README.rst b/playbooks/roles/install-osc-container/README.rst deleted file mode 100644 index 5d2e77e6e9..0000000000 --- a/playbooks/roles/install-osc-container/README.rst +++ /dev/null @@ -1 +0,0 @@ -An ansible role to install openstackclient container and helper script diff --git a/playbooks/roles/install-osc-container/files/openstack b/playbooks/roles/install-osc-container/files/openstack deleted file mode 100644 index 7ff8057739..0000000000 --- a/playbooks/roles/install-osc-container/files/openstack +++ /dev/null @@ -1,20 +0,0 @@ -#!/bin/bash -# Copyright (c) 2020 Red Hat, Inc. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or -# implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -exec docker run -it --rm \ - -v/etc/openstack:/etc/openstack \ - docker.io/osclient/python-openstackclient \ - openstack $@ diff --git a/playbooks/roles/install-osc-container/tasks/main.yaml b/playbooks/roles/install-osc-container/tasks/main.yaml deleted file mode 100644 index f821e8cbd9..0000000000 --- a/playbooks/roles/install-osc-container/tasks/main.yaml +++ /dev/null @@ -1,8 +0,0 @@ -- name: Add helper script - become: yes - copy: - dest: /usr/local/bin/openstack - group: root - mode: 0755 - owner: root - src: openstack diff --git a/playbooks/service-bridge.yaml b/playbooks/service-bridge.yaml index 27354700e5..d548db2ea0 100644 --- a/playbooks/service-bridge.yaml +++ b/playbooks/service-bridge.yaml @@ -12,8 +12,6 @@ - name: Install openshift/kubectl when: ansible_architecture != 'aarch64' block: - - include_role: - name: install-osc-container - include_role: name: install-kubectl - include_role: diff --git a/testinfra/test_bridge.py b/testinfra/test_bridge.py index 6685953396..3b0d548bb8 100644 --- a/testinfra/test_bridge.py +++ b/testinfra/test_bridge.py @@ -112,3 +112,8 @@ def test_launch_node_venv(host): launch = host.run('/usr/launcher-venv/bin/launch-node --help') assert 'usage: launch-node' in launch.stdout assert launch.rc == 0 + +def test_osc_binary(host): + osc = host.run('/usr/launcher-venv/bin/openstack --version') + assert 'openstack' in osc.stdout + assert osc.rc == 0