File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -36,7 +36,6 @@ var CRDMarkers = []*markers.Definition{
3636
3737// TODO: categories and singular used to be annotations types
3838// TODO: doc
39- // TODO: nonNamespaced
4039
4140func init () {
4241 AllDefinitions = append (AllDefinitions , CRDMarkers ... )
@@ -184,13 +183,21 @@ type Resource struct {
184183 ShortName []string `marker:",optional"`
185184 Categories []string `marker:",optional"`
186185 Singular string `marker:",optional"`
186+ Scope string `marker:",optional"`
187187}
188188
189189func (s Resource ) ApplyToCRD (crd * apiext.CustomResourceDefinitionSpec , version string ) error {
190190 crd .Names .Plural = s .Path
191191 crd .Names .ShortNames = s .ShortName
192192 crd .Names .Categories = s .Categories
193193
194+ switch s .Scope {
195+ case "" :
196+ crd .Scope = apiext .NamespaceScoped
197+ default :
198+ crd .Scope = apiext .ResourceScope (s .Scope )
199+ }
200+
194201 return nil
195202}
196203
You can’t perform that action at this time.
0 commit comments