Skip to content

Commit 75940f0

Browse files
authored
Merge pull request #514 from vshn/develop
🔀 Merge develop into master (Release)
2 parents af889dc + 1de2c22 commit 75940f0

File tree

84 files changed

+2957
-783
lines changed

Some content is hidden

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

84 files changed

+2957
-783
lines changed

apis/apiserver/v1/generated.pb.go

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

apis/apiserver/v1/vshn_postgres_backup_types.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -112,15 +112,15 @@ func New() *VSHNPostgresBackup {
112112
return &VSHNPostgresBackup{}
113113
}
114114

115-
// SGBackupInfo holds necessary data for VSHNPostgresBackup
116-
type SGBackupInfo struct {
115+
// BackupInfo holds necessary data for VSHNPostgresBackup
116+
type BackupInfo struct {
117117
metav1.ObjectMeta
118118
Process runtime.RawExtension
119119
BackupInformation runtime.RawExtension
120120
}
121121

122-
// NewVSHNPostgresBackup creates a new VSHNPostgresBackup out of a SGBackupInfo and a database instance
123-
func NewVSHNPostgresBackup(backup *SGBackupInfo, db, originalNamespace string) *VSHNPostgresBackup {
122+
// NewVSHNPostgresBackup creates a new VSHNPostgresBackup out of a BackupInfo and a database instance
123+
func NewVSHNPostgresBackup(backup *BackupInfo, db, originalNamespace string) *VSHNPostgresBackup {
124124
if backup == nil || originalNamespace == "" || db == "" {
125125
return nil
126126
}

apis/apiserver/v1/vshn_postgres_backup_types_test.go

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,34 +1,35 @@
11
package v1
22

33
import (
4+
"testing"
5+
46
"gotest.tools/v3/assert"
57
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
68
"k8s.io/apimachinery/pkg/apis/meta/v1/unstructured"
79
"k8s.io/apimachinery/pkg/runtime"
8-
"testing"
910
)
1011

1112
func TestNewVSHNBackupFromBackInfo(t *testing.T) {
1213
tests := map[string]struct {
1314
db string
1415
namespace string
15-
backupInfo *SGBackupInfo
16+
backupInfo *BackupInfo
1617
vshnPostgresBackup *VSHNPostgresBackup
1718
}{
1819
"GivenNoBackupInfo_ThenNil": {
1920
db: "db1",
2021
namespace: "namespace",
2122
},
2223
"GivenNoDB_ThenNil": {
23-
backupInfo: &SGBackupInfo{
24+
backupInfo: &BackupInfo{
2425
ObjectMeta: metav1.ObjectMeta{Name: "backup"},
2526
Process: *rawFromObject(getTestProcess()),
2627
BackupInformation: *rawFromObject(getTestBI()),
2728
},
2829
namespace: "namespace",
2930
},
3031
"GivenNoNamespace_ThenNil": {
31-
backupInfo: &SGBackupInfo{
32+
backupInfo: &BackupInfo{
3233
ObjectMeta: metav1.ObjectMeta{Name: "backup"},
3334
Process: *rawFromObject(getTestProcess()),
3435
BackupInformation: *rawFromObject(getTestBI()),
@@ -38,7 +39,7 @@ func TestNewVSHNBackupFromBackInfo(t *testing.T) {
3839
"GivenBackupInfo_ThenVSHNBackup": {
3940
db: "db1",
4041
namespace: "namespace",
41-
backupInfo: &SGBackupInfo{
42+
backupInfo: &BackupInfo{
4243
ObjectMeta: metav1.ObjectMeta{Name: "backup"},
4344
Process: *rawFromObject(getTestProcess()),
4445
BackupInformation: *rawFromObject(getTestBI()),
@@ -55,7 +56,7 @@ func TestNewVSHNBackupFromBackInfo(t *testing.T) {
5556
"GivenBackupInfoWithNoProcess_ThenVSHNBackup": {
5657
db: "db1",
5758
namespace: "namespace",
58-
backupInfo: &SGBackupInfo{
59+
backupInfo: &BackupInfo{
5960
ObjectMeta: metav1.ObjectMeta{Name: "backup"},
6061
BackupInformation: *rawFromObject(getTestBI()),
6162
},
@@ -70,7 +71,7 @@ func TestNewVSHNBackupFromBackInfo(t *testing.T) {
7071
"GivenBackupInfoWithNoBI_ThenVSHNBackup": {
7172
db: "db1",
7273
namespace: "namespace",
73-
backupInfo: &SGBackupInfo{
74+
backupInfo: &BackupInfo{
7475
ObjectMeta: metav1.ObjectMeta{Name: "backup"},
7576
Process: *rawFromObject(getTestProcess()),
7677
},

apis/apiserver/v1/zz_generated.deepcopy.go

Lines changed: 18 additions & 18 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: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,9 @@ type OdooSpec struct {
4949
// SalesOrderID identifies the sales order in Odoo
5050
SalesOrderID string `json:"salesOrderID,omitempty"`
5151

52+
// Organization used to identify sales order
53+
Organization string `json:"organization,omitempty"`
54+
5255
// UnitID defines the billing unit type in Odoo
5356
UnitID string `json:"unitID"`
5457

apis/vshn/v1/common_types.go

Lines changed: 17 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -182,11 +182,25 @@ type VSHNMonitoring struct {
182182

183183
// Email necessary to send alerts via email
184184
Email string `json:"email,omitempty"`
185-
// VSHNScheduleStatus keeps track of the maintenance and backup schedules.
186-
// As of Crossplane 1.14 it's no longer allowed to change the composite.spec, so
187-
// any generate
188185
}
189186

187+
// InitialMaintenanceStatus tracks the status of the initial maintenance job.
188+
// It records when the job ran and whether it succeeded or failed.
189+
type InitialMaintenanceStatus struct {
190+
// CompletedAt is the timestamp when the initial maintenance job completed.
191+
// This field is set regardless of whether the job succeeded or failed.
192+
// +optional
193+
CompletedAt *string `json:"completedAt,omitempty"`
194+
195+
// Success indicates whether the initial maintenance job completed successfully.
196+
// True if the job succeeded, false if it failed.
197+
// +optional
198+
Success *bool `json:"success,omitempty"`
199+
}
200+
201+
// VSHNScheduleStatus keeps track of the maintenance and backup schedules.
202+
// As of Crossplane 1.14 it's no longer allowed to change the composite.spec, so
203+
// any generated schedules are stored in the status.
190204
type VSHNScheduleStatus struct {
191205
// Maintenance keeps track of the maintenance schedule.
192206
Maintenance VSHNDBaaSMaintenanceScheduleSpec `json:"maintenance,omitempty"`

apis/vshn/v1/dbaas_vshn_forgejo.go

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -165,6 +165,9 @@ type VSHNForgejoStatus struct {
165165
// Schedules keeps track of random generated schedules, is overwriten by
166166
// schedules set in the service's spec.
167167
Schedules VSHNScheduleStatus `json:"schedules,omitempty"`
168+
// InitialMaintenance tracks the status of the initial maintenance job,
169+
// including when it ran and whether it succeeded or failed.
170+
InitialMaintenance InitialMaintenanceStatus `json:"initialMaintenance,omitempty"`
168171

169172
// ResourceStatus represents the observed state of a managed resource.
170173
xpv1.ResourceStatus `json:",inline"`
@@ -182,6 +185,22 @@ func (v *VSHNForgejo) SetInstanceNamespaceStatus() {
182185
v.Status.InstanceNamespace = v.GetInstanceNamespace()
183186
}
184187

188+
func (v *VSHNForgejo) GetInitialMaintenanceRan() bool {
189+
return v.Status.InitialMaintenance.CompletedAt != nil
190+
}
191+
192+
func (v *VSHNForgejo) GetInitialMaintenanceCompletedAt() string {
193+
if v.Status.InitialMaintenance.CompletedAt != nil {
194+
return *v.Status.InitialMaintenance.CompletedAt
195+
}
196+
return ""
197+
}
198+
199+
func (v *VSHNForgejo) SetInitialMaintenanceStatus(completedAt string, success bool) {
200+
v.Status.InitialMaintenance.CompletedAt = &completedAt
201+
v.Status.InitialMaintenance.Success = &success
202+
}
203+
185204
// +kubebuilder:object:generate=true
186205
// +kubebuilder:object:root=true
187206

apis/vshn/v1/dbaas_vshn_keycloak.go

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -223,6 +223,9 @@ type VSHNKeycloakStatus struct {
223223
// Schedules keeps track of random generated schedules, is overwriten by
224224
// schedules set in the service's spec.
225225
Schedules VSHNScheduleStatus `json:"schedules,omitempty"`
226+
// InitialMaintenance tracks the status of the initial maintenance job,
227+
// including when it ran and whether it succeeded or failed.
228+
InitialMaintenance InitialMaintenanceStatus `json:"initialMaintenance,omitempty"`
226229
// ResourceStatus represents the observed state of a managed resource.
227230
xpv1.ResourceStatus `json:",inline"`
228231
// LastConfigHash is the hash of last applied customConfigurationRef.
@@ -251,6 +254,22 @@ func (v *VSHNKeycloak) SetInstanceNamespaceStatus() {
251254
v.Status.InstanceNamespace = v.GetInstanceNamespace()
252255
}
253256

257+
func (v *VSHNKeycloak) GetInitialMaintenanceRan() bool {
258+
return v.Status.InitialMaintenance.CompletedAt != nil
259+
}
260+
261+
func (v *VSHNKeycloak) GetInitialMaintenanceCompletedAt() string {
262+
if v.Status.InitialMaintenance.CompletedAt != nil {
263+
return *v.Status.InitialMaintenance.CompletedAt
264+
}
265+
return ""
266+
}
267+
268+
func (v *VSHNKeycloak) SetInitialMaintenanceStatus(completedAt string, success bool) {
269+
v.Status.InitialMaintenance.CompletedAt = &completedAt
270+
v.Status.InitialMaintenance.Success = &success
271+
}
272+
254273
func (v *VSHNKeycloak) GetLastConfigHash() string {
255274
return v.Status.LastConfigHash
256275
}

apis/vshn/v1/dbaas_vshn_mariadb.go

Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -147,8 +147,9 @@ type VSHNMariaDBStatus struct {
147147
CurrentInstances int `json:"currentInstances,omitempty"`
148148
// MariaDBVersion contains the current MariaDB server version
149149
MariaDBVersion string `json:"mariadbVersion,omitempty"`
150-
// InitialMaintenanceRan tracks if the initial maintenance job has been triggered
151-
InitialMaintenanceRan bool `json:"initialMaintenanceRan,omitempty"`
150+
// InitialMaintenance tracks the status of the initial maintenance job,
151+
// including when it ran and whether it succeeded or failed.
152+
InitialMaintenance InitialMaintenanceStatus `json:"initialMaintenance,omitempty"`
152153
// ResourceStatus represents the observed state of a managed resource.
153154
xpv1.ResourceStatus `json:",inline"`
154155
}
@@ -169,6 +170,22 @@ func (v *VSHNMariaDB) SetInstanceNamespaceStatus() {
169170
v.Status.InstanceNamespace = v.GetInstanceNamespace()
170171
}
171172

173+
func (v *VSHNMariaDB) GetInitialMaintenanceRan() bool {
174+
return v.Status.InitialMaintenance.CompletedAt != nil
175+
}
176+
177+
func (v *VSHNMariaDB) GetInitialMaintenanceCompletedAt() string {
178+
if v.Status.InitialMaintenance.CompletedAt != nil {
179+
return *v.Status.InitialMaintenance.CompletedAt
180+
}
181+
return ""
182+
}
183+
184+
func (v *VSHNMariaDB) SetInitialMaintenanceStatus(completedAt string, success bool) {
185+
v.Status.InitialMaintenance.CompletedAt = &completedAt
186+
v.Status.InitialMaintenance.Success = &success
187+
}
188+
172189
// +kubebuilder:object:generate=true
173190
// +kubebuilder:object:root=true
174191

apis/vshn/v1/dbaas_vshn_postgresql.go

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -285,6 +285,9 @@ type VSHNPostgreSQLStatus struct {
285285
// Schedules keeps track of random generated schedules, is overwriten by
286286
// schedules set in the service's spec.
287287
Schedules VSHNScheduleStatus `json:"schedules,omitempty"`
288+
// InitialMaintenance tracks the status of the initial maintenance job,
289+
// including when it ran and whether it succeeded or failed.
290+
InitialMaintenance InitialMaintenanceStatus `json:"initialMaintenance,omitempty"`
288291
// ResourceStatus represents the observed state of a managed resource.
289292
xpv1.ResourceStatus `json:",inline"`
290293
}
@@ -373,7 +376,8 @@ type XVSHNPostgreSQLStatus struct {
373376

374377
type XVSHNPostgreSQLSpec struct {
375378
// Parameters are the configurable fields of a VSHNPostgreSQL.
376-
Parameters VSHNPostgreSQLParameters `json:"parameters,omitempty"`
379+
Parameters VSHNPostgreSQLParameters `json:"parameters,omitempty"`
380+
CompositionRef cpv1.CompositionReference `json:"compositionRef,omitempty"`
377381
xpv1.ResourceSpec `json:",inline"`
378382
}
379383

@@ -396,6 +400,22 @@ func (v *VSHNPostgreSQL) SetInstanceNamespaceStatus() {
396400
v.Status.InstanceNamespace = v.GetInstanceNamespace()
397401
}
398402

403+
func (v *VSHNPostgreSQL) GetInitialMaintenanceRan() bool {
404+
return v.Status.InitialMaintenance.CompletedAt != nil
405+
}
406+
407+
func (v *VSHNPostgreSQL) GetInitialMaintenanceCompletedAt() string {
408+
if v.Status.InitialMaintenance.CompletedAt != nil {
409+
return *v.Status.InitialMaintenance.CompletedAt
410+
}
411+
return ""
412+
}
413+
414+
func (v *VSHNPostgreSQL) SetInitialMaintenanceStatus(completedAt string, success bool) {
415+
v.Status.InitialMaintenance.CompletedAt = &completedAt
416+
v.Status.InitialMaintenance.Success = &success
417+
}
418+
399419
func (v *XVSHNPostgreSQL) GetInstanceNamespace() string {
400420
return fmt.Sprintf("vshn-postgresql-%s", v.GetName())
401421
}

0 commit comments

Comments
 (0)