Skip to content

Commit

Permalink
Move storage class parameter validation to resolveTemplate
Browse files Browse the repository at this point in the history
Signed-off-by: Grant Griffiths <ggp493@gmail.com>
  • Loading branch information
ggriffiths committed May 15, 2019
1 parent 067e474 commit 01968e5
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions pkg/controller/controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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]
Expand Down

0 comments on commit 01968e5

Please sign in to comment.