mirror of
https://github.com/cozystack/cozystack.git
synced 2026-11-21 20:23:39 +09:00
The four backups.cozystack.io CRDs injected the x-cozystack-options vendor
extension into their OpenAPI validation schema. apiextensions JSONSchemaProps
is a closed struct that only preserves x-kubernetes-* vendor extensions, so
helm-controller's server-side apply rejected the unknown key ("field not
declared in schema") and the CRDs never applied — the controller crash-looped
and backups were non-functional.
Move the field-to-source mapping the dashboard needs into CRD
metadata.annotations (preserved by the apiserver), emitted via
+kubebuilder:metadata:annotations markers, and drop the post-processing awk
injector. The dashboard reattaches the extension client-side.
A helm-unittest suite pins the contract: each dropdown field carries its source
in metadata.annotations and must not carry x-cozystack-options in the schema,
guarding against re-introducing the injector.
Assisted-By: Claude <noreply@anthropic.com>
Signed-off-by: Aleksei Sviridkin <f@lex.la>
225 lines
10 KiB
YAML
Generated
225 lines
10 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 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
|
|
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
|