// Module included in the following assemblies:
//
// * configuring_ingress_cluster_traffic/configuring-ingress-cluster-traffic-ingress-controller.adoc
// * ingress-operator.adoc

[id="nw-ingress-sharding-namespace-labels_{context}"]
= Configuring ingress controller sharding by using namespace labels

Ingress Controller sharding by using namespace labels means that the Ingress
Controller serves any route in any namespace that is selected by the namespace
selector.

Ingress Controller sharding is useful when balancing incoming traffic load among
a set of Ingress Controllers and when isolating traffic to a specific Ingress
Controller. For example, company A goes to one Ingress Controller and company B
to another.

.Procedure

. Edit the `router-internal.yaml` file:
+
----
# cat router-internal.yaml
apiVersion: v1
items:
- apiVersion: operator.openshift.io/v1
  kind: IngressController
  metadata:
    name: sharded
    namespace: openshift-ingress-operator
  spec:
    domain: <apps-sharded.basedomain.example.net>
    nodePlacement:
      nodeSelector:
        matchLabels:
          node-role.kubernetes.io/worker: ""
    routeSelector:
      matchLabels:
        type: sharded
  status: {}
kind: List
metadata:
  resourceVersion: ""
  selfLink: ""
----

. Apply the Ingress Controller `router-internal.yaml` file:
+
----
# oc apply -f router-internal.yaml
----
+
The Ingress Controller selects routes in any namespace that is selected by the
namespace selector that have the label `type: sharded`.

// Module included in the following assemblies:
//
// * configuring_ingress_cluster_traffic/configuring-ingress-cluster-traffic-ingress-controller.adoc
// * ingress-operator.adoc

[id="nw-ingress-sharding-namespace-labels_{context}"]
= Configuring ingress controller sharding by using namespace labels

Ingress Controller sharding by using namespace labels means that the Ingress
Controller serves any route in any namespace that is selected by the namespace
selector.

Ingress Controller sharding is useful when balancing incoming traffic load among
a set of Ingress Controllers and when isolating traffic to a specific Ingress
Controller. For example, company A goes to one Ingress Controller and company B
to another.

.Procedure

. Edit the `router-internal.yaml` file:
+
----
# cat router-internal.yaml
apiVersion: v1
items:
- apiVersion: operator.openshift.io/v1
  kind: IngressController
  metadata:
    name: sharded
    namespace: openshift-ingress-operator
  spec:
    domain: <apps-sharded.basedomain.example.net>
    nodePlacement:
      nodeSelector:
        matchLabels:
          node-role.kubernetes.io/worker: ""
    namespaceSelector:
      matchLabels:
        type: sharded
  status: {}
kind: List
metadata:
  resourceVersion: ""
  selfLink: ""
----

. Apply the Ingress Controller `router-internal.yaml` file:
+
----
# oc apply -f router-internal.yaml
----
+
The Ingress Controller selects routes in any namespace that is selected by the
namespace selector that have the label `type: sharded`.

Fix example for ingress sharding by namespace
Fix example for ingress sharding by namespace

Follow-up to commit 69c879f8edaceb4f679eca3f475f0d9851e460c6.

* modules/nw-ingress-sharding-namespace-labels.adoc: Change routeSelector
to namespaceSelector.
