You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: modules/ossm-automatic-sidecar-injection.adoc
+11-6
Original file line number
Diff line number
Diff line change
@@ -7,7 +7,7 @@
7
7
[id="ossm-automatic-sidecar-injection_{context}"]
8
8
= Enabling automatic sidecar injection
9
9
10
-
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.
10
+
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.
11
11
12
12
.Prerequisites
13
13
@@ -22,16 +22,16 @@ When deploying an application, you must opt-in to injection by configuring the a
22
22
$ oc get deployment -n <namespace>
23
23
----
24
24
+
25
-
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.
25
+
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.
26
26
+
27
27
[source,terminal]
28
28
----
29
29
oc get deployment -n bookinfo ratings-v1 -o yaml
30
30
----
31
31
+
32
-
. Open the application's deployment configuration YAML file in an editor.
32
+
. Open the application's `Deployment` YAML file in an editor.
33
33
34
-
. 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.
34
+
. 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.
35
35
+
36
36
.Example snippet from bookinfo deployment-ratings-v1.yaml
37
37
[source,yaml]
@@ -47,11 +47,16 @@ metadata:
47
47
spec:
48
48
template:
49
49
metadata:
50
-
annotations:
50
+
labels:
51
51
sidecar.istio.io/inject: 'true'
52
52
----
53
53
+
54
-
. Save the Deployment configuration file.
54
+
[NOTE]
55
+
====
56
+
Using the `annotations` parameter when enabling automatic sidecar injection is deprecated and is replaced by using the `labels` parameter.
57
+
====
58
+
+
59
+
. Save the `Deployment` YAML file.
55
60
56
61
. Add the file back to the project that contains your app.
0 commit comments