mirror of
https://github.com/openshift/openshift-docs.git
synced 2026-02-05 12:46:18 +01:00
75 lines
2.0 KiB
Plaintext
75 lines
2.0 KiB
Plaintext
// 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
|
|
---- |