Skip to content

Commit 70faf2d

Browse files
Michael Burkeopenshift-cherrypick-robot
authored andcommitted
OSDOCS10896: Update Custom Metrics Autoscaler documentation for ClusterTriggerAuthentication implementation
1 parent 2305c76 commit 70faf2d

File tree

2 files changed

+46
-23
lines changed

2 files changed

+46
-23
lines changed

modules/nodes-cma-autoscaling-custom-prometheus-config.adoc

Lines changed: 41 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@
88

99
You can use the installed {product-title} Prometheus monitoring as a source for the metrics used by the custom metrics autoscaler. However, there are some additional configurations you must perform.
1010

11+
For your scaled objects to be able to read the {product-title} Prometheus metrics, you must use a trigger authentication or a cluster trigger authentication in order to provide the authentication information required. The following procedure differs depending on which trigger authentication method you use. For more information on trigger authentications, see "Understanding custom metrics autoscaler trigger authentications".
12+
1113
[NOTE]
1214
====
1315
These steps are not required for an external Prometheus source.
@@ -32,12 +34,16 @@ You must perform the following tasks, as described in this section:
3234
3335
.Procedure
3436

35-
. Change to the project with the object you want to scale:
37+
. Change to the appropriate project:
3638
+
3739
[source,terminal]
3840
----
39-
$ oc project my-project
41+
$ oc project <project_name> <1>
4042
----
43+
<1> Specifies one of the following projects:
44+
+
45+
* If you are using a trigger authentication, specify the project with the object you want to scale.
46+
* If you are using a cluster trigger authentication, specify the `openshift-keda` project.
4147

4248
. Create a service account and token, if your cluster does not have one:
4349

@@ -47,7 +53,6 @@ $ oc project my-project
4753
----
4854
$ oc create serviceaccount thanos <1>
4955
----
50-
+
5156
<1> Specifies the name of the service account.
5257

5358
.. Optional: Create a `secret` YAML to generate a service account token:
@@ -67,7 +72,6 @@ metadata:
6772
kubernetes.io/service-account.name: thanos <1>
6873
type: kubernetes.io/service-account-token
6974
----
70-
+
7175
<1> Specifies the name of the service account.
7276

7377
.. Create the secret object by using the following command:
@@ -91,7 +95,7 @@ $ oc describe serviceaccount thanos <1>
9195
[source,terminal]
9296
----
9397
Name: thanos
94-
Namespace: my-project
98+
Namespace: <namespace_name>
9599
Labels: <none>
96100
Annotations: <none>
97101
Image pull secrets: thanos-dockercfg-nnwgj
@@ -110,22 +114,27 @@ Events: <none>
110114
[source,yaml]
111115
----
112116
apiVersion: keda.sh/v1alpha1
113-
kind: TriggerAuthentication
117+
kind: <authentication_method> <1>
114118
metadata:
115119
name: keda-trigger-auth-prometheus
116120
spec:
117-
secretTargetRef: <1>
118-
- parameter: bearerToken <2>
119-
name: thanos-token <3>
120-
key: token <4>
121+
secretTargetRef: <2>
122+
- parameter: bearerToken <3>
123+
name: thanos-token <4>
124+
key: token <5>
121125
- parameter: ca
122126
name: thanos-token
123127
key: ca.crt
124128
----
125-
<1> Specifies that this object uses a secret for authorization.
126-
<2> Specifies the authentication parameter to supply by using the token.
127-
<3> Specifies the name of the token to use.
128-
<4> Specifies the key in the token to use with the specified parameter.
129+
<1> Specifies one of the following trigger authentication methods:
130+
+
131+
* If you are using a trigger authentication, specify `TriggerAuthentication`. This example configures a trigger authentication.
132+
* If you are using a cluster trigger authentication, specify `ClusterTriggerAuthentication`.
133+
+
134+
<2> Specifies that this object uses a secret for authorization.
135+
<3> Specifies the authentication parameter to supply by using the token.
136+
<4> Specifies the name of the token to use.
137+
<5> Specifies the key in the token to use with the specified parameter.
129138

130139
.. Create the CR object:
131140
+
@@ -176,23 +185,32 @@ $ oc create -f <file-name>.yaml
176185
[source,yaml]
177186
----
178187
apiVersion: rbac.authorization.k8s.io/v1
179-
kind: RoleBinding
188+
kind: <binding_type> <1>
180189
metadata:
181-
name: thanos-metrics-reader <1>
182-
namespace: my-project <2>
190+
name: thanos-metrics-reader <2>
191+
namespace: my-project <3>
183192
roleRef:
184193
apiGroup: rbac.authorization.k8s.io
185194
kind: Role
186195
name: thanos-metrics-reader
187196
subjects:
188197
- kind: ServiceAccount
189-
name: thanos <3>
190-
namespace: my-project <4>
198+
name: thanos <4>
199+
namespace: <namespace_name> <5>
191200
----
192-
<1> Specifies the name of the role you created.
193-
<2> Specifies the namespace of the object you want to scale.
194-
<3> Specifies the name of the service account to bind to the role.
195-
<4> Specifies the namespace of the object you want to scale.
201+
<1> Specifies one of the following object types:
202+
+
203+
* If you are using a trigger authentication, specify `RoleBinding`.
204+
* If you are using a cluster trigger authentication, specify `ClusterRoleBinding`.
205+
+
206+
<2> Specifies the name of the role you created.
207+
<3> Specifies one of the following projects:
208+
+
209+
* If you are using a trigger authentication, specify the project with the object you want to scale.
210+
* If you are using a cluster trigger authentication, specify the `openshift-keda` project.
211+
+
212+
<4> Specifies the name of the service account to bind to the role.
213+
<5> Specifies the project where you previously created the service account.
196214

197215
.. Create the CR object:
198216
+

nodes/cma/nodes-cma-autoscaling-custom-trigger.adoc

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,11 @@ You can configure a certificate authority xref:../../nodes/cma/nodes-cma-autosca
2323

2424
include::modules/nodes-cma-autoscaling-custom-trigger-prom.adoc[leveloffset=+1]
2525
include::modules/nodes-cma-autoscaling-custom-prometheus-config.adoc[leveloffset=+2]
26+
27+
[role="_additional-resources"]
28+
.Additional resources
29+
* xref:../../nodes/cma/nodes-cma-autoscaling-custom-trigger-auth.adoc#nodes-cma-autoscaling-custom-trigger-auth[Understanding custom metrics autoscaler trigger authentications]
30+
2631
include::modules/nodes-cma-autoscaling-custom-trigger-cpu.adoc[leveloffset=+1]
2732
include::modules/nodes-cma-autoscaling-custom-trigger-memory.adoc[leveloffset=+1]
2833
include::modules/nodes-cma-autoscaling-custom-trigger-kafka.adoc[leveloffset=+1]

0 commit comments

Comments
 (0)