1
0
mirror of https://github.com/rancher/types.git synced 2025-07-15 06:01:35 +00:00

Merge pull request #323 from zionwu/fixstorage

Add description field to storage class and pv
This commit is contained in:
Alena Prokharchyk 2018-03-29 20:28:42 -07:00 committed by GitHub
commit a3c20dab66
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 14 additions and 1 deletions

View File

@ -41,15 +41,24 @@ func namespaceTypes(schemas *types.Schemas) *types.Schemas {
func persistentVolumeTypes(schemas *types.Schemas) *types.Schemas {
return schemas.
AddMapperForType(&Version, v1.PersistentVolume{},
&m.AnnotationField{Field: "description"},
).
MustImport(&Version, v1.PersistentVolumeSpec{}, struct {
StorageClassName *string `json:"storageClassName,omitempty" norman:"type=reference[storageClass]"`
}{}).
MustImport(&Version, v1.PersistentVolume{})
MustImport(&Version, v1.PersistentVolume{}, struct {
Description string `json:"description"`
}{})
}
func storageClassTypes(schemas *types.Schemas) *types.Schemas {
return schemas.
AddMapperForType(&Version, storagev1.StorageClass{},
&m.AnnotationField{Field: "description"},
).
MustImport(&Version, storagev1.StorageClass{}, struct {
Description string `json:"description"`
ReclaimPolicy string `json:"reclaimPolicy,omitempty" norman:"type=enum,options=Recycle|Delete|Retain"`
}{})
}

View File

@ -17,6 +17,7 @@ const (
PersistentVolumeFieldClaimRef = "claimRef"
PersistentVolumeFieldCreated = "created"
PersistentVolumeFieldCreatorID = "creatorId"
PersistentVolumeFieldDescription = "description"
PersistentVolumeFieldFC = "fc"
PersistentVolumeFieldFlexVolume = "flexVolume"
PersistentVolumeFieldFlocker = "flocker"
@ -60,6 +61,7 @@ type PersistentVolume struct {
ClaimRef *ObjectReference `json:"claimRef,omitempty" yaml:"claimRef,omitempty"`
Created string `json:"created,omitempty" yaml:"created,omitempty"`
CreatorID string `json:"creatorId,omitempty" yaml:"creatorId,omitempty"`
Description string `json:"description,omitempty" yaml:"description,omitempty"`
FC *FCVolumeSource `json:"fc,omitempty" yaml:"fc,omitempty"`
FlexVolume *FlexVolumeSource `json:"flexVolume,omitempty" yaml:"flexVolume,omitempty"`
Flocker *FlockerVolumeSource `json:"flocker,omitempty" yaml:"flocker,omitempty"`

View File

@ -10,6 +10,7 @@ const (
StorageClassFieldAnnotations = "annotations"
StorageClassFieldCreated = "created"
StorageClassFieldCreatorID = "creatorId"
StorageClassFieldDescription = "description"
StorageClassFieldLabels = "labels"
StorageClassFieldMountOptions = "mountOptions"
StorageClassFieldName = "name"
@ -27,6 +28,7 @@ type StorageClass struct {
Annotations map[string]string `json:"annotations,omitempty" yaml:"annotations,omitempty"`
Created string `json:"created,omitempty" yaml:"created,omitempty"`
CreatorID string `json:"creatorId,omitempty" yaml:"creatorId,omitempty"`
Description string `json:"description,omitempty" yaml:"description,omitempty"`
Labels map[string]string `json:"labels,omitempty" yaml:"labels,omitempty"`
MountOptions []string `json:"mountOptions,omitempty" yaml:"mountOptions,omitempty"`
Name string `json:"name,omitempty" yaml:"name,omitempty"`