From 4477aa33b82af773a439024f87e565f4b6856716 Mon Sep 17 00:00:00 2001 From: Gwynne Monahan Date: Wed, 24 Apr 2024 13:43:34 -0500 Subject: [PATCH] OSSM-3157 Update section Enabling automatic sidecar injection --- modules/ossm-automatic-sidecar-injection.adoc | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/modules/ossm-automatic-sidecar-injection.adoc b/modules/ossm-automatic-sidecar-injection.adoc index 6a610580cfaf..bc8fa7b8a1a7 100644 --- a/modules/ossm-automatic-sidecar-injection.adoc +++ b/modules/ossm-automatic-sidecar-injection.adoc @@ -7,7 +7,7 @@ [id="ossm-automatic-sidecar-injection_{context}"] = Enabling automatic sidecar injection -When deploying an application, you must opt-in to injection by configuring the annotation `sidecar.istio.io/inject` in `spec.template.metadata.annotations` to `true` in the `deployment` object. Opting in ensures that the sidecar injection does not interfere with other {product-title} features such as builder pods used by numerous frameworks within the {product-title} ecosystem. +When deploying an application, you must opt-in to injection by configuring the label `sidecar.istio.io/inject` in `spec.template.metadata.labels` to `true` in the `deployment` object. Opting in ensures that the sidecar injection does not interfere with other {product-title} features such as builder pods used by numerous frameworks within the {product-title} ecosystem. .Prerequisites @@ -22,16 +22,16 @@ When deploying an application, you must opt-in to injection by configuring the a $ oc get deployment -n ---- + -For example, to view the deployment file for the 'ratings-v1' microservice in the `bookinfo` namespace, use the following command to see the resource in YAML format. +For example, to view the `Deployment` YAML file for the 'ratings-v1' microservice in the `bookinfo` namespace, use the following command to see the resource in YAML format. + [source,terminal] ---- oc get deployment -n bookinfo ratings-v1 -o yaml ---- + -. Open the application's deployment configuration YAML file in an editor. +. Open the application's `Deployment` YAML file in an editor. -. Add `spec.template.metadata.annotations.sidecar.istio/inject` to your Deployment YAML and set `sidecar.istio.io/inject` to `true` as shown in the following example. +. Add `spec.template.metadata.labels.sidecar.istio/inject` to your Deployment YAML file and set `sidecar.istio.io/inject` to `true` as shown in the following example. + .Example snippet from bookinfo deployment-ratings-v1.yaml [source,yaml] @@ -47,11 +47,16 @@ metadata: spec: template: metadata: - annotations: + labels: sidecar.istio.io/inject: 'true' ---- + -. Save the Deployment configuration file. +[NOTE] +==== +Using the `annotations` parameter when enabling automatic sidecar injection is deprecated and is replaced by using the `labels` parameter. +==== ++ +. Save the `Deployment` YAML file. . Add the file back to the project that contains your app. +