test: add regression coverage for SinkBinding preserving existing volumes - #9252
test: add regression coverage for SinkBinding preserving existing volumes#9252pujitha24 wants to merge 1 commit into
Conversation
…umes Motivation: Issue knative#8261 reported that SinkBinding's mutation of a Deployment subject (SinkBinding.Do in pkg/apis/sources/v1/sinkbinding_lifecycle.go) eliminated pre-existing volumes/volumeMounts on the subject as soon as K_SINK env vars were injected, filed against v1.14.0. A maintainer later attempted to reproduce this on a newer release with a Deployment carrying a custom ConfigMap volume and was unable to reproduce it, and no further activity or linked fix followed. Reviewing the current code, SinkBinding.Do only ever appends to Volumes/VolumeMounts/Env (including the trust-bundle and OIDC token volume injection paths), and the admission webhook applies the change as a computed JSON patch diff rather than a wholesale object replace, so there is no remaining code path that would drop unrelated volumes. This change has no user-visible behavior impact today; the bug does not currently reproduce. Approach: Add a regression test case to TestSinkBindingDo that starts from a subject with a pre-existing user-defined Volume and a container VolumeMount referencing it, and asserts both are still present after Do() runs alongside the injected K_SINK/K_CA_CERTS/K_CE_OVERRIDES env vars. This locks in the current correct behavior and will catch a regression if this code path changes in the future. Validation: go build ./... go test ./pkg/apis/sources/v1/... -run TestSinkBindingDo -v (new subtest "preserves_existing_volumes_and_volumeMounts_on_subject" passes, along with all sibling subtests) /kind bug ```release-note NONE ``` Fixes knative#8261 Signed-off-by: Pujitha Paladugu <10557236+pujitha24@users.noreply.github.com>
|
Welcome @pujitha24! It looks like this is your first PR to knative/eventing 🎉 |
|
Hi @pujitha24. 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 Regular contributors should join the org to skip this step. Once the patch is verified, the new status will be reflected by the I understand the commands that are listed here. DetailsInstructions 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. |
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: pujitha24 The full list of commands accepted by this bot can be found here. DetailsNeeds approval from an approver in each of these files:Approvers can indicate their approval by writing |
Motivation:
Issue #8261 reported that SinkBinding's mutation of a Deployment
subject (SinkBinding.Do in pkg/apis/sources/v1/sinkbinding_lifecycle.go)
eliminated pre-existing volumes/volumeMounts on the subject as soon as
K_SINK env vars were injected, filed against v1.14.0. A maintainer
later attempted to reproduce this on a newer release with a Deployment
carrying a custom ConfigMap volume and was unable to reproduce it, and
no further activity or linked fix followed.
Reviewing the current code, SinkBinding.Do only ever appends to
Volumes/VolumeMounts/Env (including the trust-bundle and OIDC token
volume injection paths), and the admission webhook applies the change
as a computed JSON patch diff rather than a wholesale object replace,
so there is no remaining code path that would drop unrelated volumes.
This change has no user-visible behavior impact today; the bug does
not currently reproduce.
Approach:
Add a regression test case to TestSinkBindingDo that starts from a
subject with a pre-existing user-defined Volume and a container
VolumeMount referencing it, and asserts both are still present after
Do() runs alongside the injected K_SINK/K_CA_CERTS/K_CE_OVERRIDES env
vars. This locks in the current correct behavior and will catch a
regression if this code path changes in the future.
Validation:
go build ./...
go test ./pkg/apis/sources/v1/... -run TestSinkBindingDo -v
(new subtest "preserves_existing_volumes_and_volumeMounts_on_subject"
passes, along with all sibling subtests)
/kind bug
Fixes #8261
Signed-off-by: Pujitha Paladugu 10557236+pujitha24@users.noreply.github.com