Skip to content

Commit eda52fd

Browse files
authored
Merge pull request #80375 from mburke5678/cma-trigger-auth-ca
Add CMA docs on using a per-TriggerAuthentication CA with Prometheus/Kafka triggers
2 parents 658df14 + d086c0a commit eda52fd

5 files changed

+106
-33
lines changed

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

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@ spec:
4343
excludePersistentLag: false <10>
4444
version: '1.0.0' <11>
4545
partitionLimitation: '1,2,10-20,31' <12>
46+
tls: enable <13>
4647
----
4748
<1> Specifies Kafka as the trigger type.
4849
<2> Specifies the name of the Kafka topic on which Kafka is processing the offset lag.
@@ -62,4 +63,4 @@ spec:
6263
* If `false`, the trigger includes all consumer lag in all partitions. This is the default.
6364
<11> Optional: Specifies the version of your Kafka brokers. Must be specified as a quoted string value. The default is `1.0.0`.
6465
<12> Optional: Specifies a comma-separated list of partition IDs to scope the scaling on. If set, only the listed IDs are considered when calculating lag. Must be specified as a quoted string value. The default is to consider all partitions.
65-
66+
<13> Optional: Specifies whether to use TSL client authentication for Kafka. The default is `disable`. For information on configuring TLS, see "Understanding custom metrics autoscaler trigger authentications".

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

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
[id="nodes-cma-autoscaling-custom-trigger-prom_{context}"]
77
= Understanding the Prometheus trigger
88

9-
You can scale pods based on Prometheus metrics, which can use the installed {product-title} monitoring or an external Prometheus server as the metrics source. See "Additional resources" for information on the configurations required to use the {product-title} monitoring as a source for metrics.
9+
You can scale pods based on Prometheus metrics, which can use the installed {product-title} monitoring or an external Prometheus server as the metrics source. See "Configuring the custom metrics autoscaler to use {product-title} monitoring" for information on the configurations required to use the {product-title} monitoring as a source for metrics.
1010

1111
[NOTE]
1212
====
@@ -47,7 +47,11 @@ spec:
4747
<9> Optional: Specifies how the trigger should proceed if the Prometheus target is lost.
4848
* If `true`, the trigger continues to operate if the Prometheus target is lost. This is the default behavior.
4949
* If `false`, the trigger returns an error if the Prometheus target is lost.
50-
<10> Optional: Specifies whether the certificate check should be skipped. For example, you might skip the check if you use self-signed certificates at the Prometheus endpoint.
51-
* If `true`, the certificate check is performed.
52-
* If `false`, the certificate check is not performed. This is the default behavior.
53-
50+
<10> Optional: Specifies whether the certificate check should be skipped. For example, you might skip the check if you are running in a test environment and using self-signed certificates at the Prometheus endpoint.
51+
* If `false`, the certificate check is performed. This is the default behavior.
52+
* If `true`, the certificate check is not performed.
53+
+
54+
[IMPORTANT]
55+
====
56+
Skipping the check is not recommended.
57+
====

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

Lines changed: 92 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,21 @@ Alternatively, to share credentials between objects in multiple namespaces, you
1515

1616
Trigger authentications and cluster trigger authentication use the same configuration. However, a cluster trigger authentication requires an additional `kind` parameter in the authentication reference of the scaled object.
1717

18-
.Example trigger authentication with a secret
18+
.Example secret for Basic authentication
19+
[source,yaml]
20+
----
21+
apiVersion: v1
22+
kind: Secret
23+
metadata:
24+
name: my-basic-secret
25+
namespace: default
26+
data:
27+
username: "dXNlcm5hbWU=" <1>
28+
password: "cGFzc3dvcmQ="
29+
----
30+
<1> User name and password to supply to the trigger authentication. The values in a `data` stanza must be base-64 encoded.
31+
32+
.Example trigger authentication using a secret for Basic authentication
1933
[source,yaml]
2034
----
2135
kind: TriggerAuthentication
@@ -25,20 +39,20 @@ metadata:
2539
namespace: my-namespace <1>
2640
spec:
2741
secretTargetRef: <2>
28-
- parameter: user-name <3>
29-
name: my-secret <4>
30-
key: USER_NAME <5>
42+
- parameter: username <3>
43+
name: my-basic-secret <4>
44+
key: username <5>
3145
- parameter: password
32-
name: my-secret
33-
key: USER_PASSWORD
46+
name: my-basic-secret
47+
key: password
3448
----
3549
<1> Specifies the namespace of the object you want to scale.
36-
<2> Specifies that this trigger authentication uses a secret for authorization.
50+
<2> Specifies that this trigger authentication uses a secret for authorization when connecting to the metrics endpoint.
3751
<3> Specifies the authentication parameter to supply by using the secret.
3852
<4> Specifies the name of the secret to use.
3953
<5> Specifies the key in the secret to use with the specified parameter.
4054

