Skip to content
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

Avoid watching all secrets in the cluster #1359

Closed
wants to merge 39 commits into from
Closed

Conversation

khrm
Copy link
Contributor

@khrm khrm commented May 6, 2022

Changes

Replace the secret informer by a secret getter.
It implies that for each webhook an API call will be issued against the
k8s API to get the secret.
Previously, all secrets of the cluster were in the interceptor memory.

Before this change:
crictl stats reports 79.18MB with around 5k secrets of 2.5kB with kind.

After this change:
crictl stats reports 8.221MB

Proposition related to #1268

The other way to solve this would be to add a specific label on all secrets watched by the interceptor.
But it would introduce a breaking change between 2 releases.

Author - @guillaumerose

Submitter Checklist

These are the criteria that every PR should meet, please check them off as you
review them:

  • Includes tests (if functionality changed/added)
  • Includes docs (if user facing)
  • Commit messages follow commit message best practices
  • Release notes block has been filled in or deleted (only if no user facing changes)

See the contribution guide for more details.

Release Notes

guillaumerose and others added 30 commits January 12, 2022 10:16
This cache was unused since the req parameter was always nil.
This will allow us to choose between an informer and a kubernetes
client.

The current implementation is using an informer.
Instead of comparing nil secret with the given secret, it will return
a meaningful error message.
Instead of using an informer, it now uses a k8s client. It avoids
loading all secrets of the cluster in controller memory.

Tests are still using an informer for convenience.
It will reduce the load on the k8s apiserver when receiving a lot of
webhooks coming from the same project.
This is part of tektoncd#1271 - `names_match` violations still need to be dealt with.

Signed-off-by: Andrew Bayer <andrew.bayer@gmail.com>
And fix tektoncd#1271 along the way by using the same scripting as in tektoncd/pipeline#4402 to ignore API rule violations for `name_match` which already exist. Any new mismatch will cause an error.

Signed-off-by: Andrew Bayer <andrew.bayer@gmail.com>
Kubernetes vendoring is using klog v2 but knative is using v1.
When knative configure the logging, it doesn't configure the underlying
kubernetes logging.

Fix tektoncd#1301
This will add `hack/update-reference-docs.sh` to `hack/update-codegen.sh`, resulting in `docs/triggers-api.md` being generated.

Signed-off-by: Andrew Bayer <andrew.bayer@gmail.com>
add the ability to specify the service port for a eventlistener
service. Default TLS Port 8443 is not set when service port is
specified by the user.

Signed-off-by: Vibhav Bobade <vibhav.bobde@gmail.com>
Changing the image location for triggers flow so that it can be
rendered in tekton.dev/docs
Default HTTP client provided by go can cause leak, hangup
and other issues because it has no sane timeout defined.
Adding metrics for counting EL, TT, CTB, clusterinteceptor and TB.
Define `targetURI` field in EL spec to send cloud event during trigger
processing. FeatureFlag should also be `alpha`.
Send cloud event only when CloudEventURI is defined. Otherwise,
logger will clog up the pod logs.
Update the tekton triggers build pipeline to build using golang 1.17.7

Controller images are built using ko.
Updating the ko image in the publish task to one that includes
golang 1.17.7 (golang:1.17.7-alpine3.15). Reference the ko image by sha
instead of tag. This will require an extra step to update the image in
future (plumbing first, triggers then) but it's best for attestations
and also it allows updating the image on plumbing side and in the
registry without direct side effect on triggers.

Signed-off-by: Andrea Frittoli <andrea.frittoli@uk.ibm.com>
Fix the param name in cel-eventlistener-interceptor.yaml example.
Bump the Go version to 1.17.8 in tekton/publish.yaml
Update Release Cheatsheet with instructions for chains and
use release drafter pipeline without pipeline resources
tekton/publish task had a bug which lead to only interceptor
images getting attestation.
khrm and others added 9 commits May 6, 2022 19:13
CEL introduced support for heterogeneous equality and cross-numeric
type comparisons. This means expressions like `json.value != null`
will no longer error when the `json.value` is non-null. Additionally,
JSON numbers which are usually `double` typed at runtime will
successfully compare to signed and unsigned integer values as long
as the values exist on the same point on a continuous number line

The latest version of CEL reduces bootstrapping costs by >95%, with
new environment instantiation dropping from 2.5ms to 100us. Evaluation
performance also improves by 5-10% with list related macros improving
by as much as 20x.
Wildcard/* should be quoted in yaml because * is used as anchor and
aliases in yaml. So fix the documentation to put wildcard as "*".
As part of this, I also ran `go fmt -s -w cmd/ pkg/ test/ tekton/ hack/` to fix
the build tags and then ran `./hack/update-codegen.sh` to regenerate the code.

I also had to run `go mod tidy` and `go mod vendor` to fix up some inconsistent
vendoring.

Fixes tektoncd#1335

Signed-off-by: Dibyo Mukherjee <dibyo@google.com>
TriggersGroups has been moved to stable API from alpha api. It
will be available by default and no changes in config will be required.
Remove the podtemplate struct from types.
This change uses non-tagged commits from `knative.dev/serving` and `knative.dev/eventing` because
their `v0.31.0` releases require a minimum k8s cluster version of 1.22, and I wanted to avoid
requiring that if at all possible. Instead, we depend on the latest commit in each before they
changed to depending on a `knative.dev/pkg` commit newer than the one Pipeline depends on.

Also add a Makefile, sync `.golangci.yml` with Pipeline's (other than requiring comments for
exported functions/types/etc, which I'll come back and do in a followup), and fix some new-as-a-result
linter issues.

Signed-off-by: Andrew Bayer <andrew.bayer@gmail.com>
@tekton-robot tekton-robot added the release-note Denotes a PR that will be considered when it comes time to generate release notes. label May 6, 2022
@tekton-robot
Copy link

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by:
To complete the pull request process, please assign khrm
You can assign the PR to them by writing /assign @khrm in a comment when ready.

The full list of commands accepted by this bot can be found 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

@tekton-robot tekton-robot requested review from dlorenc and wlynch May 6, 2022 13:55
@tekton-robot
Copy link

@khrm: PR needs rebase.

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.

@tekton-robot tekton-robot added needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. size/L Denotes a PR that changes 100-499 lines, ignoring generated files. size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files. and removed size/L Denotes a PR that changes 100-499 lines, ignoring generated files. labels May 6, 2022
@khrm khrm closed this May 6, 2022
@khrm khrm deleted the secretsgetter branch May 6, 2022 13:57
@tekton-robot
Copy link

@khrm: The following tests failed, say /retest to rerun them all:

Test name Commit Details Rerun command
pull-tekton-triggers-go-coverage 8a1c8f1 link /test pull-tekton-triggers-go-coverage
pull-tekton-triggers-unit-tests 8a1c8f1 link /test tekton-triggers-unit-tests
pull-tekton-triggers-build-tests 8a1c8f1 link /test pull-tekton-triggers-build-tests
pull-tekton-triggers-integration-tests 8a1c8f1 link /test pull-tekton-triggers-integration-tests

Full PR test history. Your PR dashboard.

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. I understand the commands that are listed here.

@khrm
Copy link
Contributor Author

khrm commented May 6, 2022

Closed this as I can directly push to Guillaume Rose's branch.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. release-note Denotes a PR that will be considered when it comes time to generate release notes. size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

10 participants