<commit_before>// Module included in the following assemblies:
//
// * operators/understanding-olm/olm-understanding-operatorgroups.adoc

[id="olm-operatorgroups-target-namespace_{context}"]
= Target namespace selection

The set of namespaces for the OperatorGroup is specified using a label selector
with the `spec.selector` field:

[source,yaml]
----
apiVersion: operators.coreos.com/v1
kind: OperatorGroup
metadata:
  name: my-group
  namespace: my-namespace
  spec:
    selector:
      matchLabels:
        cool.io/prod: "true"
----

You can also explicitly name the target namespaces using the
`spec.targetNamespaces` field:

[source,yaml]
----
apiVersion: operators.coreos.com/v1
kind: OperatorGroup
metadata:
  name: my-group
  namespace: my-namespace
spec:
  targetNamespaces:
  - my-namespace
  - my-other-namespace
  - my-other-other-namespace
----

[NOTE]
====
If both `spec.targetNamespaces` and `spec.selector` are defined, `spec.selector`
is ignored.
====

Alternatively, you can omit both `spec.selector` and `spec.targetNamespaces` to
specify a _global_ OperatorGroup, which selects all namespaces:

[source,yaml]
----
apiVersion: operators.coreos.com/v1
kind: OperatorGroup
metadata:
  name: my-group
  namespace: my-namespace
----

The resolved set of selected namespaces is shown in an OperatorGroup's
`status.namespaces` field. A global OperatorGroup's `status.namespace` contains
the empty string (`""`), which signals to a consuming Operator that it should
watch all namespaces.<commit_msg>Rm multinamespace ex from OperatorGroups (#19149)<commit_after>// Module included in the following assemblies:
//
// * operators/understanding-olm/olm-understanding-operatorgroups.adoc

[id="olm-operatorgroups-target-namespace_{context}"]
= Target namespace selection

You can explicitly name the target namespace for an OperatorGroup using the
`spec.targetNamespaces` parameter:

[source,yaml]
----
apiVersion: operators.coreos.com/v1
kind: OperatorGroup
metadata:
  name: my-group
  namespace: my-namespace
spec:
  targetNamespaces:
  - my-namespace
----

You can alternatively specify a namespace using a label selector with the
`spec.selector` parameter:

[source,yaml]
----
apiVersion: operators.coreos.com/v1
kind: OperatorGroup
metadata:
  name: my-group
  namespace: my-namespace
  spec:
    selector:
      cool.io/prod: "true"
----

[IMPORTANT]
====
Listing multiple namespaces via `spec.targetNamespaces` or use of a label
selector via `spec.selector` is not recommended, as the support for more than
one target namespace in an OperatorGroup will likely be removed in a future
release.
====

If both `spec.targetNamespaces` and `spec.selector` are defined, `spec.selector`
is ignored. Alternatively, you can omit both `spec.selector` and
`spec.targetNamespaces` to specify a _global_ OperatorGroup, which selects all
namespaces:

[source,yaml]
----
apiVersion: operators.coreos.com/v1
kind: OperatorGroup
metadata:
  name: my-group
  namespace: my-namespace
----

The resolved set of selected namespaces is shown in an OperatorGroup's
`status.namespaces` parameter. A global OperatorGroup's `status.namespace` contains
the empty string (`""`), which signals to a consuming Operator that it should
watch all namespaces.
{'fraction_non_alphanumeric': 0.1027460660290034, 'fraction_numerical': 0.003394014193150262, 'mean_word_length': 4.532423208191126, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3741834', 'n_tokens_mistral': 969, 'n_tokens_neox': 922, 'n_words': 320}