41-
.Example cluster trigger authentication with a secret
55+
.Example cluster trigger authentication with a secret for Basic authentication
4256
[source,yaml]
4357
----
4458
kind: ClusterTriggerAuthentication
@@ -47,20 +61,75 @@ metadata: <1>
4761
name: secret-cluster-triggerauthentication
4862
spec:
4963
secretTargetRef: <2>
50-
- parameter: user-name <3>
51-
name: secret-name <4>
52-
key: USER_NAME <5>
53-
- parameter: user-password
54-
name: secret-name
55-
key: USER_PASSWORD
64+
- parameter: username <3>
65+
name: my-basic-secret <4>
66+
key: username <5>
67+
- parameter: password
68+
name: my-basic-secret
69+
key: password
5670
----
5771
<1> Note that no namespace is used with a cluster trigger authentication.
58-
<2> Specifies that this trigger authentication uses a secret for authorization.
72+
<2> Specifies that this trigger authentication uses a secret for authorization when connecting to the metrics endpoint.
5973
<3> Specifies the authentication parameter to supply by using the secret.
6074
<4> Specifies the name of the secret to use.
6175
<5> Specifies the key in the secret to use with the specified parameter.
6276

63-
.Example trigger authentication with a token
77+
.Example secret with certificate authority (CA) details
78+
[source,yaml]
79+
----
80+
apiVersion: v1
81+
kind: Secret
82+
metadata:
83+
name: my-secret
84+
namespace: my-namespace
85+
data:
86+
ca-cert.pem: LS0tLS1CRUdJTiBDRVJUSUZJQ0FURS0tLS0... <1>
87+
client-cert.pem: LS0tLS1CRUdJTiBDRVJUSUZJQ0FURS0... <2>
88+
client-key.pem: LS0tLS1CRUdJTiBQUklWQVRFIEtFWS0t...
89+
----
90+
<1> Specifies the TLS CA Certificate for authentication of the metrics endpoint. The value must be base-64 encoded.
91+
<2> Specifies the TLS certificates and key for TLS client authentication. The values must be base-64 encoded.
92+
93+
.Example trigger authentication using a secret for CA details
94+
[source,yaml]
95+
----
96+
kind: TriggerAuthentication
97+
apiVersion: keda.sh/v1alpha1
98+
metadata:
99+
name: secret-triggerauthentication
100+
namespace: my-namespace <1>
101+
spec:
102+
secretTargetRef: <2>
103+
- parameter: key <3>
104+
name: my-secret <4>
105+
key: client-key.pem <5>
106+
- parameter: ca <6>
107+
name: my-secret <7>
108+
key: ca-cert.pem <8>
109+
----
110+
<1> Specifies the namespace of the object you want to scale.
111+
<2> Specifies that this trigger authentication uses a secret for authorization when connecting to the metrics endpoint.
112+
<3> Specifies the type of authentication to use.
113+
<4> Specifies the name of the secret to use.
114+
<5> Specifies the key in the secret to use with the specified parameter.
115+
<6> Specifies the authentication parameter for a custom CA when connecting to the metrics endpoint.
116+
<7> Specifies the name of the secret to use.
117+
<8> Specifies the key in the secret to use with the specified parameter.
118+
119+
.Example secret with a bearer token
120+
[source,yaml]
121+
----
122+
apiVersion: v1
123+
kind: Secret
124+
metadata:
125+
name: my-secret
126+
namespace: my-namespace
127+
data:
128+
bearerToken: "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXV" <1>
129+
----
130+
<1> Specifies a bearer token to use with bearer authentication. The value in a `data` stanza must be base-64 encoded.
131+
132+
.Example trigger authentication with a bearer token
64133
[source,yaml]
65134
----
66135
kind: TriggerAuthentication
@@ -71,16 +140,13 @@ metadata:
71140
spec:
72141
secretTargetRef: <2>
73142
- parameter: bearerToken <3>
74-
name: my-token-2vzfq <4>
75-
key: token <5>
76-
- parameter: ca
77-
name: my-token-2vzfq
78-
key: ca.crt
143+
name: my-secret <4>
144+
key: bearerToken <5>
79145
----
80146
<1> Specifies the namespace of the object you want to scale.
81-
<2> Specifies that this trigger authentication uses a secret for authorization.
82-
<3> Specifies the authentication parameter to supply by using the token.
83-
<4> Specifies the name of the token to use.
147+
<2> Specifies that this trigger authentication uses a secret for authorization when connecting to the metrics endpoint.
148+
<3> Specifies the type of authentication to use.
149+
<4> Specifies the name of the secret to use.
84150
<5> Specifies the key in the token to use with the specified parameter.
85151

