diff --git a/apis/cluster.cattle.io/v3/schema/schema.go b/apis/cluster.cattle.io/v3/schema/schema.go index cc7097fd..b5bfcee0 100644 --- a/apis/cluster.cattle.io/v3/schema/schema.go +++ b/apis/cluster.cattle.io/v3/schema/schema.go @@ -85,6 +85,12 @@ func persistentVolumeTypes(schemas *types.Schemas) *types.Schemas { Description string `json:"description"` }{}). MustImportAndCustomize(&Version, v1.PersistentVolume{}, func(schema *types.Schema) { + schema.MustCustomizeField("name", func(field types.Field) types.Field { + field.Type = "hostname" + field.Nullable = false + field.Required = true + return field + }) schema.MustCustomizeField("volumeMode", func(field types.Field) types.Field { field.Update = false return field diff --git a/apis/management.cattle.io/v3/schema/schema.go b/apis/management.cattle.io/v3/schema/schema.go index b2ab8d69..e927584c 100644 --- a/apis/management.cattle.io/v3/schema/schema.go +++ b/apis/management.cattle.io/v3/schema/schema.go @@ -98,6 +98,12 @@ func mgmtSecretTypes(schemas *types.Schemas) *types.Schemas { schema.PluralName = "managementSecrets" schema.CodeName = "ManagementSecret" schema.CodeNamePlural = "ManagementSecrets" + schema.MustCustomizeField("name", func(field types.Field) types.Field { + field.Type = "hostname" + field.Nullable = false + field.Required = true + return field + }) }) } diff --git a/apis/project.cattle.io/v3/schema/schema.go b/apis/project.cattle.io/v3/schema/schema.go index 885b1b76..98d16d3a 100644 --- a/apis/project.cattle.io/v3/schema/schema.go +++ b/apis/project.cattle.io/v3/schema/schema.go @@ -53,7 +53,14 @@ var ( ) func configMapTypes(schemas *types.Schemas) *types.Schemas { - return schemas.MustImport(&Version, v1.ConfigMap{}, projectOverride{}) + return schemas.MustImportAndCustomize(&Version, v1.ConfigMap{}, func(schema *types.Schema) { + schema.MustCustomizeField("name", func(field types.Field) types.Field { + field.Type = "hostname" + field.Nullable = false + field.Required = true + return field + }) + }, projectOverride{}) } type DeploymentConfig struct { @@ -775,7 +782,14 @@ func volumeTypes(schemas *types.Schemas) *types.Schemas { VolumeName string `json:"volumeName,omitempty" norman:"type=reference[/v3/cluster/persistentVolume]"` StorageClassName *string `json:"storageClassName,omitempty" norman:"type=reference[/v3/cluster/storageClass]"` }{}). - MustImport(&Version, v1.PersistentVolumeClaim{}, projectOverride{}) + MustImportAndCustomize(&Version, v1.PersistentVolumeClaim{}, func(schema *types.Schema) { + schema.MustCustomizeField("name", func(field types.Field) types.Field { + field.Type = "hostname" + field.Nullable = false + field.Required = true + return field + }) + }, projectOverride{}) } func appTypes(schema *types.Schemas) *types.Schemas { diff --git a/apis/project.cattle.io/v3/schema/schema_secrets.go b/apis/project.cattle.io/v3/schema/schema_secrets.go index f3f2ea64..11aa69df 100644 --- a/apis/project.cattle.io/v3/schema/schema_secrets.go +++ b/apis/project.cattle.io/v3/schema/schema_secrets.go @@ -219,6 +219,12 @@ func secretTypes(schemas *types.Schemas) *types.Schemas { } return f }) + schema.MustCustomizeField("name", func(field types.Field) types.Field { + field.Type = "hostname" + field.Nullable = false + field.Required = true + return field + }) }, projectOverride{}, struct { Description string `json:"description"` }{}).