Adds datasetUUID for referencing flocker datasets

* flocker datasets should be attached using an unique identifier. This
  is not the case for the name metadata used by datasetName
* allow only one of datasetUUID / datasetName specified
This commit is contained in:
Christian Simon 2016-08-01 11:45:03 +01:00
parent 15daecea7f
commit 1c11047ffb
21 changed files with 36958 additions and 36726 deletions

View File

@ -1813,14 +1813,15 @@
},
"v1.FlockerVolumeSource": {
"id": "v1.FlockerVolumeSource",
"description": "Represents a Flocker volume mounted by the Flocker agent. Flocker volumes do not support ownership management or SELinux relabeling.",
"required": [
"datasetName"
],
"description": "Represents a Flocker volume mounted by the Flocker agent. One and only one of datasetName and datasetUUID should be set. Flocker volumes do not support ownership management or SELinux relabeling.",
"properties": {
"datasetName": {
"type": "string",
"description": "Required: the volume name. This is going to be store on metadata -\u003e name on the payload for Flocker"
"description": "Name of the dataset stored as metadata -\u003e name on the dataset for Flocker should be considered as deprecated"
},
"datasetUUID": {
"type": "string",
"description": "UUID of the dataset. This is unique identifier of a Flocker dataset"
}
}
},

View File

@ -1818,14 +1818,15 @@
},
"v1.FlockerVolumeSource": {
"id": "v1.FlockerVolumeSource",
"description": "Represents a Flocker volume mounted by the Flocker agent. Flocker volumes do not support ownership management or SELinux relabeling.",
"required": [
"datasetName"
],
"description": "Represents a Flocker volume mounted by the Flocker agent. One and only one of datasetName and datasetUUID should be set. Flocker volumes do not support ownership management or SELinux relabeling.",
"properties": {
"datasetName": {
"type": "string",
"description": "Required: the volume name. This is going to be store on metadata -\u003e name on the payload for Flocker"
"description": "Name of the dataset stored as metadata -\u003e name on the dataset for Flocker should be considered as deprecated"
},
"datasetUUID": {
"type": "string",
"description": "UUID of the dataset. This is unique identifier of a Flocker dataset"
}
}
},

View File

@ -8427,14 +8427,15 @@
},
"v1.FlockerVolumeSource": {
"id": "v1.FlockerVolumeSource",
"description": "Represents a Flocker volume mounted by the Flocker agent. Flocker volumes do not support ownership management or SELinux relabeling.",
"required": [
"datasetName"
],
"description": "Represents a Flocker volume mounted by the Flocker agent. One and only one of datasetName and datasetUUID should be set. Flocker volumes do not support ownership management or SELinux relabeling.",
"properties": {
"datasetName": {
"type": "string",
"description": "Required: the volume name. This is going to be store on metadata -\u003e name on the payload for Flocker"
"description": "Name of the dataset stored as metadata -\u003e name on the dataset for Flocker should be considered as deprecated"
},
"datasetUUID": {
"type": "string",
"description": "UUID of the dataset. This is unique identifier of a Flocker dataset"
}
}
},

View File

@ -17638,14 +17638,15 @@
},
"v1.FlockerVolumeSource": {
"id": "v1.FlockerVolumeSource",
"description": "Represents a Flocker volume mounted by the Flocker agent. Flocker volumes do not support ownership management or SELinux relabeling.",
"required": [
"datasetName"
],
"description": "Represents a Flocker volume mounted by the Flocker agent. One and only one of datasetName and datasetUUID should be set. Flocker volumes do not support ownership management or SELinux relabeling.",
"properties": {
"datasetName": {
"type": "string",
"description": "Required: the volume name. This is going to be store on metadata -\u003e name on the payload for Flocker"
"description": "Name of the dataset stored as metadata -\u003e name on the dataset for Flocker should be considered as deprecated"
},
"datasetUUID": {
"type": "string",
"description": "UUID of the dataset. This is unique identifier of a Flocker dataset"
}
}
},

View File

@ -2353,7 +2353,7 @@ Populated by the system when a graceful deletion is requested. Read-only. More i
<div class="sect2">
<h3 id="_v1_flockervolumesource">v1.FlockerVolumeSource</h3>
<div class="paragraph">
<p>Represents a Flocker volume mounted by the Flocker agent. Flocker volumes do not support ownership management or SELinux relabeling.</p>
<p>Represents a Flocker volume mounted by the Flocker agent. One and only one of datasetName and datasetUUID should be set. Flocker volumes do not support ownership management or SELinux relabeling.</p>
</div>
<table class="tableblock frame-all grid-all" style="width:100%; ">
<colgroup>
@ -2375,8 +2375,15 @@ Populated by the system when a graceful deletion is requested. Read-only. More i
<tbody>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock">datasetName</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">Required: the volume name. This is going to be store on metadata &#8594; name on the payload for Flocker</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">true</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">Name of the dataset stored as metadata &#8594; name on the dataset for Flocker should be considered as deprecated</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">false</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">string</p></td>
<td class="tableblock halign-left valign-top"></td>
</tr>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock">datasetUUID</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">UUID of the dataset. This is unique identifier of a Flocker dataset</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">false</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">string</p></td>
<td class="tableblock halign-left valign-top"></td>
</tr>
@ -4389,7 +4396,7 @@ The PetSet guarantees that a given network identity will always map to the same
</div>
<div id="footer">
<div id="footer-text">
Last updated 2016-09-22 17:28:35 UTC
Last updated 2016-09-24 08:31:55 UTC
</div>
</div>
</body>

View File

@ -2284,7 +2284,7 @@ Populated by the system when a graceful deletion is requested. Read-only. More i
<div class="sect2">
<h3 id="_v1_flockervolumesource">v1.FlockerVolumeSource</h3>
<div class="paragraph">
<p>Represents a Flocker volume mounted by the Flocker agent. Flocker volumes do not support ownership management or SELinux relabeling.</p>
<p>Represents a Flocker volume mounted by the Flocker agent. One and only one of datasetName and datasetUUID should be set. Flocker volumes do not support ownership management or SELinux relabeling.</p>
</div>
<table class="tableblock frame-all grid-all" style="width:100%; ">
<colgroup>
@ -2306,8 +2306,15 @@ Populated by the system when a graceful deletion is requested. Read-only. More i
<tbody>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock">datasetName</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">Required: the volume name. This is going to be store on metadata &#8594; name on the payload for Flocker</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">true</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">Name of the dataset stored as metadata &#8594; name on the dataset for Flocker should be considered as deprecated</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">false</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">string</p></td>
<td class="tableblock halign-left valign-top"></td>
</tr>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock">datasetUUID</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">UUID of the dataset. This is unique identifier of a Flocker dataset</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">false</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">string</p></td>
<td class="tableblock halign-left valign-top"></td>
</tr>
@ -4321,7 +4328,7 @@ Populated by the system when a graceful deletion is requested. Read-only. More i
</div>
<div id="footer">
<div id="footer-text">
Last updated 2016-09-18 23:34:31 UTC
Last updated 2016-09-24 08:32:06 UTC
</div>
</div>
</body>

View File

@ -2142,7 +2142,7 @@ Populated by the system when a graceful deletion is requested. Read-only. More i
<div class="sect2">
<h3 id="_v1_flockervolumesource">v1.FlockerVolumeSource</h3>
<div class="paragraph">
<p>Represents a Flocker volume mounted by the Flocker agent. Flocker volumes do not support ownership management or SELinux relabeling.</p>
<p>Represents a Flocker volume mounted by the Flocker agent. One and only one of datasetName and datasetUUID should be set. Flocker volumes do not support ownership management or SELinux relabeling.</p>
</div>
<table class="tableblock frame-all grid-all" style="width:100%; ">
<colgroup>
@ -2164,8 +2164,15 @@ Populated by the system when a graceful deletion is requested. Read-only. More i
<tbody>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock">datasetName</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">Required: the volume name. This is going to be store on metadata &#8594; name on the payload for Flocker</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">true</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">Name of the dataset stored as metadata &#8594; name on the dataset for Flocker should be considered as deprecated</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">false</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">string</p></td>
<td class="tableblock halign-left valign-top"></td>
</tr>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock">datasetUUID</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">UUID of the dataset. This is unique identifier of a Flocker dataset</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">false</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">string</p></td>
<td class="tableblock halign-left valign-top"></td>
</tr>
@ -6590,7 +6597,7 @@ Both these may change in the future. Incoming requests are matched against the h
</div>
<div id="footer">
<div id="footer-text">
Last updated 2016-09-18 23:34:24 UTC
Last updated 2016-09-24 08:32:15 UTC
</div>
</div>
</body>

View File

@ -2568,7 +2568,7 @@ Populated by the system when a graceful deletion is requested. Read-only. More i
<div class="sect2">
<h3 id="_v1_flockervolumesource">v1.FlockerVolumeSource</h3>
<div class="paragraph">
<p>Represents a Flocker volume mounted by the Flocker agent. Flocker volumes do not support ownership management or SELinux relabeling.</p>
<p>Represents a Flocker volume mounted by the Flocker agent. One and only one of datasetName and datasetUUID should be set. Flocker volumes do not support ownership management or SELinux relabeling.</p>
</div>
<table class="tableblock frame-all grid-all" style="width:100%; ">
<colgroup>
@ -2590,8 +2590,15 @@ Populated by the system when a graceful deletion is requested. Read-only. More i
<tbody>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock">datasetName</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">Required: the volume name. This is going to be store on metadata &#8594; name on the payload for Flocker</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">true</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">Name of the dataset stored as metadata &#8594; name on the dataset for Flocker should be considered as deprecated</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">false</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">string</p></td>
<td class="tableblock halign-left valign-top"></td>
</tr>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock">datasetUUID</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">UUID of the dataset. This is unique identifier of a Flocker dataset</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">false</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">string</p></td>
<td class="tableblock halign-left valign-top"></td>
</tr>
@ -8468,7 +8475,7 @@ The resulting set of endpoints can be viewed as:<br>
</div>
<div id="footer">
<div id="footer-text">
Last updated 2016-09-19 23:42:42 UTC
Last updated 2016-09-24 08:31:51 UTC
</div>
</div>
</body>

File diff suppressed because it is too large Load Diff

View File

@ -741,10 +741,14 @@ type CephFSVolumeSource struct {
}
// Represents a Flocker volume mounted by the Flocker agent.
// One and only one of datasetName and datasetUUID should be set.
// Flocker volumes do not support ownership management or SELinux relabeling.
type FlockerVolumeSource struct {
// Required: the volume name. This is going to be store on metadata -> name on the payload for Flocker
DatasetName string `json:"datasetName"`
// Name of the dataset stored as metadata -> name on the dataset for Flocker
// should be considered as deprecated
DatasetName string `json:"datasetName,omitempty"`
// UUID of the dataset. This is unique identifier of a Flocker dataset
DatasetUUID string `json:"datasetUUID,omitempty"`
}
// Represents a volume containing downward API info.

File diff suppressed because it is too large Load Diff

View File

@ -840,10 +840,15 @@ message FlexVolumeSource {
}
// Represents a Flocker volume mounted by the Flocker agent.
// One and only one of datasetName and datasetUUID should be set.
// Flocker volumes do not support ownership management or SELinux relabeling.
message FlockerVolumeSource {
// Required: the volume name. This is going to be store on metadata -> name on the payload for Flocker
// Name of the dataset stored as metadata -> name on the dataset for Flocker
// should be considered as deprecated
optional string datasetName = 1;
// UUID of the dataset. This is unique identifier of a Flocker dataset
optional string datasetUUID = 2;
}
// Represents a Persistent Disk resource in Google Compute Engine.

File diff suppressed because it is too large Load Diff

View File

@ -648,10 +648,14 @@ type CephFSVolumeSource struct {
}
// Represents a Flocker volume mounted by the Flocker agent.
// One and only one of datasetName and datasetUUID should be set.
// Flocker volumes do not support ownership management or SELinux relabeling.
type FlockerVolumeSource struct {
// Required: the volume name. This is going to be store on metadata -> name on the payload for Flocker
DatasetName string `json:"datasetName" protobuf:"bytes,1,opt,name=datasetName"`
// Name of the dataset stored as metadata -> name on the dataset for Flocker
// should be considered as deprecated
DatasetName string `json:"datasetName,omitempty" protobuf:"bytes,1,opt,name=datasetName"`
// UUID of the dataset. This is unique identifier of a Flocker dataset
DatasetUUID string `json:"datasetUUID,omitempty" protobuf:"bytes,2,opt,name=datasetUUID"`
}
// StorageMedium defines ways that storage can be allocated to a volume.

View File

@ -529,8 +529,9 @@ func (FlexVolumeSource) SwaggerDoc() map[string]string {
}
var map_FlockerVolumeSource = map[string]string{
"": "Represents a Flocker volume mounted by the Flocker agent. Flocker volumes do not support ownership management or SELinux relabeling.",
"datasetName": "Required: the volume name. This is going to be store on metadata -> name on the payload for Flocker",
"": "Represents a Flocker volume mounted by the Flocker agent. One and only one of datasetName and datasetUUID should be set. Flocker volumes do not support ownership management or SELinux relabeling.",
"datasetName": "Name of the dataset stored as metadata -> name on the dataset for Flocker should be considered as deprecated",
"datasetUUID": "UUID of the dataset. This is unique identifier of a Flocker dataset",
}
func (FlockerVolumeSource) SwaggerDoc() map[string]string {

View File

@ -2196,6 +2196,7 @@ func Convert_api_FlexVolumeSource_To_v1_FlexVolumeSource(in *api.FlexVolumeSourc
func autoConvert_v1_FlockerVolumeSource_To_api_FlockerVolumeSource(in *FlockerVolumeSource, out *api.FlockerVolumeSource, s conversion.Scope) error {
out.DatasetName = in.DatasetName
out.DatasetUUID = in.DatasetUUID
return nil
}
@ -2205,6 +2206,7 @@ func Convert_v1_FlockerVolumeSource_To_api_FlockerVolumeSource(in *FlockerVolume
func autoConvert_api_FlockerVolumeSource_To_v1_FlockerVolumeSource(in *api.FlockerVolumeSource, out *FlockerVolumeSource, s conversion.Scope) error {
out.DatasetName = in.DatasetName
out.DatasetUUID = in.DatasetUUID
return nil
}

View File

@ -1150,6 +1150,7 @@ func DeepCopy_v1_FlockerVolumeSource(in interface{}, out interface{}, c *convers
in := in.(*FlockerVolumeSource)
out := out.(*FlockerVolumeSource)
out.DatasetName = in.DatasetName
out.DatasetUUID = in.DatasetUUID
return nil
}
}

View File

@ -855,8 +855,12 @@ func validateGlusterfs(glusterfs *api.GlusterfsVolumeSource, fldPath *field.Path
func validateFlockerVolumeSource(flocker *api.FlockerVolumeSource, fldPath *field.Path) field.ErrorList {
allErrs := field.ErrorList{}
if len(flocker.DatasetName) == 0 {
allErrs = append(allErrs, field.Required(fldPath.Child("datasetName"), ""))
if len(flocker.DatasetName) == 0 && len(flocker.DatasetUUID) == 0 {
//TODO: consider adding a RequiredOneOf() error for this and similar cases
allErrs = append(allErrs, field.Required(fldPath, "one of datasetName and datasetUUID is required"))
}
if len(flocker.DatasetName) != 0 && len(flocker.DatasetUUID) != 0 {
allErrs = append(allErrs, field.Invalid(fldPath, "resource", "datasetName and datasetUUID can not be specified simultaneously"))
}
if strings.Contains(flocker.DatasetName, "/") {
allErrs = append(allErrs, field.Invalid(fldPath.Child("datasetName"), flocker.DatasetName, "must not contain '/'"))

View File

@ -1520,7 +1520,18 @@ func TestValidateVolumes(t *testing.T) {
},
// Flocker
{
name: "valid Flocker",
name: "valid Flocker -- datasetUUID",
vol: api.Volume{
Name: "flocker",
VolumeSource: api.VolumeSource{
Flocker: &api.FlockerVolumeSource{
DatasetUUID: "d846b09d-223d-43df-ab5b-d6db2206a0e4",
},
},
},
},
{
name: "valid Flocker -- datasetName",
vol: api.Volume{
Name: "flocker",
VolumeSource: api.VolumeSource{
@ -1531,7 +1542,7 @@ func TestValidateVolumes(t *testing.T) {
},
},
{
name: "empty flocker datasetName",
name: "both empty",
vol: api.Volume{
Name: "flocker",
VolumeSource: api.VolumeSource{
@ -1541,7 +1552,21 @@ func TestValidateVolumes(t *testing.T) {
},
},
errtype: field.ErrorTypeRequired,
errfield: "flocker.datasetName",
errfield: "flocker",
},
{
name: "both specified",
vol: api.Volume{
Name: "flocker",
VolumeSource: api.VolumeSource{
Flocker: &api.FlockerVolumeSource{
DatasetName: "datasetName",
DatasetUUID: "d846b09d-223d-43df-ab5b-d6db2206a0e4",
},
},
},
errtype: field.ErrorTypeInvalid,
errfield: "flocker",
},
{
name: "slash in flocker datasetName",

View File

@ -1178,6 +1178,7 @@ func DeepCopy_api_FlockerVolumeSource(in interface{}, out interface{}, c *conver
in := in.(*FlockerVolumeSource)
out := out.(*FlockerVolumeSource)
out.DatasetName = in.DatasetName
out.DatasetUUID = in.DatasetUUID
return nil
}
}

View File

@ -7896,17 +7896,23 @@ var OpenAPIDefinitions *common.OpenAPIDefinitions = &common.OpenAPIDefinitions{
"v1.FlockerVolumeSource": {
Schema: spec.Schema{
SchemaProps: spec.SchemaProps{
Description: "Represents a Flocker volume mounted by the Flocker agent. Flocker volumes do not support ownership management or SELinux relabeling.",
Description: "Represents a Flocker volume mounted by the Flocker agent. One and only one of datasetName and datasetUUID should be set. Flocker volumes do not support ownership management or SELinux relabeling.",
Properties: map[string]spec.Schema{
"datasetName": {
SchemaProps: spec.SchemaProps{
Description: "Required: the volume name. This is going to be store on metadata -> name on the payload for Flocker",
Description: "Name of the dataset stored as metadata -> name on the dataset for Flocker should be considered as deprecated",
Type: []string{"string"},
Format: "",
},
},
"datasetUUID": {
SchemaProps: spec.SchemaProps{
Description: "UUID of the dataset. This is unique identifier of a Flocker dataset",
Type: []string{"string"},
Format: "",
},
},
},
Required: []string{"datasetName"},
},
},
Dependencies: []string{},