Kubebuilder: Non-namespaced resource CRD gets generated as scope: Namespaced

Created on 20 Jul 2018  路  7Comments  路  Source: kubernetes-sigs/kubebuilder

Command Issued:

kubebuilder create api --group bigthicket --kind EphemeralEnvironment --namespaced false --version v1alpha1

Resulting crd:

apiVersion: apiextensions.k8s.io/v1beta1
kind: CustomResourceDefinition
metadata:
  creationTimestamp: null
  labels:
    controller-tools.k8s.io: "1.0"
  name: ephemeralenvironments.bigthicket.localytics.com
spec:
  group: bigthicket.localytics.com
  names:
    kind: EphemeralEnvironment
    plural: ephemeralenvironments
  scope: Namespaced
  validation:
    openAPIV3Schema:
      properties:
        apiVersion:
          type: string
        kind:
          type: string
        metadata:
          type: object
        spec:
          type: object
        status:
          type: object
      type: object
  version: v1alpha1
status:
  acceptedNames:
    kind: ""
    plural: ""
  conditions: null

Expected scope: Cluster

Most helpful comment

answering myself:
add // +genclient:nonNamespaced comment to my type definition

All 7 comments

@fanzhangio Can you pl. take a look this one ?

@bwarminski Thanks for your feedback. Please use --namespaced=false instead.

@bwarminski Does it solve your issue? Please let me know if you need any help.

closing this issue. pl. re-open if this is still an issue.

Is there a way to make a CRD cluster scope after kubebuilder create api is done? I didn't pass in --namespaced=false

answering myself:
add // +genclient:nonNamespaced comment to my type definition

unfortunately does not work for me anymore with KubeBuilderVersion:"2.0.0-alpha.2". Neither // +genclient:nonNamespaced nor kubebuilder create api --group bigthicket --kind EphemeralEnvironment --namespaced false --version v1alpha1or --namespaced=false generated non-namespaced CRD. Please help
Duplicate of #

Was this page helpful?
0 / 5 - 0 ratings