rancher: Fail to create persistent volume on OpenStack

What kind of request is this (question/bug/enhancement/feature request): Bug

Steps to reproduce (least amount of steps as possible): Create a persistent volume in a OpenStack cluster Choose “OpenStack Cinder Volume” plugin Fill in an existing Volume ID “Filesystem type” = ext4 “Read only” = No “Access mode” = “Single Node Read-Write” “Assign to Storage Class” = “None”

Result: Fail with error: Validation failed in API: PersistentVolume "x" is invalid: [spec.cinder.secretRef.name: Required value, spec.cinder.secretRef.namespace: Required value]

Other details that may be helpful: The web UI is inserting the field "secretRef":{} inside the cinder object in the request

{"type":"persistentVolume","accessModes":["ReadWriteOnce"],"name":"x","cinder":{"readOnly":false,"type":"cinderpersistentvolumesource","secretRef":{},"volumeID":"6eb28137-8161-4b72-ab81-d2057a32abcc","fsType":"ext4"},"capacity":{"storage":"10Gi"}}

I believe the error is in file vendor/k8s.io/kubernetes/pkg/apis/core/validation/validation.go line 1183:

func validateCinderVolumeSource(cd *core.CinderVolumeSource, fldPath *field.Path) field.ErrorList {
	allErrs := field.ErrorList{}
	if len(cd.VolumeID) == 0 {
		allErrs = append(allErrs, field.Required(fldPath.Child("volumeID"), ""))
	}
	if cd.SecretRef != nil {
		if len(cd.SecretRef.Name) == 0 {
			allErrs = append(allErrs, field.Required(fldPath.Child("secretRef", "name"), ""))
		}
	}
	return allErrs
}

Since cd.SecretRef is not nil but its empty the request fail

Removing the "secretRef":{} from the request works

Environment information

  • Rancher version (rancher/rancher/rancher/server image tag or shown bottom left in the UI): v2.2.0
  • Installation option (single install/HA): HA

Cluster information

  • Cluster type (Hosted/Infrastructure Provider/Custom/Imported): Infrastructure Provider
  • Machine type (cloud/VM/metal) and specifications (CPU/memory): VM
  • Kubernetes version (use kubectl version):
Client Version: version.Info{Major:"1", Minor:"10", GitVersion:"v1.10.11", GitCommit:"637c7e288581ee40ab4ca210618a89a555b6e7e9", GitTreeState:"clean", BuildDate:"2018-11-26T14:38:32Z", GoVersion:"go1.9.3", Compiler:"gc", Platform:"darwin/amd64"}
Server Version: version.Info{Major:"1", Minor:"13", GitVersion:"v1.13.4", GitCommit:"c27b913fddd1a6c480c229191a087698aa92f0b1", GitTreeState:"clean", BuildDate:"2019-02-28T13:30:26Z", GoVersion:"go1.11.5", Compiler:"gc", Platform:"linux/amd64"}

About this issue

  • Original URL
  • State: closed
  • Created 5 years ago
  • Comments: 18 (5 by maintainers)

Most upvoted comments

@westlywright it was added as part of this commit https://github.com/rancher/types/commit/6420b4e7815924fd6cca37aee27c7360825e1f4d#diff-cff99d771d8b6bbbe54a374ce0dac53bR64

Cinder type was changed from CinderVolumeSource to cinderPersistentVolumeSource in rancher v2.1.7. It was done as a part of changing our k8s vendor from 1.11 to 1.12, which involved some types modifications.

Note : Compared to iscsi volume plugin (as example), where the ui ask for a ‘Secret Name’ and a ‘Secret Namespace’, the cinder volume plugin ui does not ask for this parameters.