From e8f0306ec2bc8cdf4c27f55b8e860453d4618f83 Mon Sep 17 00:00:00 2001 From: Sharvari Khedkar Date: Mon, 12 May 2025 15:07:21 -0700 Subject: [PATCH] Add route_annotations feature to mesh ingress CRD (#2045) * Add route_annotations feature to mesh ingress CRD * update route_annotations type to string * display Route Annotations only when ingress_type=route --- config/crd/bases/awx.ansible.com_awxmeshingresses.yaml | 3 +++ .../manifests/bases/awx-operator.clusterserviceversion.yaml | 6 ++++++ roles/mesh_ingress/defaults/main.yml | 1 + roles/mesh_ingress/templates/ingress.yml.j2 | 3 +++ 4 files changed, 13 insertions(+) diff --git a/config/crd/bases/awx.ansible.com_awxmeshingresses.yaml b/config/crd/bases/awx.ansible.com_awxmeshingresses.yaml index 591604d7..c5a11e10 100644 --- a/config/crd/bases/awx.ansible.com_awxmeshingresses.yaml +++ b/config/crd/bases/awx.ansible.com_awxmeshingresses.yaml @@ -69,6 +69,9 @@ spec: ingress_annotations: description: Annotations to add to the Ingress Controller type: string + route_annotations: + description: Annotations to add to the OpenShift Route + type: string ingress_class_name: description: The name of ingress class to use instead of the cluster default. type: string diff --git a/config/manifests/bases/awx-operator.clusterserviceversion.yaml b/config/manifests/bases/awx-operator.clusterserviceversion.yaml index f63b7d1a..c493108d 100644 --- a/config/manifests/bases/awx-operator.clusterserviceversion.yaml +++ b/config/manifests/bases/awx-operator.clusterserviceversion.yaml @@ -50,6 +50,12 @@ spec: path: ingress_annotations x-descriptors: - urn:alm:descriptor:com.tectonic.ui:text + - displayName: Route Annotations + path: route_annotations + x-descriptors: + - 'urn:alm:descriptor:com.tectonic.ui:advanced' + - 'urn:alm:descriptor:com.tectonic.ui:text' + - 'urn:alm:descriptor:com.tectonic.ui:fieldDependency:ingress_type:Route' - displayName: Ingress Class Name path: ingress_class_name x-descriptors: diff --git a/roles/mesh_ingress/defaults/main.yml b/roles/mesh_ingress/defaults/main.yml index 20388a75..1b461b3d 100644 --- a/roles/mesh_ingress/defaults/main.yml +++ b/roles/mesh_ingress/defaults/main.yml @@ -6,6 +6,7 @@ ingress_api_version: 'networking.k8s.io/v1' ingress_annotations: '' ingress_class_name: '' ingress_controller: '' +route_annotations: '' set_self_owneref: true diff --git a/roles/mesh_ingress/templates/ingress.yml.j2 b/roles/mesh_ingress/templates/ingress.yml.j2 index aa6081ab..70af4997 100644 --- a/roles/mesh_ingress/templates/ingress.yml.j2 +++ b/roles/mesh_ingress/templates/ingress.yml.j2 @@ -67,6 +67,9 @@ kind: Route metadata: annotations: openshift.io/host.generated: "true" +{% if route_annotations %} + {{ route_annotations | indent(width=4) }} +{% endif %} name: {{ ansible_operator_meta.name }} namespace: "{{ ansible_operator_meta.namespace }}" spec: