From 01968e5144b0e9bb6c6815e46118ddfa04447258 Mon Sep 17 00:00:00 2001 From: Grant Griffiths Date: Wed, 15 May 2019 00:04:30 -0700 Subject: [PATCH] Move storage class parameter validation to resolveTemplate Signed-off-by: Grant Griffiths --- pkg/controller/controller.go | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/pkg/controller/controller.go b/pkg/controller/controller.go index e48d48da9..8bb087ad8 100644 --- a/pkg/controller/controller.go +++ b/pkg/controller/controller.go @@ -791,11 +791,6 @@ func verifyAndGetSecretNameAndNamespaceTemplate(secret secretParamsMap, storageC // - the resolved name is not a valid secret name // - the resolved namespace is not a valid namespace name func getSecretReference(secretParams secretParamsMap, storageClassParams map[string]string, pvName string, pvc *v1.PersistentVolumeClaim) (*v1.SecretReference, error) { - // Ensure that no unsupported SC parameters are passed in. - if err := validateStorageClassParameters(storageClassParams); err != nil { - return nil, err - } - nameTemplate, namespaceTemplate, err := verifyAndGetSecretNameAndNamespaceTemplate(secretParams, storageClassParams) if err != nil { return nil, fmt.Errorf("failed to get name and namespace template from params: %v", err) @@ -854,6 +849,11 @@ func getSecretReference(secretParams secretParamsMap, storageClassParams map[str } func resolveTemplate(template string, params map[string]string) (string, error) { + // Ensure that no unsupported SC parameters are passed in. + if err := validateStorageClassParameters(params); err != nil { + return "", err + } + missingParams := sets.NewString() resolved := os.Expand(template, func(k string) string { v, ok := params[k]