Yaml create of bucket fails with v2 not found

using operator 2.4.2-150, have a cluster (default cluster values from distribution started) trying to create a bucket (from doc example), and getting error:

> error: resource mapping not found for name: "cb-bucket-devtn" namespace: "couchbase" from "2.0-createBucket.yaml": no matches for kind "CouchbaseBucket" in version "v2"
> ensure CRDs are installed first

Looking at the crd’s (which were installed via crd.yaml from the distribution) it looks ok to me, with this inside:

API Version:  couchbase.com/v2
Kind:         CouchbaseBucket

Operator, admission (via helm), and cluster are all in the same namespace, along with the crd’s…
Here’s the bucket definition:

apiVersion: v2
kind: CouchbaseBucket
metadata:
  name: "cb-bucket-devtn"
  namespace: couchbase
spec:
  compressionMode: passive
  conflictResolution: seqno
  enableFlush: false
  enableIndexReplica: false
  evictionPolicy: valueOnly
  ioPriority: low
  maxTTL: ""
  memoryQuota: 100Mi
  minimumDurability: ""
  name: "devtn"
  replicas: 1
  scopes:
    managed: false
    resources:
    - kind: CouchbaseScope
      name: ""
    selector: {}
  storageBackend: "magma"

I’m clearly missing something simple, anybody got thoughts?

Hi @ksully - thanks for trying Couchbase operator for installing CB server on Kubernetes!

Could I request you to please try kubectl get crds and see if you could see the Couchbase specific CRDs?

sure, here’s the lines listed for couchbase

couchbaseautoscalers.couchbase.com             2023-06-29T15:52:17Z
couchbasebackuprestores.couchbase.com          2023-06-29T15:52:17Z
couchbasebackups.couchbase.com                 2023-06-29T15:52:17Z
couchbasebuckets.couchbase.com                 2023-06-29T15:52:17Z
couchbaseclusters.couchbase.com                2023-06-29T15:52:17Z
couchbasecollectiongroups.couchbase.com        2023-06-29T15:25:44Z
couchbasecollections.couchbase.com             2023-06-29T15:25:44Z
couchbaseephemeralbuckets.couchbase.com        2023-06-29T15:25:44Z
couchbasegroups.couchbase.com                  2023-06-29T15:25:45Z
couchbasememcachedbuckets.couchbase.com        2023-06-29T15:25:45Z
couchbasemigrationreplications.couchbase.com   2023-06-29T15:25:45Z
couchbasereplications.couchbase.com            2023-06-29T15:25:45Z
couchbaserolebindings.couchbase.com            2023-06-29T15:25:45Z
couchbasescopegroups.couchbase.com             2023-06-29T15:25:45Z
couchbasescopes.couchbase.com                  2023-06-29T15:25:45Z
couchbaseusers.couchbase.com                   2023-06-29T15:25:45Z

and did a describe on the bucket crd

Name:         couchbasebuckets.couchbase.com
Namespace:    
Labels:       <none>
Annotations:  config.couchbase.com/version: 2.4.2
              controller-gen.kubebuilder.io/version: v0.8.0
API Version:  apiextensions.k8s.io/v1
Kind:         CustomResourceDefinition
Metadata:
  Creation Timestamp:  2023-06-29T15:52:17Z
  Generation:          1
  Resource Version:    6757791
  UID:                 8c1557c2-837f-4d00-ab07-f649711afd28
