knative / knative/func

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

Open
#3,799 1 comment 0 reactions 1 assignee Claimed by @Elvand-Lie View on GitHub
kind/bug
Dominant language
Go
Stars
365
Forks
223
Avg merge
2d 3h
Merged PRs (30d)
25

Description

The Knative deployer's createTriggers function (pkg/knative/deployer.go, line 365) only creates triggers from the current f.Deploy.Subscriptions list. Unlike the k8s deployer's syncTriggers (pkg/k8s/deployer.go, line 274) which calls deleteStaleTriggers to remove old triggers no longer in the desired set, the Knative deployer has no equivalent cleanup step.

If a user removes a subscription from func.yaml and redeploys, the old trigger remains on the cluster. The OwnerReferences on the triggers (pointing to the KService) only clean up when the entire KService is deleted, not when subscriptions are changed.

The Knative deployer uses index-based trigger naming (e.g. my-func-function-trigger-0). If a function had 3 subscriptions (triggers 0, 1, 2) and is redeployed with 2, trigger-2 becomes orphaned and continues routing events.

Fix: add a cleanup step after creating triggers that removes any trigger with the function's naming pattern whose index exceeds the current subscription count.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.