Skip to content

Commit

Permalink
Remove explicit storage class parameter validation
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 bad6c2d
Showing 1 changed file with 0 additions and 18 deletions.
18 changes: 0 additions & 18 deletions pkg/controller/controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -562,19 +562,6 @@ func (p *csiProvisioner) Provision(options controller.VolumeOptions) (*v1.Persis
return pv, nil
}

func validateStorageClassParameters(params map[string]string) error {
for k, v := range params {
switch {
case strings.Contains(k, prefixedProvisionerSecretNameKey) && strings.Contains(v, "pvc.annotations"):
return fmt.Errorf("Secret name stored in storage class parameters is not supported")
case strings.Contains(k, prefixedProvisionerSecretNamespaceKey) && strings.Contains(v, "pvc.annotations"):
return fmt.Errorf("Secret namespace stored in storage class parameters is not supported")
}
}

return nil
}

func (p *csiProvisioner) supportsTopology() bool {
return p.pluginCapabilities[csi.PluginCapability_Service_VOLUME_ACCESSIBILITY_CONSTRAINTS] &&
utilfeature.DefaultFeatureGate.Enabled(features.Topology)
Expand Down Expand Up @@ -791,11 +778,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

0 comments on commit bad6c2d

Please sign in to comment.