Generated code for local persistent volumes

pull/6/head
Michelle Au 2017-05-21 12:16:37 -07:00
parent d848be195f
commit 936269a2eb
21 changed files with 4143 additions and 2802 deletions

View File

@ -44496,6 +44496,18 @@
}
}
},
"io.k8s.kubernetes.pkg.api.v1.LocalVolumeSource": {
"description": "Local represents directly-attached storage with node affinity",
"required": [
"path"
],
"properties": {
"path": {
"description": "The full path to the volume on the node For alpha, this path must be a directory Once block as a source is supported, then this path can point to a block device",
"type": "string"
}
}
},
"io.k8s.kubernetes.pkg.api.v1.NFSVolumeSource": {
"description": "Represents an NFS mount that lasts the lifetime of a pod. NFS volumes do not support ownership management or SELinux relabeling.",
"required": [
@ -45273,6 +45285,10 @@
"description": "ISCSI represents an ISCSI Disk resource that is attached to a kubelet's host machine and then exposed to the pod. Provisioned by an admin.",
"$ref": "#/definitions/io.k8s.kubernetes.pkg.api.v1.ISCSIVolumeSource"
},
"local": {
"description": "Local represents directly-attached storage with node affinity",
"$ref": "#/definitions/io.k8s.kubernetes.pkg.api.v1.LocalVolumeSource"
},
"nfs": {
"description": "NFS represents an NFS mount on the host. Provisioned by an admin. More info: https://kubernetes.io/docs/concepts/storage/volumes#nfs",
"$ref": "#/definitions/io.k8s.kubernetes.pkg.api.v1.NFSVolumeSource"

View File

@ -18966,6 +18966,10 @@
"$ref": "v1.ScaleIOVolumeSource",
"description": "ScaleIO represents a ScaleIO persistent volume attached and mounted on Kubernetes nodes."
},
"local": {
"$ref": "v1.LocalVolumeSource",
"description": "Local represents directly-attached storage with node affinity"
},
"accessModes": {
"type": "array",
"items": {
@ -19536,6 +19540,19 @@
}
}
},
"v1.LocalVolumeSource": {
"id": "v1.LocalVolumeSource",
"description": "Local represents directly-attached storage with node affinity",
"required": [
"path"
],
"properties": {
"path": {
"type": "string",
"description": "The full path to the volume on the node For alpha, this path must be a directory Once block as a source is supported, then this path can point to a block device"
}
}
},
"v1.PersistentVolumeStatus": {
"id": "v1.PersistentVolumeStatus",
"description": "PersistentVolumeStatus is the current status of a persistent volume.",

View File

@ -728,6 +728,40 @@ span.icon > [class^="icon-"], span.icon > [class*=" icon-"] { cursor: default; }
</tbody>
</table>
</div>
<div class="sect2">
<h3 id="_v1_localvolumesource">v1.LocalVolumeSource</h3>
<div class="paragraph">
<p>Local represents directly-attached storage with node affinity</p>
</div>
<table class="tableblock frame-all grid-all" style="width:100%; ">
<colgroup>
<col style="width:20%;">
<col style="width:20%;">
<col style="width:20%;">
<col style="width:20%;">
<col style="width:20%;">
</colgroup>
<thead>
<tr>
<th class="tableblock halign-left valign-top">Name</th>
<th class="tableblock halign-left valign-top">Description</th>
<th class="tableblock halign-left valign-top">Required</th>
<th class="tableblock halign-left valign-top">Schema</th>
<th class="tableblock halign-left valign-top">Default</th>
</tr>
</thead>
<tbody>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock">path</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">The full path to the volume on the node For alpha, this path must be a directory Once block as a source is supported, then this path can point to a block device</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">string</p></td>
<td class="tableblock halign-left valign-top"></td>
</tr>
</tbody>
</table>
</div>
<div class="sect2">
<h3 id="_v1_preconditions">v1.Preconditions</h3>
@ -4924,61 +4958,6 @@ The resulting set of endpoints can be viewed as:<br>
</tbody>
</table>
</div>
<div class="sect2">
<h3 id="_v1_limitrange">v1.LimitRange</h3>
<div class="paragraph">
<p>LimitRange sets resource usage limits for each kind of resource in a Namespace.</p>
</div>
<table class="tableblock frame-all grid-all" style="width:100%; ">
<colgroup>
<col style="width:20%;">
<col style="width:20%;">
<col style="width:20%;">
<col style="width:20%;">
<col style="width:20%;">
</colgroup>
<thead>
<tr>
<th class="tableblock halign-left valign-top">Name</th>
<th class="tableblock halign-left valign-top">Description</th>
<th class="tableblock halign-left valign-top">Required</th>
<th class="tableblock halign-left valign-top">Schema</th>
<th class="tableblock halign-left valign-top">Default</th>
</tr>
</thead>
<tbody>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock">kind</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: <a href="http://releases.k8s.io/HEAD/docs/devel/api-conventions.md#types-kinds">http://releases.k8s.io/HEAD/docs/devel/api-conventions.md#types-kinds</a></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">apiVersion</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">APIVersion defines the versioned schema of this representation of an object. Servers should convert recognized schemas to the latest internal value, and may reject unrecognized values. More info: <a href="http://releases.k8s.io/HEAD/docs/devel/api-conventions.md#resources">http://releases.k8s.io/HEAD/docs/devel/api-conventions.md#resources</a></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">metadata</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">Standard object&#8217;s metadata. More info: <a href="https://github.com/kubernetes/community/blob/master/contributors/devel/api-conventions.md#metadata">https://github.com/kubernetes/community/blob/master/contributors/devel/api-conventions.md#metadata</a></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"><a href="#_v1_objectmeta">v1.ObjectMeta</a></p></td>
<td class="tableblock halign-left valign-top"></td>
</tr>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock">spec</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">Spec defines the limits enforced. More info: <a href="https://github.com/kubernetes/community/blob/master/contributors/devel/api-conventions.md#spec-and-status">https://github.com/kubernetes/community/blob/master/contributors/devel/api-conventions.md#spec-and-status</a></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"><a href="#_v1_limitrangespec">v1.LimitRangeSpec</a></p></td>
<td class="tableblock halign-left valign-top"></td>
</tr>
</tbody>
</table>
</div>
<div class="sect2">
<h3 id="_v1_downwardapivolumefile">v1.DownwardAPIVolumeFile</h3>
@ -5034,6 +5013,61 @@ The resulting set of endpoints can be viewed as:<br>
</tbody>
</table>
</div>
<div class="sect2">
<h3 id="_v1_limitrange">v1.LimitRange</h3>
<div class="paragraph">
<p>LimitRange sets resource usage limits for each kind of resource in a Namespace.</p>
</div>
<table class="tableblock frame-all grid-all" style="width:100%; ">
<colgroup>
<col style="width:20%;">
<col style="width:20%;">
<col style="width:20%;">
<col style="width:20%;">
<col style="width:20%;">
</colgroup>
<thead>
<tr>
<th class="tableblock halign-left valign-top">Name</th>
<th class="tableblock halign-left valign-top">Description</th>
<th class="tableblock halign-left valign-top">Required</th>
<th class="tableblock halign-left valign-top">Schema</th>
<th class="tableblock halign-left valign-top">Default</th>
</tr>
</thead>
<tbody>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock">kind</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: <a href="http://releases.k8s.io/HEAD/docs/devel/api-conventions.md#types-kinds">http://releases.k8s.io/HEAD/docs/devel/api-conventions.md#types-kinds</a></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">apiVersion</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">APIVersion defines the versioned schema of this representation of an object. Servers should convert recognized schemas to the latest internal value, and may reject unrecognized values. More info: <a href="http://releases.k8s.io/HEAD/docs/devel/api-conventions.md#resources">http://releases.k8s.io/HEAD/docs/devel/api-conventions.md#resources</a></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">metadata</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">Standard object&#8217;s metadata. More info: <a href="https://github.com/kubernetes/community/blob/master/contributors/devel/api-conventions.md#metadata">https://github.com/kubernetes/community/blob/master/contributors/devel/api-conventions.md#metadata</a></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"><a href="#_v1_objectmeta">v1.ObjectMeta</a></p></td>
<td class="tableblock halign-left valign-top"></td>
</tr>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock">spec</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">Spec defines the limits enforced. More info: <a href="https://github.com/kubernetes/community/blob/master/contributors/devel/api-conventions.md#spec-and-status">https://github.com/kubernetes/community/blob/master/contributors/devel/api-conventions.md#spec-and-status</a></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"><a href="#_v1_limitrangespec">v1.LimitRangeSpec</a></p></td>
<td class="tableblock halign-left valign-top"></td>
</tr>
</tbody>
</table>
</div>
<div class="sect2">
<h3 id="_v1_containerport">v1.ContainerPort</h3>
@ -7342,6 +7376,13 @@ Examples:<br>
<td class="tableblock halign-left valign-top"></td>
</tr>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock">local</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">Local represents directly-attached storage with node affinity</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"><a href="#_v1_localvolumesource">v1.LocalVolumeSource</a></p></td>
<td class="tableblock halign-left valign-top"></td>
</tr>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock">accessModes</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">AccessModes contains all ways the volume can be mounted. More info: <a href="https://kubernetes.io/docs/concepts/storage/persistent-volumes#access-modes">https://kubernetes.io/docs/concepts/storage/persistent-volumes#access-modes</a></p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">false</p></td>
@ -10043,7 +10084,7 @@ Examples:<br>
</div>
<div id="footer">
<div id="footer-text">
Last updated 2017-05-18 19:28:13 UTC
Last updated 2017-05-21 19:00:06 UTC
</div>
</div>
</body>

File diff suppressed because it is too large Load Diff

View File

@ -1440,6 +1440,14 @@ message LocalObjectReference {
optional string name = 1;
}
// Local represents directly-attached storage with node affinity
message LocalVolumeSource {
// The full path to the volume on the node
// For alpha, this path must be a directory
// Once block as a source is supported, then this path can point to a block device
optional string path = 1;
}
// Represents an NFS mount that lasts the lifetime of a pod.
// NFS volumes do not support ownership management or SELinux relabeling.
message NFSVolumeSource {
@ -2202,6 +2210,10 @@ message PersistentVolumeSource {
// ScaleIO represents a ScaleIO persistent volume attached and mounted on Kubernetes nodes.
// +optional
optional ScaleIOVolumeSource scaleIO = 19;
// Local represents directly-attached storage with node affinity
// +optional
optional LocalVolumeSource local = 20;
}
// PersistentVolumeSpec is the specification of a persistent volume.

File diff suppressed because it is too large Load Diff

View File

@ -794,6 +794,15 @@ func (LocalObjectReference) SwaggerDoc() map[string]string {
return map_LocalObjectReference
}
var map_LocalVolumeSource = map[string]string{
"": "Local represents directly-attached storage with node affinity",
"path": "The full path to the volume on the node For alpha, this path must be a directory Once block as a source is supported, then this path can point to a block device",
}
func (LocalVolumeSource) SwaggerDoc() map[string]string {
return map_LocalVolumeSource
}
var map_NFSVolumeSource = map[string]string{
"": "Represents an NFS mount that lasts the lifetime of a pod. NFS volumes do not support ownership management or SELinux relabeling.",
"server": "Server is the hostname or IP address of the NFS server. More info: https://kubernetes.io/docs/concepts/storage/volumes#nfs",
@ -1150,6 +1159,7 @@ var map_PersistentVolumeSource = map[string]string{
"photonPersistentDisk": "PhotonPersistentDisk represents a PhotonController persistent disk attached and mounted on kubelets host machine",
"portworxVolume": "PortworxVolume represents a portworx volume attached and mounted on kubelets host machine",
"scaleIO": "ScaleIO represents a ScaleIO persistent volume attached and mounted on Kubernetes nodes.",
"local": "Local represents directly-attached storage with node affinity",
}
func (PersistentVolumeSource) SwaggerDoc() map[string]string {

View File

@ -173,6 +173,8 @@ func RegisterConversions(scheme *runtime.Scheme) error {
Convert_api_LoadBalancerStatus_To_v1_LoadBalancerStatus,
Convert_v1_LocalObjectReference_To_api_LocalObjectReference,
Convert_api_LocalObjectReference_To_v1_LocalObjectReference,
Convert_v1_LocalVolumeSource_To_api_LocalVolumeSource,
Convert_api_LocalVolumeSource_To_v1_LocalVolumeSource,
Convert_v1_NFSVolumeSource_To_api_NFSVolumeSource,
Convert_api_NFSVolumeSource_To_v1_NFSVolumeSource,
Convert_v1_Namespace_To_api_Namespace,
@ -2166,6 +2168,26 @@ func Convert_api_LocalObjectReference_To_v1_LocalObjectReference(in *api.LocalOb
return autoConvert_api_LocalObjectReference_To_v1_LocalObjectReference(in, out, s)
}
func autoConvert_v1_LocalVolumeSource_To_api_LocalVolumeSource(in *LocalVolumeSource, out *api.LocalVolumeSource, s conversion.Scope) error {
out.Path = in.Path
return nil
}
// Convert_v1_LocalVolumeSource_To_api_LocalVolumeSource is an autogenerated conversion function.
func Convert_v1_LocalVolumeSource_To_api_LocalVolumeSource(in *LocalVolumeSource, out *api.LocalVolumeSource, s conversion.Scope) error {
return autoConvert_v1_LocalVolumeSource_To_api_LocalVolumeSource(in, out, s)
}
func autoConvert_api_LocalVolumeSource_To_v1_LocalVolumeSource(in *api.LocalVolumeSource, out *LocalVolumeSource, s conversion.Scope) error {
out.Path = in.Path
return nil
}
// Convert_api_LocalVolumeSource_To_v1_LocalVolumeSource is an autogenerated conversion function.
func Convert_api_LocalVolumeSource_To_v1_LocalVolumeSource(in *api.LocalVolumeSource, out *LocalVolumeSource, s conversion.Scope) error {
return autoConvert_api_LocalVolumeSource_To_v1_LocalVolumeSource(in, out, s)
}
func autoConvert_v1_NFSVolumeSource_To_api_NFSVolumeSource(in *NFSVolumeSource, out *api.NFSVolumeSource, s conversion.Scope) error {
out.Server = in.Server
out.Path = in.Path
@ -3002,6 +3024,7 @@ func autoConvert_v1_PersistentVolumeSource_To_api_PersistentVolumeSource(in *Per
out.PhotonPersistentDisk = (*api.PhotonPersistentDiskVolumeSource)(unsafe.Pointer(in.PhotonPersistentDisk))
out.PortworxVolume = (*api.PortworxVolumeSource)(unsafe.Pointer(in.PortworxVolume))
out.ScaleIO = (*api.ScaleIOVolumeSource)(unsafe.Pointer(in.ScaleIO))
out.Local = (*api.LocalVolumeSource)(unsafe.Pointer(in.Local))
return nil
}
@ -3030,6 +3053,7 @@ func autoConvert_api_PersistentVolumeSource_To_v1_PersistentVolumeSource(in *api
out.PhotonPersistentDisk = (*PhotonPersistentDiskVolumeSource)(unsafe.Pointer(in.PhotonPersistentDisk))
out.PortworxVolume = (*PortworxVolumeSource)(unsafe.Pointer(in.PortworxVolume))
out.ScaleIO = (*ScaleIOVolumeSource)(unsafe.Pointer(in.ScaleIO))
out.Local = (*LocalVolumeSource)(unsafe.Pointer(in.Local))
return nil
}

View File

@ -104,6 +104,7 @@ func RegisterDeepCopies(scheme *runtime.Scheme) error {
conversion.GeneratedDeepCopyFunc{Fn: DeepCopy_v1_LoadBalancerIngress, InType: reflect.TypeOf(&LoadBalancerIngress{})},
conversion.GeneratedDeepCopyFunc{Fn: DeepCopy_v1_LoadBalancerStatus, InType: reflect.TypeOf(&LoadBalancerStatus{})},
conversion.GeneratedDeepCopyFunc{Fn: DeepCopy_v1_LocalObjectReference, InType: reflect.TypeOf(&LocalObjectReference{})},
conversion.GeneratedDeepCopyFunc{Fn: DeepCopy_v1_LocalVolumeSource, InType: reflect.TypeOf(&LocalVolumeSource{})},
conversion.GeneratedDeepCopyFunc{Fn: DeepCopy_v1_NFSVolumeSource, InType: reflect.TypeOf(&NFSVolumeSource{})},
conversion.GeneratedDeepCopyFunc{Fn: DeepCopy_v1_Namespace, InType: reflect.TypeOf(&Namespace{})},
conversion.GeneratedDeepCopyFunc{Fn: DeepCopy_v1_NamespaceList, InType: reflect.TypeOf(&NamespaceList{})},
@ -1495,6 +1496,16 @@ func DeepCopy_v1_LocalObjectReference(in interface{}, out interface{}, c *conver
}
}
// DeepCopy_v1_LocalVolumeSource is an autogenerated deepcopy function.
func DeepCopy_v1_LocalVolumeSource(in interface{}, out interface{}, c *conversion.Cloner) error {
{
in := in.(*LocalVolumeSource)
out := out.(*LocalVolumeSource)
*out = *in
return nil
}
}
// DeepCopy_v1_NFSVolumeSource is an autogenerated deepcopy function.
func DeepCopy_v1_NFSVolumeSource(in interface{}, out interface{}, c *conversion.Cloner) error {
{
@ -2165,6 +2176,11 @@ func DeepCopy_v1_PersistentVolumeSource(in interface{}, out interface{}, c *conv
return err
}
}
if in.Local != nil {
in, out := &in.Local, &out.Local
*out = new(LocalVolumeSource)
**out = **in
}
return nil
}
}

View File

@ -106,6 +106,7 @@ func RegisterDeepCopies(scheme *runtime.Scheme) error {
conversion.GeneratedDeepCopyFunc{Fn: DeepCopy_api_LoadBalancerIngress, InType: reflect.TypeOf(&LoadBalancerIngress{})},
conversion.GeneratedDeepCopyFunc{Fn: DeepCopy_api_LoadBalancerStatus, InType: reflect.TypeOf(&LoadBalancerStatus{})},
conversion.GeneratedDeepCopyFunc{Fn: DeepCopy_api_LocalObjectReference, InType: reflect.TypeOf(&LocalObjectReference{})},
conversion.GeneratedDeepCopyFunc{Fn: DeepCopy_api_LocalVolumeSource, InType: reflect.TypeOf(&LocalVolumeSource{})},
conversion.GeneratedDeepCopyFunc{Fn: DeepCopy_api_NFSVolumeSource, InType: reflect.TypeOf(&NFSVolumeSource{})},
conversion.GeneratedDeepCopyFunc{Fn: DeepCopy_api_Namespace, InType: reflect.TypeOf(&Namespace{})},
conversion.GeneratedDeepCopyFunc{Fn: DeepCopy_api_NamespaceList, InType: reflect.TypeOf(&NamespaceList{})},
@ -1513,6 +1514,16 @@ func DeepCopy_api_LocalObjectReference(in interface{}, out interface{}, c *conve
}
}
// DeepCopy_api_LocalVolumeSource is an autogenerated deepcopy function.
func DeepCopy_api_LocalVolumeSource(in interface{}, out interface{}, c *conversion.Cloner) error {
{
in := in.(*LocalVolumeSource)
out := out.(*LocalVolumeSource)
*out = *in
return nil
}
}
// DeepCopy_api_NFSVolumeSource is an autogenerated deepcopy function.
func DeepCopy_api_NFSVolumeSource(in interface{}, out interface{}, c *conversion.Cloner) error {
{
@ -2183,6 +2194,11 @@ func DeepCopy_api_PersistentVolumeSource(in interface{}, out interface{}, c *con
return err
}
}
if in.Local != nil {
in, out := &in.Local, &out.Local
*out = new(LocalVolumeSource)
**out = **in
}
return nil
}
}

View File

@ -594,3 +594,29 @@ func PersistentVolumeClaimHasClass(claim *api.PersistentVolumeClaim) bool {
return false
}
// GetStorageNodeAffinityFromAnnotation gets the json serialized data from PersistentVolume.Annotations
// and converts it to the NodeAffinity type in api.
// TODO: update when storage node affinity graduates to beta
func GetStorageNodeAffinityFromAnnotation(annotations map[string]string) (*api.NodeAffinity, error) {
if len(annotations) > 0 && annotations[api.AlphaStorageNodeAffinityAnnotation] != "" {
var affinity api.NodeAffinity
err := json.Unmarshal([]byte(annotations[api.AlphaStorageNodeAffinityAnnotation]), &affinity)
if err != nil {
return nil, err
}
return &affinity, nil
}
return nil, nil
}
// Converts NodeAffinity type to Alpha annotation for use in PersistentVolumes
// TODO: update when storage node affinity graduates to beta
func StorageNodeAffinityToAlphaAnnotation(annotations map[string]string, affinity *api.NodeAffinity) error {
json, err := json.Marshal(*affinity)
if err != nil {
return err
}
annotations[api.AlphaStorageNodeAffinityAnnotation] = string(json)
return nil
}

View File

@ -266,3 +266,90 @@ func TestSysctlsFromPodAnnotation(t *testing.T) {
}
}
}
// TODO: remove when alpha support for topology constraints is removed
func TestGetNodeAffinityFromAnnotations(t *testing.T) {
testCases := []struct {
annotations map[string]string
expectErr bool
}{
{
annotations: nil,
expectErr: false,
},
{
annotations: map[string]string{},
expectErr: false,
},
{
annotations: map[string]string{
api.AlphaStorageNodeAffinityAnnotation: `{
"requiredDuringSchedulingIgnoredDuringExecution": {
"nodeSelectorTerms": [
{ "matchExpressions": [
{ "key": "test-key1",
"operator": "In",
"values": ["test-value1", "test-value2"]
},
{ "key": "test-key2",
"operator": "In",
"values": ["test-value1", "test-value2"]
}
]}
]}
}`,
},
expectErr: false,
},
{
annotations: map[string]string{
api.AlphaStorageNodeAffinityAnnotation: `[{
"requiredDuringSchedulingIgnoredDuringExecution": {
"nodeSelectorTerms": [
{ "matchExpressions": [
{ "key": "test-key1",
"operator": "In",
"values": ["test-value1", "test-value2"]
},
{ "key": "test-key2",
"operator": "In",
"values": ["test-value1", "test-value2"]
}
]}
]}
}]`,
},
expectErr: true,
},
{
annotations: map[string]string{
api.AlphaStorageNodeAffinityAnnotation: `{
"requiredDuringSchedulingIgnoredDuringExecution": {
"nodeSelectorTerms":
"matchExpressions": [
{ "key": "test-key1",
"operator": "In",
"values": ["test-value1", "test-value2"]
},
{ "key": "test-key2",
"operator": "In",
"values": ["test-value1", "test-value2"]
}
]}
}
}`,
},
expectErr: true,
},
}
for i, tc := range testCases {
_, err := GetStorageNodeAffinityFromAnnotation(tc.annotations)
if err == nil && tc.expectErr {
t.Errorf("[%v]expected error but got none.", i)
}
if err != nil && !tc.expectErr {
t.Errorf("[%v]did not expect error but got: %v", i, err)
}
}
}

View File

@ -381,6 +381,9 @@ type PersistentVolumeSource struct {
// ScaleIO represents a ScaleIO persistent volume attached and mounted on Kubernetes nodes.
// +optional
ScaleIO *ScaleIOVolumeSource
// Local represents directly-attached storage with node affinity
// +optional
Local *LocalVolumeSource
}
type PersistentVolumeClaimVolumeSource struct {
@ -399,6 +402,10 @@ const (
// MountOptionAnnotation defines mount option annotation used in PVs
MountOptionAnnotation = "volume.beta.kubernetes.io/mount-options"
// AlphaStorageNodeAffinityAnnotation defines node affinity policies for a PersistentVolume.
// Value is a string of the json representation of type NodeAffinity
AlphaStorageNodeAffinityAnnotation = "volume.alpha.kubernetes.io/node-affinity"
)
// +genclient=true
@ -1223,6 +1230,14 @@ type KeyToPath struct {
Mode *int32
}
// Local represents directly-attached storage with node affinity
type LocalVolumeSource struct {
// The full path to the volume on the node
// For alpha, this path must be a directory
// Once block as a source is supported, then this path can point to a block device
Path string
}
// ContainerPort represents a network port in a single container
type ContainerPort struct {
// Optional: If specified, this must be an IANA_SVC_NAME Each named port

File diff suppressed because it is too large Load Diff

View File

@ -1440,6 +1440,14 @@ message LocalObjectReference {
optional string name = 1;
}
// Local represents directly-attached storage with node affinity
message LocalVolumeSource {
// The full path to the volume on the node
// For alpha, this path must be a directory
// Once block as a source is supported, then this path can point to a block device
optional string path = 1;
}
// Represents an NFS mount that lasts the lifetime of a pod.
// NFS volumes do not support ownership management or SELinux relabeling.
message NFSVolumeSource {
@ -2202,6 +2210,10 @@ message PersistentVolumeSource {
// ScaleIO represents a ScaleIO persistent volume attached and mounted on Kubernetes nodes.
// +optional
optional ScaleIOVolumeSource scaleIO = 19;
// Local represents directly-attached storage with node affinity
// +optional
optional LocalVolumeSource local = 20;
}
// PersistentVolumeSpec is the specification of a persistent volume.

File diff suppressed because it is too large Load Diff

View File

@ -439,6 +439,9 @@ type PersistentVolumeSource struct {
// ScaleIO represents a ScaleIO persistent volume attached and mounted on Kubernetes nodes.
// +optional
ScaleIO *ScaleIOVolumeSource `json:"scaleIO,omitempty" protobuf:"bytes,19,opt,name=scaleIO"`
// Local represents directly-attached storage with node affinity
// +optional
Local *LocalVolumeSource `json:"local,omitempty" protobuf:"bytes,20,opt,name=local"`
}
const (
@ -448,6 +451,10 @@ const (
// MountOptionAnnotation defines mount option annotation used in PVs
MountOptionAnnotation = "volume.beta.kubernetes.io/mount-options"
// AlphaStorageNodeAffinityAnnotation defines node affinity policies for a PersistentVolume.
// Value is a string of the json representation of type NodeAffinity
AlphaStorageNodeAffinityAnnotation = "volume.alpha.kubernetes.io/node-affinity"
)
// +genclient=true
@ -1310,6 +1317,14 @@ type KeyToPath struct {
Mode *int32 `json:"mode,omitempty" protobuf:"varint,3,opt,name=mode"`
}
// Local represents directly-attached storage with node affinity
type LocalVolumeSource struct {
// The full path to the volume on the node
// For alpha, this path must be a directory
// Once block as a source is supported, then this path can point to a block device
Path string `json:"path" protobuf:"bytes,1,opt,name=path"`
}
// ContainerPort represents a network port in a single container.
type ContainerPort struct {
// If specified, this must be an IANA_SVC_NAME and unique within the pod. Each

View File

@ -794,6 +794,15 @@ func (LocalObjectReference) SwaggerDoc() map[string]string {
return map_LocalObjectReference
}
var map_LocalVolumeSource = map[string]string{
"": "Local represents directly-attached storage with node affinity",
"path": "The full path to the volume on the node For alpha, this path must be a directory Once block as a source is supported, then this path can point to a block device",
}
func (LocalVolumeSource) SwaggerDoc() map[string]string {
return map_LocalVolumeSource
}
var map_NFSVolumeSource = map[string]string{
"": "Represents an NFS mount that lasts the lifetime of a pod. NFS volumes do not support ownership management or SELinux relabeling.",
"server": "Server is the hostname or IP address of the NFS server. More info: https://kubernetes.io/docs/concepts/storage/volumes#nfs",
@ -1150,6 +1159,7 @@ var map_PersistentVolumeSource = map[string]string{
"photonPersistentDisk": "PhotonPersistentDisk represents a PhotonController persistent disk attached and mounted on kubelets host machine",
"portworxVolume": "PortworxVolume represents a portworx volume attached and mounted on kubelets host machine",
"scaleIO": "ScaleIO represents a ScaleIO persistent volume attached and mounted on Kubernetes nodes.",
"local": "Local represents directly-attached storage with node affinity",
}
func (PersistentVolumeSource) SwaggerDoc() map[string]string {

View File

@ -173,6 +173,8 @@ func RegisterConversions(scheme *runtime.Scheme) error {
Convert_api_LoadBalancerStatus_To_v1_LoadBalancerStatus,
Convert_v1_LocalObjectReference_To_api_LocalObjectReference,
Convert_api_LocalObjectReference_To_v1_LocalObjectReference,
Convert_v1_LocalVolumeSource_To_api_LocalVolumeSource,
Convert_api_LocalVolumeSource_To_v1_LocalVolumeSource,
Convert_v1_NFSVolumeSource_To_api_NFSVolumeSource,
Convert_api_NFSVolumeSource_To_v1_NFSVolumeSource,
Convert_v1_Namespace_To_api_Namespace,
@ -2166,6 +2168,26 @@ func Convert_api_LocalObjectReference_To_v1_LocalObjectReference(in *api.LocalOb
return autoConvert_api_LocalObjectReference_To_v1_LocalObjectReference(in, out, s)
}
func autoConvert_v1_LocalVolumeSource_To_api_LocalVolumeSource(in *LocalVolumeSource, out *api.LocalVolumeSource, s conversion.Scope) error {
out.Path = in.Path
return nil
}
// Convert_v1_LocalVolumeSource_To_api_LocalVolumeSource is an autogenerated conversion function.
func Convert_v1_LocalVolumeSource_To_api_LocalVolumeSource(in *LocalVolumeSource, out *api.LocalVolumeSource, s conversion.Scope) error {
return autoConvert_v1_LocalVolumeSource_To_api_LocalVolumeSource(in, out, s)
}
func autoConvert_api_LocalVolumeSource_To_v1_LocalVolumeSource(in *api.LocalVolumeSource, out *LocalVolumeSource, s conversion.Scope) error {
out.Path = in.Path
return nil
}
// Convert_api_LocalVolumeSource_To_v1_LocalVolumeSource is an autogenerated conversion function.
func Convert_api_LocalVolumeSource_To_v1_LocalVolumeSource(in *api.LocalVolumeSource, out *LocalVolumeSource, s conversion.Scope) error {
return autoConvert_api_LocalVolumeSource_To_v1_LocalVolumeSource(in, out, s)
}
func autoConvert_v1_NFSVolumeSource_To_api_NFSVolumeSource(in *NFSVolumeSource, out *api.NFSVolumeSource, s conversion.Scope) error {
out.Server = in.Server
out.Path = in.Path
@ -3002,6 +3024,7 @@ func autoConvert_v1_PersistentVolumeSource_To_api_PersistentVolumeSource(in *Per
out.PhotonPersistentDisk = (*api.PhotonPersistentDiskVolumeSource)(unsafe.Pointer(in.PhotonPersistentDisk))
out.PortworxVolume = (*api.PortworxVolumeSource)(unsafe.Pointer(in.PortworxVolume))
out.ScaleIO = (*api.ScaleIOVolumeSource)(unsafe.Pointer(in.ScaleIO))
out.Local = (*api.LocalVolumeSource)(unsafe.Pointer(in.Local))
return nil
}
@ -3030,6 +3053,7 @@ func autoConvert_api_PersistentVolumeSource_To_v1_PersistentVolumeSource(in *api
out.PhotonPersistentDisk = (*PhotonPersistentDiskVolumeSource)(unsafe.Pointer(in.PhotonPersistentDisk))
out.PortworxVolume = (*PortworxVolumeSource)(unsafe.Pointer(in.PortworxVolume))
out.ScaleIO = (*ScaleIOVolumeSource)(unsafe.Pointer(in.ScaleIO))
out.Local = (*LocalVolumeSource)(unsafe.Pointer(in.Local))
return nil
}

View File

@ -104,6 +104,7 @@ func RegisterDeepCopies(scheme *runtime.Scheme) error {
conversion.GeneratedDeepCopyFunc{Fn: DeepCopy_v1_LoadBalancerIngress, InType: reflect.TypeOf(&LoadBalancerIngress{})},
conversion.GeneratedDeepCopyFunc{Fn: DeepCopy_v1_LoadBalancerStatus, InType: reflect.TypeOf(&LoadBalancerStatus{})},
conversion.GeneratedDeepCopyFunc{Fn: DeepCopy_v1_LocalObjectReference, InType: reflect.TypeOf(&LocalObjectReference{})},
conversion.GeneratedDeepCopyFunc{Fn: DeepCopy_v1_LocalVolumeSource, InType: reflect.TypeOf(&LocalVolumeSource{})},
conversion.GeneratedDeepCopyFunc{Fn: DeepCopy_v1_NFSVolumeSource, InType: reflect.TypeOf(&NFSVolumeSource{})},
conversion.GeneratedDeepCopyFunc{Fn: DeepCopy_v1_Namespace, InType: reflect.TypeOf(&Namespace{})},
conversion.GeneratedDeepCopyFunc{Fn: DeepCopy_v1_NamespaceList, InType: reflect.TypeOf(&NamespaceList{})},
@ -1495,6 +1496,16 @@ func DeepCopy_v1_LocalObjectReference(in interface{}, out interface{}, c *conver
}
}
// DeepCopy_v1_LocalVolumeSource is an autogenerated deepcopy function.
func DeepCopy_v1_LocalVolumeSource(in interface{}, out interface{}, c *conversion.Cloner) error {
{
in := in.(*LocalVolumeSource)
out := out.(*LocalVolumeSource)
*out = *in
return nil
}
}
// DeepCopy_v1_NFSVolumeSource is an autogenerated deepcopy function.
func DeepCopy_v1_NFSVolumeSource(in interface{}, out interface{}, c *conversion.Cloner) error {
{
@ -2165,6 +2176,11 @@ func DeepCopy_v1_PersistentVolumeSource(in interface{}, out interface{}, c *conv
return err
}
}
if in.Local != nil {
in, out := &in.Local, &out.Local
*out = new(LocalVolumeSource)
**out = **in
}
return nil
}
}

View File

@ -106,6 +106,7 @@ func RegisterDeepCopies(scheme *runtime.Scheme) error {
conversion.GeneratedDeepCopyFunc{Fn: DeepCopy_api_LoadBalancerIngress, InType: reflect.TypeOf(&LoadBalancerIngress{})},
conversion.GeneratedDeepCopyFunc{Fn: DeepCopy_api_LoadBalancerStatus, InType: reflect.TypeOf(&LoadBalancerStatus{})},
conversion.GeneratedDeepCopyFunc{Fn: DeepCopy_api_LocalObjectReference, InType: reflect.TypeOf(&LocalObjectReference{})},
conversion.GeneratedDeepCopyFunc{Fn: DeepCopy_api_LocalVolumeSource, InType: reflect.TypeOf(&LocalVolumeSource{})},
conversion.GeneratedDeepCopyFunc{Fn: DeepCopy_api_NFSVolumeSource, InType: reflect.TypeOf(&NFSVolumeSource{})},
conversion.GeneratedDeepCopyFunc{Fn: DeepCopy_api_Namespace, InType: reflect.TypeOf(&Namespace{})},
conversion.GeneratedDeepCopyFunc{Fn: DeepCopy_api_NamespaceList, InType: reflect.TypeOf(&NamespaceList{})},
@ -1513,6 +1514,16 @@ func DeepCopy_api_LocalObjectReference(in interface{}, out interface{}, c *conve
}
}
// DeepCopy_api_LocalVolumeSource is an autogenerated deepcopy function.
func DeepCopy_api_LocalVolumeSource(in interface{}, out interface{}, c *conversion.Cloner) error {
{
in := in.(*LocalVolumeSource)
out := out.(*LocalVolumeSource)
*out = *in
return nil
}
}
// DeepCopy_api_NFSVolumeSource is an autogenerated deepcopy function.
func DeepCopy_api_NFSVolumeSource(in interface{}, out interface{}, c *conversion.Cloner) error {
{
@ -2183,6 +2194,11 @@ func DeepCopy_api_PersistentVolumeSource(in interface{}, out interface{}, c *con
return err
}
}
if in.Local != nil {
in, out := &in.Local, &out.Local
*out = new(LocalVolumeSource)
**out = **in
}
return nil
}
}