Skip to content

fix(knative): clean up stale triggers on deploy#3809

Open
Elvand-Lie wants to merge 1 commit into
knative:mainfrom
Elvand-Lie:fix/knative-stale-triggers
Open

fix(knative): clean up stale triggers on deploy#3809
Elvand-Lie wants to merge 1 commit into
knative:mainfrom
Elvand-Lie:fix/knative-stale-triggers

Conversation

@Elvand-Lie
Copy link
Copy Markdown
Contributor

Problem

createTriggers only creates triggers but never removes stale ones. If a user removes a subscription from func.yaml and redeploys, old triggers with higher indices remain orphaned on the cluster.

Fix

Added a cleanup step after trigger creation that lists existing triggers matching the naming pattern and deletes any whose index exceeds the current subscription count. This mirrors the deleteStaleTriggers pattern used in the k8s deployer.

Fixes #3799

@knative-prow
Copy link
Copy Markdown

knative-prow Bot commented May 20, 2026

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: Elvand-Lie
Once this PR has been reviewed and has the lgtm label, please assign matzew for approval. For more information see the Code Review Process.

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

Details 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 requested review from dsimansk and jrangelramos May 20, 2026 19:59
@knative-prow knative-prow Bot added the size/M 🤖 PR changes 30-99 lines, ignoring generated files. label May 20, 2026
@knative-prow
Copy link
Copy Markdown

knative-prow Bot commented May 20, 2026

Hi @Elvand-Lie. Thanks for your PR.

I'm waiting for a knative member to verify that this patch is reasonable to test. If it is, they should reply with /ok-to-test on its own line. Until that is done, I will not automatically test new commits in this PR, but the usual testing commands by org members will still work.

Tip

We noticed you've done this a few times! Consider joining the org to skip this step and gain /lgtm and other bot rights. We recommend asking approvers on your previous PRs to sponsor you.

Once the patch is verified, the new status will be reflected by the ok-to-test label.

I understand the commands that are listed here.

Details

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-sigs/prow repository.

@knative-prow knative-prow Bot added the needs-ok-to-test 🤖 Needs an org member to approve testing label May 20, 2026
@codecov
Copy link
Copy Markdown

codecov Bot commented May 20, 2026

Codecov Report

❌ Patch coverage is 67.85714% with 9 lines in your changes missing coverage. Please review.
✅ Project coverage is 51.24%. Comparing base (ad6edb6) to head (b000cac).
⚠️ Report is 2 commits behind head on main.

Files with missing lines Patch % Lines
pkg/knative/deployer.go 67.85% 7 Missing and 2 partials ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #3809      +/-   ##
==========================================
- Coverage   53.42%   51.24%   -2.18%     
==========================================
  Files         200      200              
  Lines       23426    23469      +43     
==========================================
- Hits        12515    12027     -488     
- Misses       9655    10280     +625     
+ Partials     1256     1162      -94     
Flag Coverage Δ
e2e 33.72% <39.28%> (+0.03%) ⬆️
e2e go 29.64% <16.00%> (+<0.01%) ⬆️
e2e node 25.95% <16.00%> (+0.08%) ⬆️
e2e python 29.98% <16.00%> (+<0.01%) ⬆️
e2e quarkus 26.06% <16.00%> (+0.08%) ⬆️
e2e rust 25.51% <16.00%> (+0.06%) ⬆️
e2e springboot 24.20% <16.00%> (+0.08%) ⬆️
e2e typescript 26.04% <16.00%> (+0.08%) ⬆️
e2e-config-ci 26.77% <16.00%> (+<0.01%) ⬆️
integration ?
unit macos-14 42.25% <52.00%> (+0.05%) ⬆️
unit macos-latest 42.25% <52.00%> (+0.05%) ⬆️
unit ubuntu-24.04-arm 42.55% <50.00%> (+0.04%) ⬆️
unit ubuntu-latest 43.12% <52.00%> (+0.05%) ⬆️
unit windows-latest 42.32% <52.00%> (+0.08%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@Elvand-Lie Elvand-Lie force-pushed the fix/knative-stale-triggers branch from efb4260 to b35c7fe Compare May 21, 2026 06:27
@lkingland lkingland added the ok-to-test 🤖 Non-member PR verified by an org member that is safe to test. label May 21, 2026
createTriggers only creates triggers but never removes stale ones. If a
user removes a subscription from func.yaml and redeploys, old triggers
with higher indices remain orphaned on the cluster.

Added a cleanup step after trigger creation that lists existing triggers
matching the naming pattern and deletes any whose index exceeds the
current subscription count. This mirrors the deleteStaleTriggers pattern
used in the k8s deployer.

Fixes knative#3799
@Elvand-Lie Elvand-Lie force-pushed the fix/knative-stale-triggers branch from b35c7fe to b000cac Compare May 21, 2026 13:19
@knative-prow knative-prow Bot added size/L 🤖 PR changes 100-499 lines, ignoring generated files. and removed size/M 🤖 PR changes 30-99 lines, ignoring generated files. needs-ok-to-test 🤖 Needs an org member to approve testing labels May 21, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ok-to-test 🤖 Non-member PR verified by an org member that is safe to test. size/L 🤖 PR changes 100-499 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

knative: createTriggers does not clean up stale triggers on subscription changes

2 participants