-
Notifications
You must be signed in to change notification settings - Fork 154
Description
Describe the bug
Pod doesn't start if the Secret Provider Class it uses for a volume mount does not contain any secret/object. Got the following error: failed to mount secrets store objects for pod <pod_name>, err: missing object version.
To Reproduce
Created a k8s deployment that mounts secrets from an AWS secret provider class, and the initial version of that SPC does not contain any secret/object. Got the following error in the pod: failed to mount secrets store objects for pod <pod_name>, err: missing object version.
E.g.
spec:
parameters:
objects: '[]'
provider: awsExpected behavior
Pod should start and run even if the Secret Provider Class it uses for a volume mount does not contain any secret/object. The mount path would be empty in that case.
Environment:
Kubernetes version: v1.31.12-eks-e386d34
Additional context
Issue seems to be in https://github.com/aws/secrets-store-csi-driver-provider-aws/blob/secrets-store-csi-driver-provider-aws-1.0.0/server/server.go#L191. If var ov []*v1alpha1.ObjectVersion was set to an empty array instead of nil in case of empty objects in the SPC, no error would be thrown.