Skip to content

Commit 6562f9c

Browse files
authored
Merge pull request #574 from vshn/develop
🔀 Merge develop into master (Release)
2 parents 640d6de + a2ebd37 commit 6562f9c

Some content is hidden

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

62 files changed

+3099
-808
lines changed

Makefile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,7 @@ generate: get-crds generate-stackgres-crds generate-cnpg-crds protobuf-gen ## G
7979
go version
8080
rm -rf apis/generated
8181
go run sigs.k8s.io/controller-tools/cmd/controller-gen paths="{./apis/v1/..., ./apis/vshn/..., ./apis/exoscale/..., ./apis/apiserver/..., ./apis/syntools/..., ./apis/codey/...}" object crd:crdVersions=v1,allowDangerousTypes=true output:artifacts:config=./apis/generated
82+
go run sigs.k8s.io/controller-tools/cmd/controller-gen paths="./apis/cnpg/v1/..." object output:object:artifacts:config=./apis/cnpg/v1
8283
go generate ./...
8384
# Because yaml is such a fun and easy specification, we need to hack some things here.
8485
# Depending on the yaml parser implementation the equal sign (=) has special meaning, or not...

apis/cnpg/v1/backups.go

Lines changed: 100 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,100 @@
1+
package v1
2+
3+
import (
4+
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
5+
)
6+
7+
// +kubebuilder:object:root=true
8+
9+
// Backup is the API for creating one-off backups.
10+
// This is a partial reconstruction containing only fields we need for maintenance operations.
11+
type Backup struct {
12+
metav1.TypeMeta `json:",inline"`
13+
metav1.ObjectMeta `json:"metadata,omitempty"`
14+
15+
// Spec defines the desired state of a Backup.
16+
Spec BackupSpec `json:"spec"`
17+
18+
// Status defines the status of a Backup.
19+
Status BackupStatus `json:"status,omitempty"`
20+
}
21+
22+
// +kubebuilder:object:root=true
23+
24+
// BackupList contains a list of Backup resources.
25+
type BackupList struct {
26+
metav1.TypeMeta `json:",inline"`
27+
metav1.ListMeta `json:"metadata,omitempty"`
28+
29+
Items []Backup `json:"items"`
30+
}
31+
32+
// BackupSpec defines the desired state of a Backup.
33+
type BackupSpec struct {
34+
// Cluster is the reference to the PostgreSQL cluster to backup
35+
Cluster BackupCluster `json:"cluster"`
36+
37+
// Method defines the backup method. Can be "barmanObjectStore" or "plugin"
38+
Method BackupMethod `json:"method,omitempty"`
39+
40+
// Configuration parameters passed to the plugin managing this backup
41+
PluginConfiguration `json:"pluginConfiguration,omitempty"`
42+
}
43+
44+
// BackupCluster defines the cluster reference for a backup.
45+
type BackupCluster struct {
46+
// Name of the cluster to backup
47+
Name string `json:"name"`
48+
}
49+
50+
// BackupMethod defines the backup method
51+
// +kubebuilder:validation:Enum=barmanObjectStore;plugin;volumeSnapshot
52+
type BackupMethod string
53+
54+
const (
55+
BackupMethodBarmanObjectStore BackupMethod = "barmanObjectStore"
56+
BackupMethodPlugin BackupMethod = "plugin"
57+
BackupMethodVolumeSnapshot BackupMethod = "volumeSnapshot"
58+
)
59+
60+
type PluginConfiguration struct {
61+
// Name is the name of the plugin managing this backup
62+
Name string `json:"name"`
63+
// Parameters are the configuration parameters passed to the backup plugin for this backup
64+
Parameters map[string]string `json:"parameters,omitempty"`
65+
}
66+
67+
// BackupStatus defines the observed state of a Backup.
68+
type BackupStatus struct {
69+
// Phase describes the current phase of the backup
70+
// +kubebuilder:validation:Enum=pending;running;completed;failed
71+
Phase BackupPhase `json:"phase,omitempty"`
72+
73+
// Error contains error details if the backup failed
74+
Error string `json:"error,omitempty"`
75+
76+
// StartedAt is the time when the backup was started
77+
StartedAt *metav1.Time `json:"startedAt,omitempty"`
78+
79+
// StoppedAt is the time when the backup was stopped
80+
StoppedAt *metav1.Time `json:"stoppedAt,omitempty"`
81+
82+
// BackupID is the backup identifier
83+
BackupID string `json:"backupId,omitempty"`
84+
85+
// BackupName is the backup name in the object store
86+
BackupName string `json:"backupName,omitempty"`
87+
88+
// DestinationPath is the path where the backup is stored
89+
DestinationPath string `json:"destinationPath,omitempty"`
90+
}
91+
92+
// BackupPhase defines the phase of the backup
93+
type BackupPhase string
94+
95+
const (
96+
BackupPhasePending BackupPhase = "pending"
97+
BackupPhaseRunning BackupPhase = "running"
98+
BackupPhaseCompleted BackupPhase = "completed"
99+
BackupPhaseFailed BackupPhase = "failed"
100+
)

apis/cnpg/v1/groupversion_info.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,5 +26,7 @@ func init() {
2626
&ClusterList{},
2727
&ImageCatalog{},
2828
&ImageCatalogList{},
29+
&Backup{},
30+
&BackupList{},
2931
)
3032
}

apis/cnpg/v1/zz_generated.deepcopy.go

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

apis/vshn/v1/billing_service.go

Lines changed: 37 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -38,31 +38,40 @@ type BillingServiceSpec struct {
3838
Odoo OdooSpec `json:"odoo,omitempty"`
3939
}
4040

41+
// ItemSpec defines a single billable product/item
42+
type ItemSpec struct {
43+
// ProductID identifies the product in the billing system
44+
ProductID string `json:"productID"`
45+
46+
// ItemDescription is a human-readable description of the billing item
47+
ItemDescription string `json:"itemDescription,omitempty"`
48+
49+
// ItemGroupDescription describes the billing item group
50+
ItemGroupDescription string `json:"itemGroupDescription,omitempty"`
51+
52+
// Unit defines the billing unit type for this product
53+
Unit string `json:"unit,omitempty"`
54+
55+
// Value represents the billable metric for this product
56+
// Can be: replica count, disk size (e.g., "50Gi"), percentage, etc.
57+
Value string `json:"value"`
58+
}
59+
4160
// OdooSpec defines Odoo-specific billing configuration
4261
type OdooSpec struct {
4362
// InstanceID uniquely identifies the service instance in Odoo
4463
InstanceID string `json:"instanceID"`
4564

46-
// ProductID identifies the product in the billing system
47-
ProductID string `json:"productID"`
48-
4965
// SalesOrderID identifies the sales order in Odoo
5066
SalesOrderID string `json:"salesOrderID,omitempty"`
5167

5268
// Organization used to identify sales order
5369
Organization string `json:"organization,omitempty"`
5470

55-
// UnitID defines the billing unit type in Odoo
56-
UnitID string `json:"unitID"`
57-
58-
// Size represents the size of the service instance
59-
Size string `json:"size,omitempty"`
60-
61-
// ItemGroupDescription describes the billing item group
62-
ItemGroupDescription string `json:"itemGroupDescription"`
63-
64-
// ItemDescription is a human readable description of the billing item
65-
ItemDescription string `json:"itemDescription"`
71+
// Items defines list of billable products for this instance
72+
// Each item represents a product with independent lifecycle and event tracking
73+
// +kubebuilder:validation:MinItems=1
74+
Items []ItemSpec `json:"items"`
6675
}
6776

6877
// BillingServiceStatus defines the observed state of a BillingService
@@ -76,15 +85,25 @@ type BillingServiceStatus struct {
7685

7786
// BillingEventStatus represents the status of a billing event
7887
type BillingEventStatus struct {
79-
// Type is the type of billing event (created, deleted, scaled)
80-
// +kubebuilder:validation:Enum="created";"deleted";"scaled"
88+
// Type is the type of billing event (create, delete, scale)
89+
// +kubebuilder:validation:Enum="create";"delete";"scale"
8190
Type string `json:"type"`
8291

8392
// ProductID identifies the product in the billing system
8493
ProductID string `json:"productId"`
8594

86-
// Size represents the size/plan at the time of the event
87-
Size string `json:"size"`
95+
// Value represents the billable metric at the time of the event
96+
// Generic field supporting replica count, disk size, percentages, etc.
97+
Value string `json:"value"`
98+
99+
// Unit defines the billing unit type for this product
100+
Unit string `json:"unit,omitempty"`
101+
102+
// ItemDescription is a human-readable description of the billing item
103+
ItemDescription string `json:"itemDescription,omitempty"`
104+
105+
// ItemGroupDescription describes the billing item group
106+
ItemGroupDescription string `json:"itemGroupDescription,omitempty"`
88107

89108
// Timestamp when the event occurred
90109
Timestamp metav1.Time `json:"timestamp"`

0 commit comments

Comments
 (0)