---
apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
  annotations:
    controller-gen.kubebuilder.io/version: v0.2.8
  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 capcity 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
              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.
                type: string
              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: 'CB backup strategy - Full/Incremental, Full only. Default: Full/Incremental'
                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.
                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: Output reports useful information from the backup_script.
                type: string
              pod:
                description: 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
