diff --git a/pkg/generate/parse.go b/pkg/generate/parse.go index 76659f12..5813c69a 100644 --- a/pkg/generate/parse.go +++ b/pkg/generate/parse.go @@ -579,9 +579,7 @@ func (b *APIsBuilder) ParseStructsAndAliases(apigroup *APIGroup) { result.GenDeepCopy = true } - if next.Resource != nil { - result.NonNamespaced = IsNonNamespaced(next.Type) - } + result.NonNamespaced = IsNonNamespaced(next.Type) if b.GenDeepCopy(next.Type) { result.GenDeepCopy = true diff --git a/pkg/generate/unversioned_generator.go b/pkg/generate/unversioned_generator.go index e1540c82..5806ece3 100644 --- a/pkg/generate/unversioned_generator.go +++ b/pkg/generate/unversioned_generator.go @@ -167,7 +167,7 @@ type {{ $a.Name }} {{ $a.UnderlyingTypeName }} {{ range $s := .Structs -}} {{ if $s.GenUnversioned -}} {{ if $s.GenClient }}// +genclient{{end}} -{{ if $s.GenClient }}// +genclient{{ if $s.NonNamespaced }}:nonNamespaced{{end}}{{end}} +{{ if and $s.GenClient $s.NonNamespaced }}// +genclient:nonNamespaced{{end}} {{ if $s.GenDeepCopy }}// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object{{end}} type {{ $s.Name }} struct {