CRD Scope
The CRD manifests are generated in . For each CRD that needs to be cluster-scoped, its manifest should specify spec.scope: Cluster
.
To ensure that the CRD is always generated with scope: Cluster
, add the marker //+kubebuilder:resource:path=<resource>,scope=Cluster
, or if already present replace scope={Namespaced -> Cluster}
, above the CRD’s Go type definition in api/<version>/<kind>_types.go
or if you are using the multigroup layout. Note that the <resource>
element must be the same lower-case plural value of the CRD’s Kind, spec.names.plural
.
Example for changing the CRD scope from Namespaced to Cluster
/config/crd/bases/cache.example.com_memcacheds.yaml
Run , to update the CRD manifest with the cluster scope setting, as in the following example: