cozystack/packages/system/backup-controller/definitions/backups.cozystack.io_backups.yaml
Timofei Larkin 0f7bd3e395 [backups] Add indices to core backup resources
## What this PR does

This adds custom indexable fields on core backup resources to enable
filtering by backed-up application. This will later be useful for
displaying backup resources in the dashboard: it will be possible to
filter them with a field selector to display only those backup resources
that are relevant to a given application.

### Release note

```release-note
[backups] Enable filtering backup resources by backed up application for
per-app views of backups.
```

Signed-off-by: Timofei Larkin <lllamnyp@gmail.com>
2025-12-12 14:21:05 +03:00

238 lines
11 KiB
YAML
Generated

---
apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
annotations:
controller-gen.kubebuilder.io/version: v0.16.4
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
storageRef:
description: |-
StorageRef refers to the Storage object that describes where the backup
artifact is stored.
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
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
- storageRef
- 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 size of the artifact in bytes, if
known.
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
type: object
type: object
selectableFields:
- jsonPath: .spec.applicationRef.apiGroup
- jsonPath: .spec.applicationRef.kind
- jsonPath: .spec.applicationRef.name
served: true
storage: true