diff --git a/openebs/openebs-provisioner.go b/openebs/openebs-provisioner.go index c262c72b9e5..296ea52612d 100644 --- a/openebs/openebs-provisioner.go +++ b/openebs/openebs-provisioner.go @@ -111,6 +111,11 @@ func (p *openEBSProvisioner) Provision(options controller.VolumeOptions) (*v1.Pe volumeSpec.Metadata.Labels.PersistentVolumeClaim = options.PVC.ObjectMeta.Name volumeSpec.Metadata.Name = options.PVName + //Pass through labels from PVC to maya-apiserver + volumeSpec.Metadata.Labels.Application = options.PVC.ObjectMeta.GetLabels()[mayav1.PVCLabelsApplication] + volumeSpec.Metadata.Labels.ReplicaTopoKeyDomain = options.PVC.ObjectMeta.GetLabels()[mayav1.PVCLabelsReplicaTopKeyDomain] + volumeSpec.Metadata.Labels.ReplicaTopoKeyType = options.PVC.ObjectMeta.GetLabels()[mayav1.PVCLabelsReplicaTopKeyType] + _, err := openebsVol.CreateVolume(volumeSpec) if err != nil { glog.Errorf("Error creating volume: %v", err) diff --git a/openebs/types/v1/types.go b/openebs/types/v1/types.go index 764b1c59d5a..8da4d623a9f 100644 --- a/openebs/types/v1/types.go +++ b/openebs/types/v1/types.go @@ -16,7 +16,13 @@ limitations under the License. package v1 -//VolumeSpec holds the config for creating a VSM +const ( + PVCLabelsApplication = "volumeprovisioner.mapi.openebs.io/application" + PVCLabelsReplicaTopKeyDomain = "volumeprovisioner.mapi.openebs.io/replica-topology-key-domain" + PVCLabelsReplicaTopKeyType = "volumeprovisioner.mapi.openebs.io/replica-topology-key-type" +) + +//VolumeSpec holds the config for creating a OpenEBS Volume type VolumeSpec struct { Kind string `yaml:"kind"` APIVersion string `yaml:"apiVersion"` @@ -27,6 +33,9 @@ type VolumeSpec struct { StorageClass string `yaml:"k8s.io/storage-class"` Namespace string `yaml:"k8s.io/namespace"` PersistentVolumeClaim string `yaml:"k8s.io/pvc"` + Application string `yaml:"volumeprovisioner.mapi.openebs.io/application,omitempty"` + ReplicaTopoKeyDomain string `yaml:"volumeprovisioner.mapi.openebs.io/replica-topology-key-domain,omitempty"` + ReplicaTopoKeyType string `yaml:"volumeprovisioner.mapi.openebs.io/replica-topology-key-type,omitempty"` } `yaml:"labels"` } `yaml:"metadata"` CloneIP string `yaml:"cloneIP"`