1
0
mirror of https://github.com/rancher/types.git synced 2025-07-10 12:03:04 +00:00

Merge pull request #133 from cjellick/optional-context

Make roletemplate.context optional
This commit is contained in:
Craig Jellick 2018-01-19 16:57:33 -07:00 committed by GitHub
commit c425ec4228
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 2 additions and 9 deletions

View File

@ -77,7 +77,7 @@ type RoleTemplate struct {
Builtin bool `json:"builtin" norman:"nocreate,noupdate"`
External bool `json:"external"`
Hidden bool `json:"hidden"`
Context string `json:"context"`
Context string `json:"context" norman:"type=string,options=project|cluster"`
RoleTemplateNames []string `json:"roleTemplateNames,omitempty" norman:"type=array[reference[roleTemplate]]"`
}

View File

@ -99,14 +99,7 @@ func authzTypes(schemas *types.Schemas) *types.Schemas {
}).
MustImport(&Version, v3.GlobalRole{}).
MustImport(&Version, v3.GlobalRoleBinding{}).
MustImportAndCustomize(&Version, v3.RoleTemplate{}, func(schema *types.Schema) {
schema.MustCustomizeField("context", func(field types.Field) types.Field {
field.Type = "enum"
field.Options = []string{"cluster", "project"}
field.Nullable = false
return field
})
}).
MustImport(&Version, v3.RoleTemplate{}).
MustImport(&Version, v3.PodSecurityPolicyTemplate{}).
MustImportAndCustomize(&Version, v3.ClusterRoleTemplateBinding{}, func(schema *types.Schema) {
schema.MustCustomizeField("subjectKind", func(field types.Field) types.Field {