这是indexloc提供的服务,不要输入任何密码
Skip to content

Support secret filtering informer #862

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Jul 5, 2022

Conversation

skonto
Copy link
Contributor

@skonto skonto commented Jun 23, 2022

Changes

Fixes #

Release Note

Secret informer in net-kourier ingress controller can filter secrets based on the existence of a label key`networking.internal.knative.dev/certificate-uid`. Users are required to add the label key for custom secrets defined in ingresses.
For special cases users are recommended to reach out to Knative community.
In case of AutoTLS provided by Knative net-certmanager or net-http01 this is done transparently.
To enable this behavior at net-kourier set env var ENABLE_SECRET_INFORMER_FILTERING_BY_CERT_UI to true. 
This will be available by default in future releases.

Docs

Secret informer in net-kourier ingress controller can filter secrets based on the existence of a label key`networking.internal.knative.dev/certificate-uid"`. Users are required to add the label key for custom secrets defined in ingresses.
For special cases users are recommended to reach out to Knative community.
In case of AutoTLS provided by Knative net-certmanager or net-http01 this is done transparently.
To enable this behavior at net-kourier set env var ENABLE_SECRET_INFORMER_FILTERING_BY_CERT_UI to true. 
This will be available by default in future releases.

@knative-prow
Copy link

knative-prow bot commented Jun 23, 2022

@skonto: The label(s) kind/<kind> cannot be applied, because the repository doesn't have them.

In response to this:

Changes

/kind

Fixes #

Release Note

Secret informer in net-kourier ingress controller can filter secrets based on the existence of a label key`networking.internal.knative.dev/certificate-uid`. Users are required to add the label key for custom secrets defined in ingresses.
For special cases users are recommended to reach out to Knative community.
In case of AutoTLS provided by Knative net-certmanager or net-http01 this is done transparently.
To enable this behavior at net-istio set env var ENABLE_SECRET_INFORMER_FILTERING_BY_CERT_UI to true. 
This will be available by default in future releases.

Docs

Secret informer in net-kourier ingress controller can filter secrets based on the existence of a label key`networking.internal.knative.dev/certificate-uid"`. Users are required to add the label key for custom secrets defined in ingresses.
For special cases users are recommended to reach out to Knative community.
In case of AutoTLS provided by Knative net-certmanager or net-http01 this is done transparently.
To enable this behavior at net-istio set env var ENABLE_SECRET_INFORMER_FILTERING_BY_CERT_UI to true. 
This will be available by default in future releases.

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

@knative-prow knative-prow bot added do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. approved Indicates a PR has been approved by an approver from all required OWNERS files. size/L Denotes a PR that changes 100-499 lines, ignoring generated files. labels Jun 23, 2022
@skonto skonto force-pushed the filter_informer_fix branch from afc1efb to 8f9d892 Compare June 23, 2022 15:33
@codecov
Copy link

codecov bot commented Jun 23, 2022

Codecov Report

Merging #862 (2307b89) into main (00505bc) will not change coverage.
The diff coverage is n/a.

@@           Coverage Diff           @@
##             main     #862   +/-   ##
=======================================
  Coverage   81.39%   81.39%           
=======================================
  Files          18       18           
  Lines        1172     1172           
=======================================
  Hits          954      954           
  Misses        174      174           
  Partials       44       44           

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 00505bc...2307b89. Read the comment docs.

@skonto skonto force-pushed the filter_informer_fix branch from 8f9d892 to f2d8d3c Compare June 24, 2022 08:14
@@ -48,6 +48,8 @@ spec:
value: "knative.dev/samples"
- name: KOURIER_GATEWAY_NAMESPACE
value: "kourier-system"
- name: ENABLE_SECRET_INFORMER_FILTERING_BY_CERT_UID
value: "true"
Copy link
Contributor Author

@skonto skonto Jun 24, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Will revert back to false, tests pass.

@skonto skonto force-pushed the filter_informer_fix branch 3 times, most recently from 639d755 to 88bf41a Compare July 1, 2022 12:03
@skonto skonto force-pushed the filter_informer_fix branch from 88bf41a to dae609b Compare July 1, 2022 12:29
@skonto
Copy link
Contributor Author

skonto commented Jul 1, 2022

Tested in: knative/serving#13058

@skonto skonto changed the title [wip] Support secret filtering informer Support secret filtering informer Jul 1, 2022
@knative-prow knative-prow bot removed the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Jul 1, 2022
@nak3
Copy link
Contributor

nak3 commented Jul 5, 2022

@skonto Could you update the Release Note and Docs by s/net-istio/net-kourier?

serviceinformer "knative.dev/pkg/client/injection/kube/informers/core/v1/service"
filteredFactory "knative.dev/pkg/client/injection/kube/informers/factory/filtered"

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you remove this blank line?


kubectl create -n ${TEST_NAMESPACE} secret tls server-certs \
--key="${out_dir}"/tls.key \
--cert="${out_dir}"/tls.crt --dry-run=client -o yaml | kubectl apply -f -
--cert="${out_dir}"/tls.crt --dry-run=client -o yaml | \
sed '/^metadata:/a\ \ labels: {"networking.internal.knative.dev/certificate-uid":"test-id"}' | kubectl apply -f -
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we don't need to add the label to the server-certs. It is used by users' namespace and Kourier does not need to be reconciled when they updated them.

(If users started using a server cert signed by a different CA, Kourier needs to be reconciled to load the new CA but it is triggered by knative-serving-certs(=CA) change.)

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

With said, the test will fail without this label? 😅

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Kourier reconciles a related ingress referencing that secret through no? Afaik it does fail I can try once more without it.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes for the CA secret (=knative-serving-certs) , but should be no for the server cert (=server-certs).
But the test failed? Hmm... I misunderstood something. I will look into it as well.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let me try it first. I might remember wrongly.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok removed the label and switched on filtering.

Copy link
Contributor Author

@skonto skonto Jul 5, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@nak3 Tests passed you were right,reverting the default value for the env var.

Stavros Kontopoulos added 2 commits July 5, 2022 11:53
@nak3
Copy link
Contributor

nak3 commented Jul 5, 2022

/lgtm
/approve

Thank you!

@knative-prow knative-prow bot added the lgtm Indicates that a PR is ready to be merged. label Jul 5, 2022
@knative-prow
Copy link

knative-prow bot commented Jul 5, 2022

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: nak3, skonto

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@knative-prow knative-prow bot merged commit c885488 into knative-extensions:main Jul 5, 2022
skonto pushed a commit to skonto/net-kourier that referenced this pull request Oct 4, 2022
* support secret filtering informer

* fixes

* revert env var default val
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. lgtm Indicates that a PR is ready to be merged. size/L Denotes a PR that changes 100-499 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants