From cebb13fdccf3cfc8735d55c74770270487a9975a Mon Sep 17 00:00:00 2001 From: Darren Shepherd Date: Mon, 19 Mar 2018 14:58:12 -0700 Subject: [PATCH] Fix some PV types --- apis/cluster.cattle.io/v3/schema/schema.go | 3 +++ apis/project.cattle.io/v3/schema/schema.go | 18 ++++++++++++++++++ 2 files changed, 21 insertions(+) diff --git a/apis/cluster.cattle.io/v3/schema/schema.go b/apis/cluster.cattle.io/v3/schema/schema.go index 9c60da36..bb3c2252 100644 --- a/apis/cluster.cattle.io/v3/schema/schema.go +++ b/apis/cluster.cattle.io/v3/schema/schema.go @@ -41,6 +41,9 @@ func namespaceTypes(schemas *types.Schemas) *types.Schemas { func persistentVolumeTypes(schemas *types.Schemas) *types.Schemas { return schemas. + MustImport(&Version, v1.PersistentVolumeSpec{}, struct { + StorageClassName *string `json:"storageClassName,omitempty" norman:"type=reference[storageClass]"` + }{}). MustImport(&Version, v1.PersistentVolume{}) } diff --git a/apis/project.cattle.io/v3/schema/schema.go b/apis/project.cattle.io/v3/schema/schema.go index 6ceaad32..9caeae41 100644 --- a/apis/project.cattle.io/v3/schema/schema.go +++ b/apis/project.cattle.io/v3/schema/schema.go @@ -625,6 +625,21 @@ func ingressTypes(schemas *types.Schemas) *types.Schemas { func volumeTypes(schemas *types.Schemas) *types.Schemas { return schemas. + AddMapperForType(&Version, v1.HostPathVolumeSource{}, + m.Move{From: "type", To: "kind"}, + m.Enum{ + Options: []string{ + "DirectoryOrCreate", + "Directory", + "FileOrCreate", + "File", + "Socket", + "CharDevice", + "BlockDevice", + }, + Field: "kind", + }, + ). AddMapperForType(&Version, v1.ResourceRequirements{}, mapper.PivotMapper{Plural: true}, ). @@ -639,6 +654,9 @@ func volumeTypes(schemas *types.Schemas) *types.Schemas { }{}). MustImport(&Version, v1.Volume{}, struct { }{}). + MustImport(&Version, v1.PersistentVolumeSpec{}, struct { + StorageClassName *string `json:"storageClassName,omitempty" norman:"type=reference[/v3/cluster/storageClass]"` + }{}). MustImport(&Version, v1.PersistentVolumeClaimSpec{}, struct { AccessModes []string `json:"accessModes,omitempty" norman:"type=array[enum],options=ReadWriteOnce|ReadOnlyMany|ReadWriteMany"` VolumeName string `json:"volumeName,omitempty" norman:"type=reference[/v3/cluster/persistentVolume]"`