Files
cozystack/packages/system/backup-controller/definitions/backups.cozystack.io_backups.yaml
T
Andrey Kolkov 523d74a503 fix(backups): retry instead of failing when an existing Backup cannot be read
When Create collides with a Backup an earlier reconcile already made and
the read that follows fails, the drivers failed the BackupJob, although
the backup and its Backup both exist. Return a distinct error instead,
which the drivers hand back to the controller so the reconcile is
retried with backoff and then finds the Backup.

minio.New already refuses an endpoint with a path prefix and accepts a
trailing slash, so drop the duplicate check in the shared client; the
CNPG probe keeps its own check because it parses the URL itself and
would otherwise drop the path before minio sees it.

Say in the sizeBytes API doc what the value covers, such as the base
backup without the shared WAL archive for CNPG, and that strategies
which cannot attribute stored bytes to one backup leave it unset.

Assisted-by: LLM
Signed-off-by: Andrey Kolkov <androndo@gmail.com>
2026-11-04 13:04:22 +00:00

232 lines
11 KiB
YAML
Generated

---
apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
annotations:
controller-gen.kubebuilder.io/version: v0.16.4
options.cozystack.io/source.applicationRef.kind: appkind
name: backups.backups.cozystack.io
spec:
group: backups.cozystack.io
names:
kind: Backup
listKind: BackupList
plural: backups
singular: backup
scope: Namespaced
versions:
- name: v1alpha1
schema:
openAPIV3Schema:
description: Backup represents a single backup artifact for a given application.
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: BackupSpec describes an immutable backup artifact produced
by a BackupJob.
properties:
applicationRef:
description: ApplicationRef refers to the application that was backed
up.
properties:
apiGroup:
description: |-
APIGroup is the group for the resource being referenced.
If APIGroup is not specified, the specified Kind must be in the core API group.
For any other third-party types, APIGroup is required.
type: string
kind:
description: Kind is the type of resource being referenced
type: string
name:
description: Name is the name of resource being referenced
type: string
required:
- kind
- name
type: object
x-kubernetes-map-type: atomic
driverMetadata:
additionalProperties:
type: string
description: |-
DriverMetadata holds driver-specific, opaque metadata associated with
this backup (for example snapshot IDs, schema versions, etc.).
This data is not interpreted by the core backup controllers.
type: object
planRef:
description: |-
PlanRef refers to the Plan that produced this backup, if any.
For manually triggered backups, this can be omitted.
properties:
name:
default: ""
description: |-
Name of the referent.
This field is effectively required, but due to backwards compatibility is
allowed to be empty. Instances of this type with an empty value here are
almost certainly wrong.
More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names
type: string
type: object
x-kubernetes-map-type: atomic
strategyRef:
description: |-
StrategyRef refers to the driver-specific BackupStrategy that was used
to create this backup. This allows the driver to later perform restores.
properties:
apiGroup:
description: |-
APIGroup is the group for the resource being referenced.
If APIGroup is not specified, the specified Kind must be in the core API group.
For any other third-party types, APIGroup is required.
type: string
kind:
description: Kind is the type of resource being referenced
type: string
name:
description: Name is the name of resource being referenced
type: string
required:
- kind
- name
type: object
x-kubernetes-map-type: atomic
takenAt:
description: |-
TakenAt is the time at which the backup was taken (as reported by the
driver). It may differ slightly from metadata.creationTimestamp.
format: date-time
type: string
required:
- applicationRef
- strategyRef
- takenAt
type: object
status:
description: BackupStatus represents the observed state of a Backup.
properties:
artifact:
description: Artifact describes the stored backup object, if available.
properties:
checksum:
description: |-
Checksum is the checksum of the artifact, if computed.
For example: "sha256:<hex>".
type: string
sizeBytes:
description: |-
SizeBytes is the stored size in bytes of the files this backup owns,
if known: the dump of a MariaDB backup, for example, or the base backup
of a CNPG one, which leaves out the WAL archive the server's backups
share and a point-in-time restore also reads. Strategies that cannot
attribute stored bytes to a single backup, such as Velero's, whose
repository deduplicates across backups, leave it unset. Drivers never
write 0 for a size they cannot measure, so an absent value means
"unknown", not "empty".
format: int64
type: integer
uri:
description: |-
URI is a driver-/storage-specific URI pointing to the backup artifact.
For example: s3://bucket/prefix/file.tar.gz
type: string
required:
- uri
type: object
conditions:
description: Conditions represents the latest available observations
of a Backup's state.
items:
description: Condition contains details for one aspect of the current
state of this API Resource.
properties:
lastTransitionTime:
description: |-
lastTransitionTime is the last time the condition transitioned from one status to another.
This should be when the underlying condition changed. If that is not known, then using the time when the API field changed is acceptable.
format: date-time
type: string
message:
description: |-
message is a human readable message indicating details about the transition.
This may be an empty string.
maxLength: 32768
type: string
observedGeneration:
description: |-
observedGeneration represents the .metadata.generation that the condition was set based upon.
For instance, if .metadata.generation is currently 12, but the .status.conditions[x].observedGeneration is 9, the condition is out of date
with respect to the current state of the instance.
format: int64
minimum: 0
type: integer
reason:
description: |-
reason contains a programmatic identifier indicating the reason for the condition's last transition.
Producers of specific condition types may define expected values and meanings for this field,
and whether the values are considered a guaranteed API.
The value should be a CamelCase string.
This field may not be empty.
maxLength: 1024
minLength: 1
pattern: ^[A-Za-z]([A-Za-z0-9_,:]*[A-Za-z0-9_])?$
type: string
status:
description: status of the condition, one of True, False, Unknown.
enum:
- "True"
- "False"
- Unknown
type: string
type:
description: type of condition in CamelCase or in foo.example.com/CamelCase.
maxLength: 316
pattern: ^([a-z0-9]([-a-z0-9]*[a-z0-9])?(\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*/)?(([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9])$
type: string
required:
- lastTransitionTime
- message
- reason
- status
- type
type: object
type: array
phase:
description: |-
Phase is a simple, high-level summary of the backup's state.
Typical values are: Pending, Ready, Failed.
type: string
underlyingResources:
description: |-
UnderlyingResources holds application-specific resource metadata discovered
during backup (e.g., VM disks, network configuration). The payload is a
self-typed JSON object carrying an inlined TypeMeta (kind/apiVersion) so
the consuming controller can dispatch on the application kind.
type: object
x-kubernetes-preserve-unknown-fields: true
type: object
type: object
selectableFields:
- jsonPath: .spec.applicationRef.apiGroup
- jsonPath: .spec.applicationRef.kind
- jsonPath: .spec.applicationRef.name
served: true
storage: true