Skip to content

Commit 5458844

Browse files
authored
Merge pull request #58234 from rh-max/srvls-secret-filtering
[SRVKS-947] Srvls secret filtering
2 parents 9953e1f + 4f1aebe commit 5458844

File tree

6 files changed

+70
-8
lines changed

6 files changed

+70
-8
lines changed

modules/serverless-domain-mapping-custom-tls-cert.adoc

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -35,11 +35,11 @@ To work around this issue, enable mTLS by deploying `PeerAuthentication` instead
3535
$ oc create secret tls <tls_secret_name> --cert=<path_to_certificate_file> --key=<path_to_key_file>
3636
----
3737

38-
. If you are using {SMProductName} as the ingress for your {ServerlessProductName} installation, label the Kubernetes TLS secret with the following:
38+
. Add the `networking.internal.knative.dev/certificate-uid: <id>`` label to the Kubernetes TLS secret:
3939
+
40-
[source,yaml]
40+
[source,terminal]
4141
----
42-
networking.internal.knative.dev/certificate-uid": “<value>”
42+
$ oc label secret <tls_secret_name> networking.internal.knative.dev/certificate-uid="<id>"
4343
----
4444
+
4545
If you are using a third-party secret provider such as cert-manager, you can configure your secret manager to label the Kubernetes TLS secret automatically. Cert-manager users can use the secret template offered to automatically generate secrets with the correct label. In this case, secret filtering is done based on the key only, but this value can carry useful information such as the certificate ID that the secret contains.

modules/serverless-ossm-secret-filtering.adoc renamed to modules/serverless-ossm-secret-filtering-net-istio.adoc

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,16 @@
33
// * /serverless/integrations/serverless-ossm-setup.adoc
44

55
:_content-type: PROCEDURE
6-
[id="serverless-ossm-secret-filtering_{context}"]
7-
= Improving memory usage by using secret filtering for {SMProductShortName}
6+
[id="serverless-ossm-secret-filtering-net-istio_{context}"]
7+
= Improving net-istio memory usage by using secret filtering for {SMProductShortName}
88

99
By default, the link:https://aly.arriqaaq.com/kubernetes-informers/[informers] implementation for the Kubernetes `client-go` library fetches all resources of a particular type. This can lead to a substantial overhead when many resources are available, which can cause the Knative `net-istio` ingress controller to fail on large clusters due to memory leaking. However, a filtering mechanism is available for the Knative `net-istio` ingress controller, which enables the controller to only fetch Knative related secrets. You can enable this mechanism by adding an annotation to the `KnativeServing` custom resource (CR).
1010

11+
[IMPORTANT]
12+
====
13+
If you enable secret filtering, all of your secrets need to be labeled with `networking.internal.knative.dev/certificate-uid: "<id>"`. Otherwise, Knative Serving does not detect them, which leads to failures. You must label both new and existing secrets.
14+
====
15+
1116
.Prerequisites
1217

1318
ifdef::openshift-enterprise[]
@@ -52,3 +57,8 @@ spec:
5257
name: autoscaler
5358
----
5459
<1> Adding this annotation injects an environment variable, `ENABLE_SECRET_INFORMER_FILTERING_BY_CERT_UID=true`, to the `net-istio` controller pod.
60+
+
61+
[NOTE]
62+
====
63+
This annotation is ignored if you set a different value by overriding deployments.
64+
====
Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
// Module included in the following assemblies:
2+
//
3+
// * /serverless/knative-serving/config-custom-domains/domain-mapping-custom-tls-cert.adoc
4+
5+
:_content-type: PROCEDURE
6+
[id="serverless-ossm-secret-filtering-net-kourier_{context}"]
7+
= Improving net-kourier memory usage by using secret filtering
8+
9+
By default, the link:https://aly.arriqaaq.com/kubernetes-informers/[informers] implementation for the Kubernetes `client-go` library fetches all resources of a particular type. This can lead to a substantial overhead when many resources are available, which can cause the Knative `net-kourier` ingress controller to fail on large clusters due to memory leaking. However, a filtering mechanism is available for the Knative `net-kourier` ingress controller, which enables the controller to only fetch Knative related secrets. You can enable this mechanism by setting an environment variable to the `KnativeServing` custom resource (CR).
10+
11+
[IMPORTANT]
12+
====
13+
If you enable secret filtering, all of your secrets need to be labeled with `networking.internal.knative.dev/certificate-uid: "<id>"`. Otherwise, Knative Serving does not detect them, which leads to failures. You must label both new and existing secrets.
14+
====
15+
16+
.Prerequisites
17+
18+
ifdef::openshift-enterprise[]
19+
* You have access to an {product-title} account with cluster administrator access.
20+
endif::[]
21+
22+
ifdef::openshift-dedicated,openshift-rosa[]
23+
* You have access to an {product-title} account with cluster or dedicated administrator access.
24+
endif::[]
25+
26+
* A project that you created or that you have roles and permissions for to create applications and other workloads in {product-title}.
27+
* Install the {ServerlessOperatorName} and Knative Serving.
28+
* Install the OpenShift CLI (`oc`).
29+
30+
.Procedure
31+
32+
* Set the `ENABLE_SECRET_INFORMER_FILTERING_BY_CERT_UID` variable to `true` for `net-kourier-controller` in the `KnativeServing` CR:
33+
+
34+
.Example KnativeServing CR
35+
[source,yaml]
36+
----
37+
apiVersion: operator.knative.dev/v1beta1
38+
kind: KnativeServing
39+
metadata:
40+
name: knative-serving
41+
namespace: knative-serving
42+
spec:
43+
deployments:
44+
- env:
45+
- container: controller
46+
envVars:
47+
- name: ENABLE_SECRET_INFORMER_FILTERING_BY_CERT_UID
48+
value: 'true'
49+
name: net-kourier-controller
50+
----

modules/serverless-rn-1-28-0.adoc

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,9 @@
3838
+
3939
With {ServerlessProductName} 1.28, the {ServerlessOperatorName} allows injecting the environment variable `ENABLE_SECRET_INFORMER_FILTERING_BY_CERT_UID` for both `net-istio` and `net-kourier`.
4040
+
41-
To prevent problems when upgrading from {ServerlessProductName} 1.28 to some future version, users must annotate their secrets with `networking.internal.knative.dev/certificate-uid:some_cuid`.
41+
If you enable secret filtering, all of your secrets need to be labeled with `networking.internal.knative.dev/certificate-uid: "<id>"`. Otherwise, Knative Serving does not detect them, which leads to failures. You must label both new and existing secrets.
42+
+
43+
In one of the following {ServerlessProductName} releases, secret filtering will become enabled by default. To prevent failures, label your secrets in advance.
4244

4345
[id="known-issues-1-28-0_{context}"]
4446
== Known issues

serverless/integrations/serverless-ossm-setup.adoc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,4 +30,4 @@ include::modules/serverless-ossm-setup.adoc[leveloffset=+1]
3030
include::modules/serverless-ossm-enabling-serving-metrics.adoc[leveloffset=+1]
3131
// With kourier
3232
include::modules/serverless-ossm-setup-with-kourier.adoc[leveloffset=+1]
33-
include::modules/serverless-ossm-secret-filtering.adoc[leveloffset=+1]
33+
include::modules/serverless-ossm-secret-filtering-net-istio.adoc[leveloffset=+1]

serverless/knative-serving/config-custom-domains/domain-mapping-custom-tls-cert.adoc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,4 +5,4 @@ include::_attributes/common-attributes.adoc[]
55
:context: domain-mapping-custom-tls-cert
66

77
include::modules/serverless-domain-mapping-custom-tls-cert.adoc[leveloffset=+1]
8-
8+
include::modules/serverless-ossm-secret-filtering-net-kourier.adoc[leveloffset=+1]

0 commit comments

Comments
 (0)