Spec:
  Conversion:
    Strategy:  None
  Group:       couchbase.com
  Names:
    Kind:       CouchbaseBucket
    List Kind:  CouchbaseBucketList
    Plural:     couchbasebuckets
    Singular:   couchbasebucket
  Scope:        Namespaced
  Versions:
    Additional Printer Columns:
      Json Path:  .spec.memoryQuota
      Name:       memory quota
      Type:       string
      Json Path:  .spec.replicas
      Name:       replicas
      Type:       integer
      Json Path:  .spec.ioPriority
      Name:       io priority
      Type:       string
      Json Path:  .spec.evictionPolicy
      Name:       eviction policy
      Type:       string
      Json Path:  .spec.conflictResolution
      Name:       conflict resolution
      Type:       string
      Json Path:  .metadata.creationTimestamp
      Name:       age
      Type:       date
    Name:         v2
    Schema:
      openAPIV3Schema:
        Description:  The CouchbaseBucket resource defines a set of documents in Couchbase server. A Couchbase client connects to and operates on a bucket, which provides independent management of a set documents and a security boundary for role based access control. A CouchbaseBucket provides replication and persistence for documents contained by it.
        Properties:
          API Version:
            Description:  APIVersion defines the versioned schema of this representation of an object. Servers should convert recognized schemas to the latest internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources
            Type:         string
          Kind:
            Description:  Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds
            Type:         string
          Metadata:
            Type:  object
          Spec:
            Default:
            Description:  CouchbaseBucketSpec is the specification for a Couchbase bucket resource, and allows the bucket to be customized.
            Properties:
              Compression Mode:
                Default:      passive
                Description:  CompressionMode defines how Couchbase server handles document compression.  When off, documents are stored in memory, and transferred to the client uncompressed. When passive, documents are stored compressed in memory, and transferred to the client compressed when requested.  When active, documents are stored compresses in memory and when transferred to the client.  This field must be "off", "passive" or "active", defaulting to "passive".  Be aware "off" in YAML 1.2 is a boolean, so must be quoted as a string in configuration files.
                Enum:
                  off
                  passive
                  active
                Type:  string
              Conflict Resolution:
                Default:      seqno
                Description:  ConflictResolution defines how XDCR handles concurrent write conflicts.  Sequence number based resolution selects the document with the highest sequence number as the most recent. Timestamp based resolution selects the document that was written to most recently as the most recent.  This field must be "seqno" (sequence based), or "lww" (timestamp based), defaulting to "seqno".
                Enum:
                  seqno
                  lww
                Type:  string
              Enable Flush:
                Description:  EnableFlush defines whether a client can delete all documents in a bucket. This field defaults to false.
                Type:         boolean
              Enable Index Replica:
                Description:  EnableIndexReplica defines whether indexes for this bucket are replicated. This field defaults to false.
                Type:         boolean
              Eviction Policy:
                Default:      valueOnly
                Description:  EvictionPolicy controls how Couchbase handles memory exhaustion.  Value only eviction flushes documents to disk but maintains document metadata in memory in order to improve query performance.  Full eviction removes all data from memory after the document is flushed to disk.  This field must be "valueOnly" or "fullEviction", defaulting to "valueOnly".
                Enum:
                  valueOnly
                  fullEviction
                Type:  string
              Io Priority:
                Default:      low
                Description:  IOPriority controls how many threads a bucket has, per pod, to process reads and writes. This field must be "low" or "high", defaulting to "low".  Modification of this field will cause a temporary service disruption as threads are restarted.
                Enum:
                  low
                  high
                Type:  string
              Max TTL:
                Description:  MaxTTL defines how long a document is permitted to exist for, without modification, until it is automatically deleted.  This is a default and maximum time-to-live and may be set to a lower value by the client.  If the client specifies a higher value, then it is truncated to the maximum durability.  Documents are removed by Couchbase, after they have expired, when either accessed, the expiry pager is run, or the bucket is compacted.  When set to 0, then documents are not expired by default.  This field must be a duration in the range 0-2147483648s, defaulting to 0.  More info: https://golang.org/pkg/time/#ParseDuration
                Type:         string
              Memory Quota:
                Any Of:
                  Type:                              integer
                  Type:                              string
                Default:                             100Mi
                Description:                         MemoryQuota is a memory limit to the size of a bucket.  When this limit is exceeded, documents will be evicted from memory to disk as defined by the eviction policy.  The memory quota is defined per Couchbase pod running the data service.  This field defaults to, and must be greater than or equal to 100Mi.  More info: https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/#resource-units-in-kubernetes
                Pattern:                             ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$
                Type:                                string
                X - Kubernetes - Int - Or - String:  true
              Minimum Durability:
                Description:  MiniumumDurability defines how durable a document write is by default, and can be made more durable by the client.  This feature enables ACID transactions. When none, Couchbase server will respond when the document is in memory, it will become eventually consistent across the cluster.  When majority, Couchbase server will respond when the document is replicated to at least half of the pods running the data service in the cluster.  When majorityAndPersistActive, Couchbase server will respond when the document is replicated to at least half of the pods running the data service in the cluster and the document has been persisted to disk on the document master pod.  When persistToMajority, Couchbase server will respond when the document is replicated and persisted to disk on at least half of the pods running the data service in the cluster.  This field must be either "none", "majority", "majorityAndPersistActive" or "persistToMajority", defaulting to "none".
                Enum:
                  none
                  majority
                  majorityAndPersistActive
                  persistToMajority
                Type:  string
              Name:
                Description:  Name is the name of the bucket within Couchbase server.  By default the Operator will use the `metadata.name` field to define the bucket name.  The `metadata.name` field only supports a subset of the supported character set.  When specified, this field overrides `metadata.name`.  Legal bucket names have a maximum length of 100 characters and may be composed of any character from "a-z", "A-Z", "0-9" and "-_%\.".
                Max Length:   100
                Pattern:      ^[a-zA-Z0-9-_%\.]{1,100}$
                Type:         string
              Replicas:
                Default:      1
                Description:  Replicas defines how many copies of documents Couchbase server maintains.  This directly affects how fault tolerant a Couchbase cluster is.  With a single replica, the cluster can tolerate one data pod going down and still service requests without data loss.  The number of replicas also affect memory use.  With a single replica, the effective memory quota for documents is halved, with two replicas it is one third.  The number of replicas must be between 0 and 3, defaulting to 1.
                Maximum:      3
                Minimum:      0
                Type:         integer
              Scopes:
                Description:  Scopes defines whether the Operator manages scopes for the bucket or not, and the set of scopes defined for the bucket.
                Properties:
                  Managed:
                    Description:  Managed defines whether scopes are managed for this bucket. This field is `false` by default, and the Operator will take no actions that will affect scopes and collections in this bucket.  The default scope and collection will be present.  When set to `true`, the Operator will manage user defined scopes, and optionally, their collections as defined by the `CouchbaseScope`, `CouchbaseScopeGroup`, `CouchbaseCollection` and `CouchbaseCollectionGroup` resource documentation.  If this field is set to `false` while the  already managed, then the Operator will leave whatever configuration is already present.
                    Type:         boolean
                  Resources:
                    Description:  Resources is an explicit list of named resources that will be considered for inclusion in this bucket.  If a resource reference doesn't match a resource, then no error conditions are raised due to undefined resource creation ordering and eventual consistency.
                    Items:
                      Properties:
                        Kind:
                          Default:      CouchbaseScope
                          Description:  Kind indicates the kind of resource that is being referenced.  A scope can only reference `CouchbaseScope` and `CouchbaseScopeGroup` resource kinds.  This field defaults to `CouchbaseScope` if not specified.
                          Enum:
                            CouchbaseScope
                            CouchbaseScopeGroup
                          Type:  string
                        Name:
                          Description:  Name is the name of the Kubernetes resource name that is being referenced. Legal scope names have a maximum length of 251 characters and may be composed of any character from "a-z", "A-Z", "0-9" and "_-%".
                          Max Length:   251
                          Min Length:   1
                          Pattern:      ^[a-zA-Z0-9\-][a-zA-Z0-9\-%_]{0,250}$
                          Type:         string
                      Required:
                        name
                      Type:  object
                    Type:    array
                  Selector:
                    Description:  Selector allows resources to be implicitly considered for inclusion in this bucket.  More info: https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.21/#labelselector-v1-meta
                    Properties:
                      Match Expressions:
                        Description:  matchExpressions is a list of label selector requirements. The requirements are ANDed.
                        Items:
                          Description:  A label selector requirement is a selector that contains values, a key, and an operator that relates the key and values.
                          Properties:
                            Key:
                              Description:  key is the label key that the selector applies to.
                              Type:         string
                            Operator:
                              Description:  operator represents a key's relationship to a set of values. Valid operators are In, NotIn, Exists and DoesNotExist.
                              Type:         string
                            Values:
                              Description:  values is an array of string values. If the operator is In or NotIn, the values array must be non-empty. If the operator is Exists or DoesNotExist, the values array must be empty. This array is replaced during a strategic merge patch.
                              Items:
                                Type:  string
                              Type:    array
                          Required:
                            key
                            operator
                          Type:  object
                        Type:    array
                      Match Labels:
                        Additional Properties:
                          Type:       string
                        Description:  matchLabels is a map of {key,value} pairs. A single {key,value} in the matchLabels map is equivalent to an element of matchExpressions, whose key field is "key", the operator is "In", and the values array contains only "value". The requirements are ANDed.
                        Type:         object
                    Type:             object
                Type:                 object
              Storage Backend:
                Description:  StorageBackend to be assigned to and used by the bucket. Only valid for Couchbase Server 7.0.0 onward. Two different backend storage mechanisms can be used - "couchstore" or "magma", defaulting to "couchstore". This cannot be edited after bucket creation. Note: "magma" is only valid for Couchbase Server 7.1.0 onward.
                Enum:
                  couchstore
                  magma
                Type:  string
            Type:      object
        Type:          object
    Served:            true
    Storage:           true
Status:
  Accepted Names:
    Kind:       CouchbaseBucket
    List Kind:  CouchbaseBucketList
    Plural:     couchbasebuckets
    Singular:   couchbasebucket
  Conditions:
    Last Transition Time:  2023-06-29T15:52:17Z
    Message:               no conflicts found
    Reason:                NoConflicts
    Status:                True
    Type:                  NamesAccepted
    Last Transition Time:  2023-06-29T15:52:17Z
    Message:               the initial names have been accepted
    Reason:                InitialNamesAccepted
    Status:                True
    Type:                  Established
  Stored Versions:
    v2
Events:  <none>

type or paste code here

@ abhi.bose
Any thoughts? Still can’t create any buckets, etc.

anybody got any thoughts?

I think there’s a slight typo in the first line of your bucket definition.
It should be

apiVersion: couchbase.com/v2

not just v2

2nd pair of eyes always helps, dumb mistake, thanks!