1
0
mirror of https://github.com/openshift/openshift-docs.git synced 2026-02-05 12:46:18 +01:00
Files
openshift-docs/modules/ossm-add-project-using-label-selectors-cli.adoc
2025-01-23 05:06:25 +00:00

59 lines
2.3 KiB
Plaintext

// Module included in the following assemblies:
//
// * service_mesh/v2x/installing-ossm.adoc
:_mod-docs-content-type: PROCEDURE
[id="ossm-adding-project-using-label-selectors-cli_{context}"]
= Adding a project to the mesh using label selectors with the CLI
You can use label selectors to add a project to the {SMProductShortName} with the CLI.
.Prerequisites
* You have installed the {SMProductName} Operator.
* The deployment has an existing `ServiceMeshMemberRoll` resource.
ifndef::openshift-rosa,openshift-rosa-hcp,openshift-dedicated[]
* You are logged in to {product-title} as`cluster-admin`.
endif::openshift-rosa,openshift-rosa-hcp,openshift-dedicated[]
ifdef::openshift-rosa,openshift-rosa-hcp,openshift-dedicated[]
* You are logged in to {product-title} as a user with the `dedicated-admin` role.
endif::openshift-rosa,openshift-rosa-hcp,openshift-dedicated[]
.Procedure
. Log in to the {product-title} CLI.
. Edit the `ServiceMeshMemberRoll` resource.
+
[source,terminal]
----
$ oc edit smmr default -n istio-system
----
+
You can deploy the {SMProductShortName} control plane to any project provided that it is separate from the project that contains your services.
. Modify the YAML file to include namespace label selectors in the `spec.memberSelectors` field of the `ServiceMeshMemberRoll` resource.
+
[NOTE]
====
Instead of using the `matchLabels` field, you can also use the `matchExpressions` field in the selector.
====
+
[source,yaml]
----
apiVersion: maistra.io/v1
kind: ServiceMeshMemberRoll
metadata:
name: default
namespace: istio-system
spec:
memberSelectors: <1>
- matchLabels: <2>
mykey: myvalue <2>
- matchLabels: <3>
myotherkey: myothervalue <3>
----
<1> Contains the label selectors used to identify which project namespaces are included in the service mesh. If a project namespace has either label specified by the selectors, then the project namespace is included in the service mesh. The project namespace does not need both labels to be included.
<2> Specifies all namespaces with the `mykey=myvalue` label. When the selector identifies a match, the project namespace is added to the service mesh.
<3> Specifies all namespaces with the `myotherkey=myothervalue` label. When the selector identifies a match, the project namespace is added to the service mesh.