Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: allow empty objects array #671

Merged
merged 2 commits into from Dec 2, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion pkg/provider/provider.go
Expand Up @@ -257,7 +257,7 @@ func (p *Provider) MountSecretsStoreObjectContent(ctx context.Context, attrib ma
klog.InfoS("unmarshaled key vault objects", "keyVaultObjects", keyVaultObjects, "count", len(keyVaultObjects), "pod", klog.ObjectRef{Namespace: podNamespace, Name: podName})

if len(keyVaultObjects) == 0 {
return nil, nil, fmt.Errorf("objects array is empty")
return make(map[string][]byte), make(map[string]string), nil
}

vaultURL, err := mc.getVaultURL()
Expand Down
2 changes: 1 addition & 1 deletion pkg/provider/provider_test.go
Expand Up @@ -768,7 +768,7 @@ func TestMountSecretsStoreObjectContent(t *testing.T) {
"objects": `
array:`,
},
expectedErr: true,
expectedErr: false,
},
{
desc: "invalid object format",
Expand Down
9 changes: 0 additions & 9 deletions pkg/server/server_test.go
Expand Up @@ -35,15 +35,6 @@ func TestMount(t *testing.T) {
},
expectedErr: true,
},
{
desc: "failed to mount request",
mountRequest: &v1alpha1.MountRequest{
Attributes: `{"keyvaultName":"kv","tenantId":"72f988bf-86f1-41af-91ab-2d7cd011db47","objects": "array:"}`,
Secrets: `{"clientid":"foo","clientsecret":"bar"}`,
Permission: "420",
},
expectedErr: true,
},
}

for _, tc := range cases {
Expand Down