From 4d40c9e68f0712ed543a870095c6e66c0fb67e4c Mon Sep 17 00:00:00 2001
From: Will Szumski <will@stackhpc.com>
Date: Thu, 22 Feb 2024 15:50:00 +0000
Subject: [PATCH] Adds feature flag for ironic-inspector in bifrost

This is useful for backwards compatability.

Depends-On: https://review.opendev.org/c/openstack/kolla/+/909865
Change-Id: Ib2936580db5e7ab3479722bc353c39063010b5f2
---
 ansible/roles/bifrost/defaults/main.yml                  | 7 +++++++
 ansible/roles/bifrost/templates/bifrost.yml.j2           | 3 +++
 ...ironic-inspector-in-bifrost.yml-12215fb9b1f09528.yaml | 9 +++++++++
 3 files changed, 19 insertions(+)
 create mode 100644 releasenotes/notes/expose-flag-to-enable-ironic-inspector-in-bifrost.yml-12215fb9b1f09528.yaml

diff --git a/ansible/roles/bifrost/defaults/main.yml b/ansible/roles/bifrost/defaults/main.yml
index c64f939a4..8143d36b6 100644
--- a/ansible/roles/bifrost/defaults/main.yml
+++ b/ansible/roles/bifrost/defaults/main.yml
@@ -11,3 +11,10 @@ bifrost_deploy_image_full: "{{ bifrost_deploy_image }}:{{ bifrost_deploy_tag }}"
 bifrost_deploy_container_proxy: "{{ container_proxy }}"
 
 bifrost_deploy_verbosity: "-vvvv"
+
+# Whether to enable the legacy ironic-inspector service
+# NOTE(wszumski): Bifrost plans to remove this option once the native in-band
+# inspection reaches feature parity. Please see:
+# https://bugs.launchpad.net/kolla/+bug/2054685 which contains links for
+# tracking the progress.
+bifrost_enable_ironic_inspector: true
diff --git a/ansible/roles/bifrost/templates/bifrost.yml.j2 b/ansible/roles/bifrost/templates/bifrost.yml.j2
index 07f5c3e57..f2174cb20 100644
--- a/ansible/roles/bifrost/templates/bifrost.yml.j2
+++ b/ansible/roles/bifrost/templates/bifrost.yml.j2
@@ -33,3 +33,6 @@ generate_tls: true
 # NOTE: Needs to be world-readable, writeable by root, and persistent, which
 # the default /etc/bifrost is not.
 tls_root: "/etc/bifrost-certs"
+
+# Whether to enable the legacy ironic-inspector service.
+enable_inspector: "{{ bifrost_enable_ironic_inspector }}"
diff --git a/releasenotes/notes/expose-flag-to-enable-ironic-inspector-in-bifrost.yml-12215fb9b1f09528.yaml b/releasenotes/notes/expose-flag-to-enable-ironic-inspector-in-bifrost.yml-12215fb9b1f09528.yaml
new file mode 100644
index 000000000..09620ef6a
--- /dev/null
+++ b/releasenotes/notes/expose-flag-to-enable-ironic-inspector-in-bifrost.yml-12215fb9b1f09528.yaml
@@ -0,0 +1,9 @@
+---
+features:
+  - |
+    Exposes a flag, ``bifrost_enable_ironic_inspector``, to enable
+    ironic-inspector in Bifrost. This option defaults to ``True`` as it can be
+    useful for backwards compatability. It is still possible to use native
+    in-band inspection when Ironic Inspector is enabled by setting
+    ``inspect_interface`` to ``agent``. Please see the Ironic documentation for
+    more details.
-- 
GitLab