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]