Skip to content

Allow SecretProviderClass to successfully deploy with an empty secret/parameter list. #529

@OS-marcoguilherme

Description

@OS-marcoguilherme

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: aws

Expected 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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions