mirror of
https://github.com/openshift/openshift-docs.git
synced 2026-02-05 12:46:18 +01:00
osdocs17249 Label propogation from Ingress to Route resources
This commit is contained in:
committed by
openshift-cherrypick-robot
parent
1102f7f0c4
commit
c77fab8748
27
modules/nw-ingress-label-propagation-about.adoc
Normal file
27
modules/nw-ingress-label-propagation-about.adoc
Normal file
@@ -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.
|
||||
75
modules/nw-ingress-label-propagation-enabling.adoc
Normal file
75
modules/nw-ingress-label-propagation-enabling.adoc
Normal file
@@ -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 <example-ingress-manifest.yaml>
|
||||
----
|
||||
+
|
||||
Replace `<example-ingress-manifest.yaml>` 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
|
||||
----
|
||||
@@ -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[]
|
||||
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]
|
||||
Reference in New Issue
Block a user