From 84602e0ec8da34c3c73dca78c2b8f0d5df5ae6ea Mon Sep 17 00:00:00 2001 From: Chandan Kumar Date: Mon, 4 Nov 2024 20:53:29 +0530 Subject: [PATCH] Build OpenStack Watcher Container This pull request: * Builds OpenStack Watcher containers * Add python-watcherclient package to openstackclient container * Add openstack-watcher-ui package to horizon container Note: python-watcherclient and openstack-watcher-ui is not available in downstream currently. It is available in CentOS Stream with RDO antelope release. That's why we have added these packages under tcib_distro conditional to avoid breakage downstream. Jira: https://issues.redhat.com/browse/OSPRH-11085 Co-authored-by: Alfredo Moralejo Signed-off-by: Chandan Kumar --- container-images/containers.yaml | 3 +++ container-images/kolla/base/uid_gid_manage.sh | 1 + container-images/kolla/horizon/extend_start.sh | 13 +++++++++++++ .../tcib/base/openstackclient/openstackclient.yaml | 3 +++ container-images/tcib/base/os/horizon/horizon.yaml | 3 +++ .../os/watcher-base/watcher-api/watcher-api.yaml | 10 ++++++++++ .../watcher-applier/watcher-applier.yaml | 6 ++++++ .../tcib/base/os/watcher-base/watcher-base.yaml | 6 ++++++ .../watcher-decision-engine.yaml | 6 ++++++ 9 files changed, 51 insertions(+) create mode 100644 container-images/tcib/base/os/watcher-base/watcher-api/watcher-api.yaml create mode 100644 container-images/tcib/base/os/watcher-base/watcher-applier/watcher-applier.yaml create mode 100644 container-images/tcib/base/os/watcher-base/watcher-base.yaml create mode 100644 container-images/tcib/base/os/watcher-base/watcher-decision-engine/watcher-decision-engine.yaml diff --git a/container-images/containers.yaml b/container-images/containers.yaml index bb548af0..0cdfe50f 100644 --- a/container-images/containers.yaml +++ b/container-images/containers.yaml @@ -77,3 +77,6 @@ container_images: - imagename: quay.io/podified-master-centos9/openstack-tempest-extras:current-podified - imagename: quay.io/podified-master-centos9/openstack-tobiko:current-podified - imagename: quay.io/podified-master-centos9/openstack-openstackclient:current-podified +- imagename: quay.io/podified-master-centos9/openstack-watcher-api:current-podified +- imagename: quay.io/podified-master-centos9/openstack-watcher-applier:current-podified +- imagename: quay.io/podified-master-centos9/openstack-watcher-decision-engine:current-podified diff --git a/container-images/kolla/base/uid_gid_manage.sh b/container-images/kolla/base/uid_gid_manage.sh index 4a9fe49c..cd82027c 100755 --- a/container-images/kolla/base/uid_gid_manage.sh +++ b/container-images/kolla/base/uid_gid_manage.sh @@ -71,6 +71,7 @@ _SUPPORTED_USERS['tempest']='tempest 42480 42480 /var/lib/tempest kolla' _SUPPORTED_USERS['tobiko']='tobiko 42495 42495 /var/lib/tobiko kolla' _SUPPORTED_USERS['tss']='tss 59 59' _SUPPORTED_USERS['ansible']='ansible 227 227 /var/lib/ansible kolla' +_SUPPORTED_USERS['watcher']='watcher 42451 42451 /var/lib/watcher kolla' for _USER_TO_CREATE in $_USERS_TO_CREATE; do # Initialize computed args diff --git a/container-images/kolla/horizon/extend_start.sh b/container-images/kolla/horizon/extend_start.sh index e4feae2d..eb3068b9 100644 --- a/container-images/kolla/horizon/extend_start.sh +++ b/container-images/kolla/horizon/extend_start.sh @@ -80,6 +80,18 @@ function config_octavia_dashboard { "${SITE_PACKAGES}/openstack_dashboard/local/enabled/_1482_project_load_balancer_panel.py" } +function config_watcher_dashboard { + for file in ${SITE_PACKAGES}/watcher_dashboard/local/enabled/_*[^__].py; do + config_dashboard "${ENABLE_WATCHER}" \ + "${SITE_PACKAGES}/watcher_dashboard/local/enabled/${file##*/}" \ + "${SITE_PACKAGES}/openstack_dashboard/local/enabled/${file##*/}" + done + + config_dashboard "${ENABLE_WATCHER}" \ + "${SITE_PACKAGES}/watcher_dashboard/conf/watcher_policy.json" \ + "/etc/openstack-dashboard/watcher_policy.json" +} + # Regenerate the compressed javascript and css if any configuration files have # changed. Use a static modification date when generating the tarball # so that we only trigger on content changes. @@ -105,6 +117,7 @@ config_heat_dashboard config_ironic_dashboard config_manila_ui config_octavia_dashboard +config_watcher_dashboard if settings_changed; then ${MANAGE_PY} collectstatic --noinput --clear diff --git a/container-images/tcib/base/openstackclient/openstackclient.yaml b/container-images/tcib/base/openstackclient/openstackclient.yaml index 807d6800..078f69d4 100644 --- a/container-images/tcib/base/openstackclient/openstackclient.yaml +++ b/container-images/tcib/base/openstackclient/openstackclient.yaml @@ -1,6 +1,9 @@ tcib_actions: - run: rm -rf /home/cloud-admin && bash /usr/local/bin/uid_gid_manage {{ tcib_user }} - run: dnf -y install {{ tcib_packages['common'] | join(' ') }} && dnf clean all && rm -rf /var/cache/dnf +# Note(chandankumar): Remove it once python3-watcherclient is available downstream +- run: >- + if [ '{{ tcib_distro }}' == 'centos' ];then dnf -y install python3-watcherclient && dnf clean all && rm -rf /var/cache/dnf; fi - run: openstack complete | tee /etc/bash_completion.d/osc.bash_completion > /dev/null - run: baremetal complete | tee /etc/bash_completion.d/baremetal.bash_completion > /dev/null # ensure "oc rsh" uses bash by default diff --git a/container-images/tcib/base/os/horizon/horizon.yaml b/container-images/tcib/base/os/horizon/horizon.yaml index 2c9ae51f..ba290504 100644 --- a/container-images/tcib/base/os/horizon/horizon.yaml +++ b/container-images/tcib/base/os/horizon/horizon.yaml @@ -5,6 +5,9 @@ tcib_actions: mv /tmp/macros.image-language-conf /etc/rpm && dnf -y install {{ tcib_packages.common | join(' ') }} && dnf clean all && rm -rf /var/cache/dnf +# Note(chandankumar): Remove it once openstack-watcher-ui package is available downstream. +- run: >- + if [ '{{ tcib_distro }}' == 'centos' ];then dnf -y install openstack-watcher-ui && dnf clean all && rm -rf /var/cache/dnf; fi - run: cp /usr/share/tcib/container-images/kolla/horizon/extend_start.sh /usr/local/bin/kolla_extend_start - run: chmod 755 /usr/local/bin/kolla_extend_start - run: >- diff --git a/container-images/tcib/base/os/watcher-base/watcher-api/watcher-api.yaml b/container-images/tcib/base/os/watcher-base/watcher-api/watcher-api.yaml new file mode 100644 index 00000000..519dc4fc --- /dev/null +++ b/container-images/tcib/base/os/watcher-base/watcher-api/watcher-api.yaml @@ -0,0 +1,10 @@ +tcib_actions: +- run: dnf -y install {{ tcib_packages['common'] | join(' ') }} && dnf clean all && rm -rf /var/cache/dnf +- run: sed -i -r 's,^(Listen 80),#\1,' /etc/httpd/conf/httpd.conf && sed -i -r 's,^(Listen 443),#\1,' /etc/httpd/conf.d/ssl.conf +tcib_packages: + common: + - openstack-watcher-api + - httpd + - mod_ssl + - python3-mod_wsgi +tcib_user: watcher diff --git a/container-images/tcib/base/os/watcher-base/watcher-applier/watcher-applier.yaml b/container-images/tcib/base/os/watcher-base/watcher-applier/watcher-applier.yaml new file mode 100644 index 00000000..d6cdfd41 --- /dev/null +++ b/container-images/tcib/base/os/watcher-base/watcher-applier/watcher-applier.yaml @@ -0,0 +1,6 @@ +tcib_actions: +- run: dnf -y install {{ tcib_packages['common'] | join(' ') }} && dnf clean all && rm -rf /var/cache/dnf +tcib_packages: + common: + - openstack-watcher-applier +tcib_user: watcher diff --git a/container-images/tcib/base/os/watcher-base/watcher-base.yaml b/container-images/tcib/base/os/watcher-base/watcher-base.yaml new file mode 100644 index 00000000..ae831f7b --- /dev/null +++ b/container-images/tcib/base/os/watcher-base/watcher-base.yaml @@ -0,0 +1,6 @@ +tcib_actions: +- run: bash /usr/local/bin/uid_gid_manage watcher +- run: dnf -y install {{ tcib_packages['common'] | join(' ') }} && dnf clean all && rm -rf /var/cache/dnf +tcib_packages: + common: + - openstack-watcher-common diff --git a/container-images/tcib/base/os/watcher-base/watcher-decision-engine/watcher-decision-engine.yaml b/container-images/tcib/base/os/watcher-base/watcher-decision-engine/watcher-decision-engine.yaml new file mode 100644 index 00000000..fdecb1ae --- /dev/null +++ b/container-images/tcib/base/os/watcher-base/watcher-decision-engine/watcher-decision-engine.yaml @@ -0,0 +1,6 @@ +tcib_actions: +- run: dnf -y install {{ tcib_packages['common'] | join(' ') }} && dnf clean all && rm -rf /var/cache/dnf +tcib_packages: + common: + - openstack-watcher-decision-engine +tcib_user: watcher