---
apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
  annotations:
    config.couchbase.com/version: 2.3.0
    controller-gen.kubebuilder.io/version: v0.8.0
  name: couchbasebackups.couchbase.com
spec:
  group: couchbase.com
  names:
    kind: CouchbaseBackup
    listKind: CouchbaseBackupList
    plural: couchbasebackups
    shortNames:
    - cbbackup
    singular: couchbasebackup
  scope: Namespaced
  versions:
  - additionalPrinterColumns:
    - jsonPath: .spec.strategy
      name: strategy
      type: string
    - jsonPath: .spec.size
      name: volume size
      type: string
    - jsonPath: .status.capacityUsed
      name: capacity used
      type: string
    - jsonPath: .status.lastRun
      name: last run
      type: string
    - jsonPath: .status.lastSuccess
      name: last success
      type: string
    - jsonPath: .status.running
      name: running
      type: boolean
    - jsonPath: .metadata.creationTimestamp
      name: age
      type: date
    name: v2
    schema:
      openAPIV3Schema:
        description: CouchbaseBackup allows automatic backup of all data from a Couchbase
          cluster into persistent storage.
        properties:
          apiVersion:
            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:
            description: CouchbaseBackupSpec is allows the specification of how a
              Couchbase backup is configured, including when backups are performed,
              how long they are retained for, and where they are backed up to.
            properties:
              autoScaling:
                description: AutoScaling allows the volume size to be dynamically
                  increased. When specified, the backup volume will start with an
                  initial size as defined by `spec.size`, and increase as required.
                properties:
                  incrementPercent:
                    default: 20
                    description: IncrementPercent controls how much the volume is
                      increased each time the threshold is exceeded, upto a maximum
                      as defined by the limit. This field defaults to 20 if not specified.
                    minimum: 0
                    type: integer
                  limit:
                    anyOf:
                    - type: integer
                    - type: string
                    description: 'Limit imposes a hard limit on the size we can autoscale
                      to.  When not specified no bounds are imposed. 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
                  thresholdPercent:
                    default: 20
                    description: ThresholdPercent determines the point at which a
                      volume is autoscaled. This represents the percentage of free
                      space remaining on the volume, when less than this threshold,
                      it will trigger a volume expansion. For example, if the volume
                      is 100Gi, and the threshold 20%, then a resize will be triggered
                      when the used capacity exceeds 80Gi, and free space is less
                      than 20Gi.  This field defaults to 20 if not specified.
                    maximum: 99
                    minimum: 0
                    type: integer
                type: object
              backoffLimit:
                default: 2
                description: Number of times a backup job should try to execute. Once
                  it hits the BackoffLimit it will not run until the next scheduled
                  job.
                format: int32
                type: integer
              backupRetention:
                default: 720h
                description: 'Number of hours to hold backups for, everything older
                  will be deleted.  More info: https://golang.org/pkg/time/#ParseDuration'
                type: string
              data:
                description: Data allows control over what key-value/document data
                  is included in the backup.  By default, all data is included.  Modifications
                  to this field will only take effect on the next full backup.
                properties:
                  exclude:
                    description: Exclude defines the buckets, scopes or collections
                      that are excluded from the backup. When this field is set, it
                      implies that by default everything will be backed up, and data
                      items can be explicitly excluded.  You may define an exclusion
                      as a bucket -- `my-bucket`, a scope -- `my-bucket.my-scope`,
                      or a collection -- `my-bucket.my-scope.my-collection`. Buckets
                      may contain periods, and therefore must be escaped -- `my\.bucket.my-scope`,
                      as period is the separator used to delimit scopes and collections.  Excluded
                      data cannot overlap e.g. specifying `my-bucket` and `my-bucket.my-scope`
                      is illegal.  This field cannot be used at the same time as included
                      items.
                    items:
                      description: BucketScopeOrCollectionNameWithDefaults is the
                        name of a fully qualifed bucket, scope or collection. The
                        _default scope and collection are valid for this type. As
                        these names are period separated, and buckets can contain
                        periods, the latter need to be escaped.  This specification
                        is based on cbbackupmgr.
                      pattern: ^(?:[a-zA-Z0-9\-_%]|\\.){1,100}(\._default(\._default)?|\.[a-zA-Z0-9\-][a-zA-Z0-9\-%_]{0,29}(\.[a-zA-Z0-9\-][a-zA-Z0-9\-%_]{0,29})?)?$
                      type: string
                    minItems: 1
                    type: array
                    x-kubernetes-list-type: set
                  include:
                    description: Include defines the buckets, scopes or collections
                      that are included in the backup. When this field is set, it
                      implies that by default nothing will be backed up, and data
                      items must be explicitly included.  You may define an inclusion
                      as a bucket -- `my-bucket`, a scope -- `my-bucket.my-scope`,
                      or a collection -- `my-bucket.my-scope.my-collection`. Buckets
                      may contain periods, and therefore must be escaped -- `my\.bucket.my-scope`,
                      as period is the separator used to delimit scopes and collections.  Included
                      data cannot overlap e.g. specifying `my-bucket` and `my-bucket.my-scope`
                      is illegal.  This field cannot be used at the same time as excluded
                      items.
                    items:
                      description: BucketScopeOrCollectionNameWithDefaults is the
                        name of a fully qualifed bucket, scope or collection. The
                        _default scope and collection are valid for this type. As
                        these names are period separated, and buckets can contain
                        periods, the latter need to be escaped.  This specification
                        is based on cbbackupmgr.
                      pattern: ^(?:[a-zA-Z0-9\-_%]|\\.){1,100}(\._default(\._default)?|\.[a-zA-Z0-9\-][a-zA-Z0-9\-%_]{0,29}(\.[a-zA-Z0-9\-][a-zA-Z0-9\-%_]{0,29})?)?$
                      type: string
                    minItems: 1
                    type: array
                    x-kubernetes-list-type: set
                type: object
              failedJobsHistoryLimit:
                default: 3
                description: Amount of failed jobs to keep.
                format: int32
                minimum: 0
                type: integer
              full:
                description: Full is the schedule on when to take full backups. Used
                  in Full/Incremental and FullOnly backup strategies.
                properties:
                  schedule:
                    description: Schedule takes a cron schedule in string format.
                    type: string
                required:
                - schedule
                type: object
              incremental:
                description: Incremental is the schedule on when to take incremental
                  backups. Used in Full/Incremental backup strategies.
                properties:
                  schedule:
                    description: Schedule takes a cron schedule in string format.
                    type: string
                required:
                - schedule
                type: object
              logRetention:
                default: 168h
                description: 'Number of hours to hold script logs for, everything
                  older will be deleted.  More info: https://golang.org/pkg/time/#ParseDuration'
                type: string
              s3bucket:
                description: Name of S3 bucket to backup to. If non-empty this overrides
                  local backup.
                pattern: ^s3://[a-z0-9-\.]{3,63}$
                type: string
              services:
                default: {}
                description: Services allows control over what services are included
                  in the backup. By default, all service data and metadata are included.  Modifications
                  to this field will only take effect on the next full backup.
                properties:
                  analytics:
                    default: true
                    description: Analytics enables the backup of analytics data. This
                      field defaults to `true`.
                    type: boolean
                  bucketConfig:
                    default: true
                    description: BucketConfig enables the backup of bucket configuration.
                      This field defaults to `true`.
                    type: boolean
                  bucketQuery:
                    default: true
                    description: BucketQuery enables the backup of query metadata
                      for all buckets. This field defaults to `true`.
                    type: boolean
                  clusterAnalytics:
                    default: true
                    description: ClusterAnalytics enables the backup of cluster-wide
                      analytics data, for example synonyms. This field defaults to
                      `true`.
                    type: boolean
                  clusterQuery:
                    default: true
                    description: ClusterQuery enables the backup of cluster level
                      query metadata. This field defaults to `true`.
                    type: boolean
                  data:
                    default: true
                    description: Data enables the backup of key-value data/documents
                      for all buckets. This can be further refined with the couchbasebackups.spec.data
                      configuration. This field defaults to `true`.
                    type: boolean
                  eventing:
                    default: true
                    description: Eventing enables the backup of eventing service metadata.
                      This field defaults to `true`.
                    type: boolean
                  ftsAliases:
                    default: true
                    description: FTSAliases enables the backup of full-text search
                      alias definitions. This field defaults to `true`.
                    type: boolean
                  ftsIndexes:
                    default: true
                    description: FTSIndexes enables the backup of full-text search
                      index definitions for all buckets. This field defaults to `true`.
                    type: boolean
                  gsIndexes:
                    default: true
                    description: GSIndexes enables the backup of global secondary
                      index definitions for all buckets. This field defaults to `true`.
                    type: boolean
                  views:
                    default: true
                    description: Views enables the backup of view definitions for
                      all buckets. This field defaults to `true`.
                    type: boolean
                type: object
              size:
                anyOf:
                - type: integer
                - type: string
                default: 20Gi
                description: 'Size allows the specification of a backup persistent
                  volume, when using volume based backup. 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
              storageClassName:
                description: Name of StorageClass to use.
                type: string
              strategy:
                default: full_incremental
                description: 'Strategy defines how to perform backups.  `full_only`
                  will only perform full backups, and you must define a schedule in
                  the `spec.full` field.  `full_incremental` will perform periodic
                  full backups, and incremental backups in between.  You must define
                  full and incremental schedules in the `spec.full` and `spec.incremental`
                  fields respectively.  Care should be taken to ensure full and incremental
                  schedules do not overlap, taking into account the backup time, as
                  this will cause failures as the jobs attempt to mount the same backup
                  volume. This field default to `full_incremental`. Info: https://docs.couchbase.com/server/current/backup-restore/cbbackupmgr-strategies.html'
                enum:
                - full_incremental
                - full_only
                type: string
              successfulJobsHistoryLimit:
                default: 3
                description: Amount of successful jobs to keep.
                format: int32
                minimum: 0
                type: integer
              threads:
                default: 1
                description: How many threads to use during the backup.  This field
                  defaults to 1.
                minimum: 1
                type: integer
            required:
            - strategy
            type: object
          status:
            description: CouchbaseBackupStatus provides status notifications about
              the Couchbase backup including when the last backup occurred, whether
              is succeeded or not, the run time of the backup and the size of the
              backup.
            properties:
              archive:
                description: Location of Backup Archive.
                type: string
              backups:
                description: Backups gives us a full list of all backups and their
                  respective repository locations.
                items:
                  properties:
                    full:
                      description: Full backup inside the repository.
                      type: string
                    incrementals:
                      description: Incremental backups inside the repository.
                      items:
                        type: string
                      type: array
                    name:
                      description: Name of the repository.
                      type: string
                  required:
                  - name
                  type: object
                type: array
              capacityUsed:
                anyOf:
                - type: integer
                - type: string
                description: 'CapacityUsed tells us how much of the PVC we are using.
                  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
              cronjob:
                description: DEPRECATED - field may no longer be populated. Cronjob
                  tells us which Cronjob the job belongs to.
                type: string
              duration:
                description: 'Duration tells us how long the last backup took.  More
                  info: https://golang.org/pkg/time/#ParseDuration'
                type: string
              failed:
                description: Failed indicates whether the most recent backup has failed.
                type: boolean
              job:
                description: DEPRECATED - field may no longer be populated. Job tells
                  us which job is running/ran last.
                type: string
              lastFailure:
                description: LastFailure tells us the time the last failed backup
                  failed.
                format: date-time
                type: string
              lastRun:
                description: LastRun tells us the time the last backup job started.
                format: date-time
                type: string
              lastSuccess:
                description: LastSuccess gives us the time the last successful backup
                  finished.
                format: date-time
                type: string
              output:
                description: DEPRECATED - field may no longer be populated. Output
                  reports useful information from the backup_script.
                type: string
              pod:
                description: DEPRECATED - field may no longer be populated. Pod tells
                  us which pod is running/ran last.
                type: string
              repo:
                description: Repo is where we are currently performing operations.
                type: string
              running:
                description: Running indicates whether a backup is currently being
                  performed.
                type: boolean
            required:
            - failed
            - running
            type: object
        required:
        - spec
        type: object
    served: true
    storage: true
