Skip to content

Commit d708b10

Browse files
authored
Merge pull request #90791 from gwynnemonahan/OSSM-8954
OSSM-8954 Add use of IstioRevisionTag to sidecar injection page
2 parents f9eba5f + fa6d156 commit d708b10

File tree

2 files changed

+134
-1
lines changed

2 files changed

+134
-1
lines changed

install/ossm-sidecar-injection.adoc

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ To use {istio}’s capabilities within a service mesh, each pod needs a sidecar
1111
include::modules/ossm-about-sidecar-injection.adoc[leveloffset=+1]
1212
include::modules/ossm-identifying-revision-name.adoc[leveloffset=+1]
1313
include::modules/ossm-enabling-sidecar-injection.adoc[leveloffset=+1]
14+
include::modules/ossm-enabling-sidecar-injection-istio-revision-tag-resource.adoc[leveloffset=+1]
1415

1516

1617
[role="_additional-resources"]
@@ -19,4 +20,5 @@ include::modules/ossm-enabling-sidecar-injection.adoc[leveloffset=+1]
1920
* link:https://kubernetes.io/docs/reference/access-authn-authz/admission-controllers/[About admission controllers] (Kubernetes documentation)
2021
* link:https://istio.io/latest/docs/ops/common-problems/injection/[Istio sidecar injection problems] (Istio documentation)
2122
* xref:../install/ossm-installing-openshift-service-mesh.adoc#deploying-book-info_ossm-about-bookinfo-application[Deploying the Bookinfo application]
22-
* xref:../install/ossm-installing-openshift-service-mesh.adoc#ossm-scoping-service-mesh-with-discoveryselectors_ossm-creating-istiocni-resource[Scoping service mesh with discovery selectors]
23+
* xref:../install/ossm-installing-openshift-service-mesh.adoc#ossm-scoping-service-mesh-with-discoveryselectors_ossm-creating-istiocni-resource[Scoping the Service Mesh with discovery selectors]
24+
* xref:../about/ossm-about-concepts.adoc#istiorevisiontag-resource_ossm-about-concepts[IstioRevisionTag resource]
Lines changed: 131 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,131 @@
1+
// Module included in the following assemblies:
2+
// install/ossm-sidecar-injection
3+
4+
:_mod-docs-content-type: PROCEDURE
5+
[id="ossm-enabling-sidecar-injection-istio-revision-tag-resource_{context}"]
6+
= Enabling sidecar injection with namespace labels and an IstioRevisionTag resource
7+
8+
To use the `istio-injection=enabled` label when your revision name is not `default`, you must create an `IstioRevisionTag` resource with the name `default` that references your `Istio` resource.
9+
10+
//Prereqs lifted from existing content https://docs.redhat.com/en/documentation/red_hat_openshift_service_mesh/3.0/html/installing/ossm-sidecar-injection
11+
//any changes made will need to be part of refactoring Jira issue OSSM-9078 so content is consistent
12+
.Prerequisites
13+
14+
* You have installed the {SMProductName} Operator, created an `{istio}` resource, and the Operator has deployed {istio}.
15+
* You have created the `IstioCNI` resource, and the Operator has deployed the necessary `IstioCNI` pods.
16+
* You have created the namespaces that are to be part of the mesh, and they are discoverable by the {istio} control plane.
17+
* Optional: You have deployed the workloads to be included in the mesh. In the following examples, the Bookinfo has been deployed to the `bookinfo` namespace, but sidecar injection (step 5 in "Deploying the Bookinfo application" procedure) has not been configured. For more information, see "Deploying the Bookinfo application".
18+
19+
.Procedure
20+
21+
. Find the name of your `Istio` resource by running the following command:
22+
+
23+
[source,terminal]
24+
----
25+
$ oc get istio
26+
----
27+
+
28+
.Example output
29+
[source,terminal]
30+
----
31+
NAME REVISIONS READY IN USE ACTIVE REVISION STATUS VERSION AGE
32+
default 1 1 1 default-v1-24-3 Healthy v1.24.3 11s
33+
----
34+
+
35+
In this example, the `Istio` resource has the name `default`, but the underlying revision is called `default-v1-24-3`.
36+
37+
. Create the `IstioRevisionTag` resource in a YAML file:
38+
+
39+
.Example `IstioRevistionTag` resource YAML file
40+
[source,yaml]
41+
----
42+
apiVersion: sailoperator.io/v1
43+
kind: IstioRevisionTag
44+
metadata:
45+
name: default
46+
spec:
47+
targetRef:
48+
kind: Istio
49+
name: default
50+
----
51+
52+
. Apply the `IstioRevisionTag` resource by running the following command:
53+
+
54+
[source,terminal]
55+
----
56+
$ oc apply -f istioRevisionTag.yaml
57+
----
58+
59+
. Verify that the `IstioRevisionTag` resource has been created successfully by running the following command:
60+
+
61+
[source,terminal]
62+
----
63+
$ oc get istiorevisiontags.sailoperator.io
64+
----
65+
+
66+
.Example output
67+
[source,terminal]
68+
----
69+
NAME STATUS IN USE REVISION AGE
70+
default Healthy True default-v1-24-3 4m23s
71+
----
72+
+
73+
In this example, the new tag is referencing your active revision, `default-v1-24-3`. Now you can use the `istio-injection=enabled` label as if your revision was called `default`.
74+
+
75+
//lifted from existing content https://docs.redhat.com/en/documentation/red_hat_openshift_service_mesh/3.0/html/installing/ossm-sidecar-injection
76+
//any changes made will need to be part of refactoring Jira issue OSSM-9078 so content is consistent
77+
78+
. Confirm that the pods are running without sidecars by running the following command. Any workloads that are already running in the desired namespace should show `1/1` containers in the `READY` column.
79+
+
80+
[source,terminal]
81+
----
82+
$ oc get pods -n bookinfo
83+
----
84+
+
85+
.Example output
86+
[source,terminal]
87+
----
88+
NAME READY STATUS RESTARTS AGE
89+
details-v1-65cfcf56f9-gm6v7 1/1 Running 0 4m55s
90+
productpage-v1-d5789fdfb-8x6bk 1/1 Running 0 4m53s
91+
ratings-v1-7c9bd4b87f-6v7hg 1/1 Running 0 4m55s
92+
reviews-v1-6584ddcf65-6wqtw 1/1 Running 0 4m54s
93+
reviews-v2-6f85cb9b7c-w9l8s 1/1 Running 0 4m54s
94+
reviews-v3-6f5b775685-mg5n6 1/1 Running 0 4m54s
95+
----
96+
97+
. Apply the injection label to the `bookinfo` namespace by running the following command:
98+
+
99+
[source,terminal]
100+
----
101+
$ oc label namespace bookinfo istio-injection=enabled \
102+
namespace/bookinfo labeled
103+
----
104+
105+
. To ensure sidecar injection is applied, redeploy the workloads in the `bookinfo` namespace by running the following command:
106+
+
107+
[source,terminal]
108+
----
109+
$ oc -n bookinfo rollout restart deployments
110+
----
111+
112+
.Verification
113+
114+
. Verify the rollout by running the following command and confirming that the new pods display `2/2` containers in the `READY` column:
115+
+
116+
[source,terminal]
117+
----
118+
$ oc get pods -n bookinfo
119+
----
120+
+
121+
.Example output
122+
[source,terminal]
123+
----
124+
NAME READY STATUS RESTARTS AGE
125+
details-v1-7745f84ff-bpf8f 2/2 Running 0 55s
126+
productpage-v1-54f48db985-gd5q9 2/2 Running 0 55s
127+
ratings-v1-5d645c985f-xsw7p 2/2 Running 0 55s
128+
reviews-v1-bd5f54b8c-zns4v 2/2 Running 0 55s
129+
reviews-v2-5d7b9dbf97-wbpjr 2/2 Running 0 55s
130+
reviews-v3-5fccc48c8c-bjktn 2/2 Running 0 55s
131+
----

0 commit comments

Comments
 (0)