86152
.Example trigger authentication with an environment variable
@@ -98,7 +164,7 @@ spec:
98164
containerName: my-container <5>
99165
----
100166
<1> Specifies the namespace of the object you want to scale.
101-
<2> Specifies that this trigger authentication uses environment variables for authorization.
167+
<2> Specifies that this trigger authentication uses environment variables for authorization when connecting to the metrics endpoint.
102168
<3> Specify the parameter to set with this variable.
103169
<4> Specify the name of the environment variable.
104170
<5> Optional: Specify a container that requires authentication. The container must be in the same resource as referenced by `scaleTargetRef` in the scaled object.
@@ -116,7 +182,7 @@ spec:
116182
provider: aws-eks <3>
117183
----
118184
<1> Specifies the namespace of the object you want to scale.
119-
<2> Specifies that this trigger authentication uses a platform-native pod authentication method for authorization.
185+
<2> Specifies that this trigger authentication uses a platform-native pod authentication when connecting to the metrics endpoint.
120186
<3> Specifies a pod identity. Supported values are `none`, `azure`, `gcp`, `aws-eks`, or `aws-kiam`. The default is `none`.
121187

122188
// Remove ifdef after https://github.com/openshift/openshift-docs/pull/62147 merges

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@ The custom metrics autoscaler currently supports only the Prometheus, CPU, memor
1414

1515
You use a `ScaledObject` or `ScaledJob` custom resource to configure triggers for specific objects, as described in the sections that follow.
1616

17+
You can configure a certificate authority xref:../../nodes/cma/nodes-cma-autoscaling-custom-trigger-auth.adoc#nodes-cma-autoscaling-custom-trigger-auth[to use with your scaled objects] or xref:../../nodes/cma/nodes-cma-autoscaling-custom.adoc#nodes-cma-autoscaling-custom-ca_nodes-cma-autoscaling-custom[for all scalers in the cluster].
18+
1719
// The following include statements pull in the module files that comprise
1820
// the assembly. Include any combination of concept, procedure, or reference
1921
// modules required to cover the user story. You can also include other

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ image::564_OpenShift_Custom_Metrics_Autoscaler_0224.png[Custom metrics autoscale
5656
[id="nodes-cma-autoscaling-custom-ca_{context}"]
5757
== Custom CA certificates for the Custom Metrics Autoscaler
5858

59-
By default, the Custom Metrics Autoscaler Operator uses automatically-generated service CA certificate to connect to on-cluster services.
59+
By default, the Custom Metrics Autoscaler Operator uses automatically-generated service CA certificates to connect to on-cluster services.
6060

6161
If you want to use off-cluster services that require custom CA certificates, you can add the required certificates to a config map. Then, add the config map to the `KedaController` custom resource as described in xref:../../nodes/cma/nodes-cma-autoscaling-custom-install.adoc#nodes-cma-autoscaling-custom-install[Installing the custom metrics autoscaler]. The Operator loads those certificates on start-up and registers them as trusted by the Operator.
6262

0 commit comments

Comments
 (0)