From 54d0a1d342fef68200064f9c5f4fd5aafd344a51 Mon Sep 17 00:00:00 2001 From: Daniel Valdivia <hola@danielvaldivia.com> Date: Thu, 20 Aug 2020 22:46:07 -0700 Subject: [PATCH] Support for labels at pvc level (#254) --- models/zone.go | 3 +++ restapi/admin_tenants.go | 3 ++- restapi/embedded_spec.go | 18 ++++++++++++++++++ swagger.yml | 4 ++++ 4 files changed, 27 insertions(+), 1 deletion(-) diff --git a/models/zone.go b/models/zone.go index cf13d82879..0f3300b634 100644 --- a/models/zone.go +++ b/models/zone.go @@ -207,6 +207,9 @@ func (m *Zone) UnmarshalBinary(b []byte) error { // swagger:model ZoneVolumeConfiguration type ZoneVolumeConfiguration struct { + // labels + Labels map[string]string `json:"labels,omitempty"` + // size // Required: true Size *int64 `json:"size"` diff --git a/restapi/admin_tenants.go b/restapi/admin_tenants.go index dba52dadbe..e274b96194 100644 --- a/restapi/admin_tenants.go +++ b/restapi/admin_tenants.go @@ -1141,7 +1141,8 @@ func parseTenantZoneRequest(zoneParams *models.Zone, annotations map[string]stri // Pass annotations to the volume vct := &corev1.PersistentVolumeClaim{ ObjectMeta: metav1.ObjectMeta{ - Name: "data", + Name: "data", + Labels: zoneParams.VolumeConfiguration.Labels, }, Spec: volTemp, } diff --git a/restapi/embedded_spec.go b/restapi/embedded_spec.go index 7ae0c242fe..b7240eb2f0 100644 --- a/restapi/embedded_spec.go +++ b/restapi/embedded_spec.go @@ -3250,6 +3250,12 @@ func init() { "size" ], "properties": { + "labels": { + "type": "object", + "additionalProperties": { + "type": "string" + } + }, "size": { "type": "integer" }, @@ -5721,6 +5727,12 @@ func init() { "size" ], "properties": { + "labels": { + "type": "object", + "additionalProperties": { + "type": "string" + } + }, "size": { "type": "integer" }, @@ -7126,6 +7138,12 @@ func init() { "size" ], "properties": { + "labels": { + "type": "object", + "additionalProperties": { + "type": "string" + } + }, "size": { "type": "integer" }, diff --git a/swagger.yml b/swagger.yml index b5e41cbfac..dce78fa879 100644 --- a/swagger.yml +++ b/swagger.yml @@ -2088,6 +2088,10 @@ definitions: type: integer storage_class_name: type: string + labels: + type: object + additionalProperties: + type: string resources: $ref: "#/definitions/zoneResources" node_selector: