Skip to content

Commit 8d29097

Browse files
committed
Merge branch 'main' into ci/skip-tooling-paths
Assisted-by: LLM Signed-off-by: Aleksei Sviridkin <[email protected]>
2 parents 48eae9a + f61cfdf commit 8d29097

337 files changed

Lines changed: 21831 additions & 4921 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

‎Makefile‎

Lines changed: 12 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -139,13 +139,14 @@ rd-presets-check:
139139
migrations-target-check:
140140
hack/check-migrations-target.sh
141141

142-
# Scoped go test over the cozystack-api surface that this repo owns. Kept
143-
# narrow intentionally - running `go test ./...` pulls in generated code
144-
# round-trip suites whose behavior depends on tool versions outside this
145-
# repo's control (kubebuilder, openapi-gen, etc.) and is better exercised
146-
# from their generator workflows.
142+
# Go tests of the cozystack-api surface and of the standalone packages and
143+
# commands listed here, whose tests need no cluster. Kept narrow
144+
# intentionally - running `go test ./...` pulls in generated code round-trip
145+
# suites whose behavior depends on tool versions outside this repo's control
146+
# (kubebuilder, openapi-gen, etc.) and is better exercised from their
147+
# generator workflows.
147148
go-unit-tests:
148-
go test ./pkg/registry/... ./pkg/config/... ./pkg/cmd/server/...
149+
go test ./pkg/registry/... ./pkg/config/... ./pkg/cmd/server/... ./pkg/lineage/... ./pkg/ovnstatus/... ./pkg/reservation/... ./cmd/cozypkg/... ./cmd/check-readiness/...
149150

150151
# The nested Go modules (image sources and the published API types) are
151152
# outside ./... of the root module, so no other target reaches their tests.
@@ -158,9 +159,7 @@ go-module-tests:
158159
done
159160

160161
# Go tests for the controllers and supporting packages under ./internal.
161-
# Excludes ./pkg/... and ./cmd/... — those are run separately by
162-
# go-unit-tests above (pkg subset) and skipped (cmd) until their tests
163-
# stabilise. CI schedules this target in the same four-slot make invocation as
162+
# CI schedules this target in the same four-slot make invocation as
164163
# unit-tests; locally invoke it directly or chain the two targets.
165164
test-controllers:
166165
go test ./internal/... -count=1
@@ -195,10 +194,10 @@ test-controllers-envtest: $(SETUP_ENVTEST)
195194
test-check-readiness:
196195
go test ./test/check-readiness/ -count=1
197196

198-
# ./cmd/... is excluded from go-unit-tests, so the batch tool needs its own target.
199-
# It is not a prerequisite of unit-tests: the checks job in pull-requests.yaml
200-
# runs it only when the diff touches a path listed in
201-
# cmd/backport-batch/test-inputs.txt.
197+
# The batch tool's suite drives real git repositories for minutes, so it is
198+
# kept out of go-unit-tests in a target of its own. It is not a prerequisite
199+
# of unit-tests: the checks job in pull-requests.yaml runs it only when the
200+
# diff touches a path listed in cmd/backport-batch/test-inputs.txt.
202201
test-backport-batch:
203202
go test ./cmd/backport-batch/... -count=1
204203

‎api/apps/v1alpha1/bucket/types.go‎

Lines changed: 3 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎api/apps/v1alpha1/postgresql/types.go‎

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎api/apps/v1alpha1/redis/types.go‎

Lines changed: 11 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎api/apps/v1alpha1/redis/zz_generated.deepcopy.go‎

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎api/apps/v1alpha1/vminstance/types.go‎

Lines changed: 3 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎api/apps/v1alpha1/vminstance/zz_generated.deepcopy.go‎

Lines changed: 8 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 95 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,95 @@
1+
// SPDX-License-Identifier: Apache-2.0
2+
// Package v1alpha1 defines strategy.backups.cozystack.io API types.
3+
//
4+
// Group: strategy.backups.cozystack.io
5+
// Version: v1alpha1
6+
package v1alpha1
7+
8+
import (
9+
corev1 "k8s.io/api/core/v1"
10+
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
11+
"k8s.io/apimachinery/pkg/runtime"
12+
)
13+
14+
func init() {
15+
SchemeBuilder.Register(func(s *runtime.Scheme) error {
16+
s.AddKnownTypes(GroupVersion,
17+
&Kubernetes{},
18+
&KubernetesList{},
19+
)
20+
return nil
21+
})
22+
}
23+
24+
const (
25+
KubernetesStrategyKind = "Kubernetes"
26+
)
27+
28+
// +kubebuilder:object:root=true
29+
// +kubebuilder:subresource:status
30+
// +kubebuilder:resource:scope=Cluster
31+
32+
// Kubernetes defines a backup strategy for a tenant Kubernetes application.
33+
// A tenant cluster keeps its state in two places the platform can reach: the
34+
// cluster's key prefix in the tenant's shared etcd DataStore, and host-side
35+
// objects (control-plane PKI Secrets, the application HelmReleases, and the
36+
// DataVolumes that back the tenant's PersistentVolumes). The strategy captures
37+
// the first with a one-shot Job and the second with Velero. The two are taken
38+
// one after another, so a backup is crash-consistent at best.
39+
type Kubernetes struct {
40+
metav1.TypeMeta `json:",inline"`
41+
metav1.ObjectMeta `json:"metadata,omitempty"`
42+
43+
Spec KubernetesSpec `json:"spec,omitempty"`
44+
Status KubernetesStatus `json:"status,omitempty"`
45+
}
46+
47+
// +kubebuilder:object:root=true
48+
49+
// KubernetesList contains a list of Kubernetes backup strategies.
50+
type KubernetesList struct {
51+
metav1.TypeMeta `json:",inline"`
52+
metav1.ListMeta `json:"metadata,omitempty"`
53+
Items []Kubernetes `json:"items"`
54+
}
55+
56+
// KubernetesSpec specifies the desired behavior of a Kubernetes backup strategy.
57+
type KubernetesSpec struct {
58+
// Template holds a PodTemplateSpec for the Job that dumps the cluster's
59+
// key prefix from its etcd DataStore to object storage, writes it back on
60+
// restore, and deletes the object on cleanup. The Job runs in the
61+
// application namespace. Helm-like Go templates are supported in every
62+
// string field and are rendered against:
63+
// - `.Release.Name` and `.Release.Namespace` — the application's name and
64+
// namespace; `.Release.Prefix` is `kubernetes-`.
65+
// - `.Mode` — `"backup"`, `"restore"` or `"cleanup"`.
66+
// - `.ObjectKey` — the object-storage key of this backup's dump.
67+
// - `.Datastore.Prefix` — the cluster's key prefix, without slashes.
68+
// - `.Datastore.Endpoints` — comma-separated etcd client URLs.
69+
// - `.Datastore.CertificateSecret` — the Secret holding the cluster's
70+
// etcd client certificate (`ca.crt`, `server.crt`, `server.key`).
71+
// - `.Parameters` — the resolved BackupClass strategy parameters.
72+
//
73+
// Stored schemaless for the same CRD-size reason as redis_types.go.
74+
//
75+
// +kubebuilder:validation:Schemaless
76+
// +kubebuilder:pruning:PreserveUnknownFields
77+
Template corev1.PodTemplateSpec `json:"template"`
78+
79+
// Velero holds the Velero Backup and Restore specs for the host-side
80+
// objects and volumes. Rendered against `.Application` and `.Parameters`,
81+
// like the Velero strategy.
82+
//
83+
// +kubebuilder:validation:Schemaless
84+
// +kubebuilder:pruning:PreserveUnknownFields
85+
Velero VeleroTemplate `json:"velero"`
86+
87+
// CertificateWarningThreshold is how close to expiry a control-plane
88+
// certificate may be before a backup records a warning. Defaults to 720h.
89+
// +optional
90+
CertificateWarningThreshold *metav1.Duration `json:"certificateWarningThreshold,omitempty"`
91+
}
92+
93+
type KubernetesStatus struct {
94+
Conditions []metav1.Condition `json:"conditions,omitempty"`
95+
}

‎api/backups/strategy/v1alpha1/zz_generated.deepcopy.go‎

Lines changed: 103 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎api/v1alpha1/workloadmonitor_types.go‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,10 @@ type WorkloadMonitorSpec struct {
3939
// that is not operational because a DataVolume it selects is not ready.
4040
const WorkloadMonitorReasonDataVolumeNotReady = "DataVolumeNotReady"
4141

42+
// WorkloadMonitorReasonBucketClaimNotReady is the status Reason of a monitor
43+
// that is not operational because a BucketClaim it selects is not provisioned.
44+
const WorkloadMonitorReasonBucketClaimNotReady = "BucketClaimNotReady"
45+
4246
// WorkloadMonitorStatus defines the observed state of WorkloadMonitor
4347
type WorkloadMonitorStatus struct {
4448
// Operational indicates if the workload meets all operational requirements

0 commit comments

Comments
 (0)