Skip to content
This repository was archived by the owner on Aug 14, 2021. It is now read-only.

Commit afd4d17

Browse files
author
Amit Kumar Das
authored
Merge pull request #44 from kmova/pass-thru-labels
Pass sts replica scheduling labels to apiserver
2 parents c742c31 + 4588d21 commit afd4d17

File tree

2 files changed

+15
-1
lines changed

2 files changed

+15
-1
lines changed

openebs/openebs-provisioner.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -111,6 +111,11 @@ func (p *openEBSProvisioner) Provision(options controller.VolumeOptions) (*v1.Pe
111111
volumeSpec.Metadata.Labels.PersistentVolumeClaim = options.PVC.ObjectMeta.Name
112112
volumeSpec.Metadata.Name = options.PVName
113113

114+
//Pass through labels from PVC to maya-apiserver
115+
volumeSpec.Metadata.Labels.Application = options.PVC.ObjectMeta.GetLabels()[mayav1.PVCLabelsApplication]
116+
volumeSpec.Metadata.Labels.ReplicaTopoKeyDomain = options.PVC.ObjectMeta.GetLabels()[mayav1.PVCLabelsReplicaTopKeyDomain]
117+
volumeSpec.Metadata.Labels.ReplicaTopoKeyType = options.PVC.ObjectMeta.GetLabels()[mayav1.PVCLabelsReplicaTopKeyType]
118+
114119
_, err := openebsVol.CreateVolume(volumeSpec)
115120
if err != nil {
116121
glog.Errorf("Error creating volume: %v", err)

openebs/types/v1/types.go

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,13 @@ limitations under the License.
1616

1717
package v1
1818

19-
//VolumeSpec holds the config for creating a VSM
19+
const (
20+
PVCLabelsApplication = "volumeprovisioner.mapi.openebs.io/application"
21+
PVCLabelsReplicaTopKeyDomain = "volumeprovisioner.mapi.openebs.io/replica-topology-key-domain"
22+
PVCLabelsReplicaTopKeyType = "volumeprovisioner.mapi.openebs.io/replica-topology-key-type"
23+
)
24+
25+
//VolumeSpec holds the config for creating a OpenEBS Volume
2026
type VolumeSpec struct {
2127
Kind string `yaml:"kind"`
2228
APIVersion string `yaml:"apiVersion"`
@@ -27,6 +33,9 @@ type VolumeSpec struct {
2733
StorageClass string `yaml:"k8s.io/storage-class"`
2834
Namespace string `yaml:"k8s.io/namespace"`
2935
PersistentVolumeClaim string `yaml:"k8s.io/pvc"`
36+
Application string `yaml:"volumeprovisioner.mapi.openebs.io/application,omitempty"`
37+
ReplicaTopoKeyDomain string `yaml:"volumeprovisioner.mapi.openebs.io/replica-topology-key-domain,omitempty"`
38+
ReplicaTopoKeyType string `yaml:"volumeprovisioner.mapi.openebs.io/replica-topology-key-type,omitempty"`
3039
} `yaml:"labels"`
3140
} `yaml:"metadata"`
3241
CloneIP string `yaml:"cloneIP"`

0 commit comments

Comments
 (0)