SinkBinding eliminates all volumes on Deployment subject
Describe the bug Given the subject in a SinkBinding is an arbitrary Deployment that brings its own volumes/volumeMounts spec these get eliminated as soon as the SinkBinding has injected K_SINK envVars. As a result the initial volume/volumeMount information is lost on the Deployment.
Expected behavior The SinkBinding should preserve existing volume/volumeMount specs on the Deployment subject.
To Reproduce
- Create a Deployment with a custom volume/volumeMount
- Create a SinkBinding resource with the given Deployment as a subject
- See the existing volume/volumeMount disappear from the Deployment spec as soon as the SinkBinding envVar injection is done
Knative release version v1.14.0
Additional context used kubectl apply -f to create both Deployement and SinkBinding. Tested on local Kind cluster.
Probably related to some logic in https://github.com/knative/eventing/blob/6aa49dc1db88c5703a7d981d247dc3bb183c0b59/pkg/apis/sources/v1/sinkbinding_lifecycle.go#L142
/triage accepted
@christophd was oidc enabled when you found this?
no it was not
@christophd are you able to reproduce this issue on newer releases of knative? I just tried following your steps above with the yaml below and was unfortunately not able to reproduce...
apiVersion: v1
kind: ConfigMap
metadata:
name: example-config
namespace: default
data:
key: value
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: nginx-deployment
namespace: default
labels:
app: nginx
spec:
replicas: 3
selector:
matchLabels:
app: nginx
template:
metadata:
labels:
app: nginx
spec:
volumes:
- name: sample-volume
configMap:
name: example-config
containers:
- name: nginx
image: nginx:1.14.2
ports:
- containerPort: 80
volumeMounts:
- name: sample-volume
mountPath: /sample-volume
---
apiVersion: sources.knative.dev/v1
kind: SinkBinding
metadata:
name: example-sb
namespace: default
spec:
subject:
apiVersion: apps/v1
kind: Deployment
name: nginx-deployment
sink:
uri: "https://example.com"