From c77fab874826397a899c68427ced0abe1d36e241 Mon Sep 17 00:00:00 2001 From: Daniel Chadwick Date: Wed, 10 Dec 2025 13:21:48 -0500 Subject: [PATCH] osdocs17249 Label propogation from Ingress to Route resources --- .../nw-ingress-label-propagation-about.adoc | 27 +++++++ ...nw-ingress-label-propagation-enabling.adoc | 75 +++++++++++++++++++ .../routes/creating-basic-routes.adoc | 8 +- 3 files changed, 109 insertions(+), 1 deletion(-) create mode 100644 modules/nw-ingress-label-propagation-about.adoc create mode 100644 modules/nw-ingress-label-propagation-enabling.adoc diff --git a/modules/nw-ingress-label-propagation-about.adoc b/modules/nw-ingress-label-propagation-about.adoc new file mode 100644 index 0000000000..6c34cad6a7 --- /dev/null +++ b/modules/nw-ingress-label-propagation-about.adoc @@ -0,0 +1,27 @@ +// Module included in the following assemblies: +// +// * networking/routes/creating-basic-routes.adoc + +:_mod-docs-content-type: CONCEPT +[id="networking-ingress-label-propagation-about_{context}"] += About label propagation from Ingress to Route resources + +[role="_abstract"] +You can opt-in to a feature that enables the Ingress Operator to automatically propagate labels. This allows you to add metadata that helps track or manage resources, or to control specific behaviors that depend on labels. + +By default, the managed `Route` object does not inherit labels from the `Ingress` resource. When you enable the propagation feature, the Operator actively reconciles the labels on the generated `Route` resource to match the labels on the parent `Ingress` resource. + +[NOTE] +==== +When label propagation is enabled, the Ingress Operator replaces all labels on the managed `Route` resource with the exact set of labels from the parent `Ingress` resource. Any labels that were manually added to the `Route` resource are removed. +==== + +The propagation behavior is controlled by the `route.openshift.io/reconcile-labels` annotation on the `Ingress` resource. The Operator's behavior changes depending on the state of this annotation: + +* Annotation not present (default): The Operator does not sync labels from the `Ingress` resource to the `Route` resource. Any existing labels on the `Route` are preserved. + +* Annotation enabled (`route.openshift.io/reconcile-labels: "true"`): The Operator enables label propagation. On the next reconciliation (triggered by the `Ingress` create or update event), the Operator replaces all labels on the generated `Route` resource with the labels from the `Ingress` resource. + +* Annotation disabled (removed or value set to non-"true"): The Operator disables label propagation. The labels that currently exist on the `Route` resource are kept as-is, but the Operator no longer syncs them with the `Ingress` resource. + +* Annotation re-enabled: The Operator resumes propagation. It will again replace all labels on the `Route` resource with the current labels from the `Ingress` resource. \ No newline at end of file diff --git a/modules/nw-ingress-label-propagation-enabling.adoc b/modules/nw-ingress-label-propagation-enabling.adoc new file mode 100644 index 0000000000..360258db5a --- /dev/null +++ b/modules/nw-ingress-label-propagation-enabling.adoc @@ -0,0 +1,75 @@ +// Module included in the following assemblies: +// +// * networking/routes/creating-basic-routes.adoc + +:_mod-docs-content-type: PROCEDURE +[id="networking-ingress-label-propagation-enabling_{context}"] += Enabling label propagation from Ingress to Route resources + +[role="_abstract"] +You can enable the Ingress Operator to automatically propagate labels from an `Ingress` resource to the `Route` resource it manages. To enable this, you must add the `reconcile-labels` annotation to an `Ingress` resource. + +.Prerequisites + +* You have access to an {product-title} cluster. +* You have the `cluster-admin` role or permissions to create and edit `Ingress` resources in a project. + +.Procedure + +. Create or edit an `Ingress` resource manifest. + +. In the `metadata.annotations` section, add `route.openshift.io/reconcile-labels: "true"`. + +. In the `metadata.labels` section, add the labels you want to propagate. ++ +Example `Ingress` resource with label propagation enabled: ++ +[source,yaml] +---- +apiVersion: networking.k8s.io/v1 +kind: Ingress +metadata: + name: example-ingress + annotations: + route.openshift.io/reconcile-labels: "true" + labels: + app: my-app + owner: dev-team +spec: + ingressClassName: openshift-default + rules: + - host: example.com + http: + paths: + - backend: + service: + name: example-service + port: + number: 27017 + path: "/" + pathType: "Prefix" +---- + +. Apply the manifest to your cluster: ++ +[source,terminal] +---- +$ oc apply -f +---- ++ +Replace `` with the name of your specific manifest file. + +. Verify that the labels from the `Ingress` resource have propagated to the generated `Route` resource: ++ +[source,terminal] +---- +$ oc get route -l app=my-app --show-labels +---- ++ +Example output: ++ +[source,terminal] +---- +NAME HOST/PORT PATH SERVICES PORT TERMINATION WILDCARD LABELS +example-rt example.com / example-service 8080 None app=my-app,owner=dev-team +---- \ No newline at end of file diff --git a/networking/ingress_load_balancing/routes/creating-basic-routes.adoc b/networking/ingress_load_balancing/routes/creating-basic-routes.adoc index 977f782927..9361a57d90 100644 --- a/networking/ingress_load_balancing/routes/creating-basic-routes.adoc +++ b/networking/ingress_load_balancing/routes/creating-basic-routes.adoc @@ -20,4 +20,10 @@ include::modules/nw-ingress-sharding-route-configuration.adoc[leveloffset=+1] // Creating a route via an Ingress include::modules/nw-ingress-creating-a-route-via-an-ingress.adoc[leveloffset=+1] -endif::openshift-rosa,openshift-rosa-hcp,openshift-dedicated[] \ No newline at end of file +endif::openshift-rosa,openshift-rosa-hcp,openshift-dedicated[] + +//About label propogation +include::modules/nw-ingress-label-propagation-about.adoc[leveloffset=+1] + +//Enabling label propogation +include::modules/nw-ingress-label-propagation-enabling.adoc[leveloffset=+1] \ No newline at end of file