Skip to content

Commit 2507d55

Browse files
committed
feat: wip
1 parent 853addd commit 2507d55

25 files changed

+10409
-182
lines changed

PROJECT

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,4 +48,22 @@ resources:
4848
kind: PostgresqlPublication
4949
path: github.com/easymile/postgresql-operator/api/postgresql/v1alpha1
5050
version: v1alpha1
51+
- api:
52+
crdVersion: v1
53+
namespaced: true
54+
controller: true
55+
domain: easymile.com
56+
group: postgresql
57+
kind: PostgresqlBackupProvider
58+
path: github.com/easymile/postgresql-operator/api/postgresql/v1alpha1
59+
version: v1alpha1
60+
- api:
61+
crdVersion: v1
62+
namespaced: true
63+
controller: true
64+
domain: easymile.com
65+
group: postgresql
66+
kind: PostgresqlBackup
67+
path: github.com/easymile/postgresql-operator/api/postgresql/v1alpha1
68+
version: v1alpha1
5169
version: "3"
Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
/*
2+
Copyright 2026.
3+
4+
Licensed under the Apache License, Version 2.0 (the "License");
5+
you may not use this file except in compliance with the License.
6+
You may obtain a copy of the License at
7+
8+
http://www.apache.org/licenses/LICENSE-2.0
9+
10+
Unless required by applicable law or agreed to in writing, software
11+
distributed under the License is distributed on an "AS IS" BASIS,
12+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
See the License for the specific language governing permissions and
14+
limitations under the License.
15+
*/
16+
17+
package v1alpha1
18+
19+
import (
20+
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
21+
)
22+
23+
// EDIT THIS FILE! THIS IS SCAFFOLDING FOR YOU TO OWN!
24+
// NOTE: json tags are required. Any new fields you add must have json tags for the fields to be serialized.
25+
26+
// PostgresqlBackupSpec defines the desired state of PostgresqlBackup.
27+
type PostgresqlBackupSpec struct {
28+
// Schedule for cronjob
29+
Schedule string `json:"schedule"`
30+
}
31+
32+
// PostgresqlBackupStatus defines the observed state of PostgresqlBackup.
33+
type PostgresqlBackupStatus struct {
34+
// INSERT ADDITIONAL STATUS FIELD - define observed state of cluster
35+
// Important: Run "make" to regenerate code after modifying this file
36+
}
37+
38+
// +kubebuilder:object:root=true
39+
// +kubebuilder:subresource:status
40+
41+
// PostgresqlBackup is the Schema for the postgresqlbackups API.
42+
type PostgresqlBackup struct {
43+
metav1.TypeMeta `json:",inline"`
44+
metav1.ObjectMeta `json:"metadata,omitempty"`
45+
46+
Spec PostgresqlBackupSpec `json:"spec,omitempty"`
47+
Status PostgresqlBackupStatus `json:"status,omitempty"`
48+
}
49+
50+
// +kubebuilder:object:root=true
51+
52+
// PostgresqlBackupList contains a list of PostgresqlBackup.
53+
type PostgresqlBackupList struct {
54+
metav1.TypeMeta `json:",inline"`
55+
metav1.ListMeta `json:"metadata,omitempty"`
56+
Items []PostgresqlBackup `json:"items"`
57+
}
58+
59+
func init() {
60+
SchemeBuilder.Register(&PostgresqlBackup{}, &PostgresqlBackupList{})
61+
}
Lines changed: 95 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,95 @@
1+
/*
2+
Copyright 2026.
3+
4+
Licensed under the Apache License, Version 2.0 (the "License");
5+
you may not use this file except in compliance with the License.
6+
You may obtain a copy of the License at
7+
8+
http://www.apache.org/licenses/LICENSE-2.0
9+
10+
Unless required by applicable law or agreed to in writing, software
11+
distributed under the License is distributed on an "AS IS" BASIS,
12+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
See the License for the specific language governing permissions and
14+
limitations under the License.
15+
*/
16+
17+
package v1alpha1
18+
19+
import (
20+
batchv1 "k8s.io/api/batch/v1"
21+
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
22+
)
23+
24+
// EDIT THIS FILE! THIS IS SCAFFOLDING FOR YOU TO OWN!
25+
// NOTE: json tags are required. Any new fields you add must have json tags for the fields to be serialized.
26+
27+
// PostgresqlBackupProviderSpec defines the desired state of PostgresqlBackupProvider.
28+
type PostgresqlBackupProviderSpec struct {
29+
// INSERT ADDITIONAL SPEC FIELDS - desired state of cluster
30+
// Important: Run "make" to regenerate code after modifying this file
31+
32+
// Cron job spec for backup runs
33+
// +required
34+
CronJobSpec *batchv1.CronJobSpec `json:"cronJobSpec,omitempty"`
35+
// Name used for cronjob
36+
// +optional
37+
CronJobName string `json:"cronJobName,omitempty"`
38+
// Generated Secret name used to populate pg_dump information
39+
// +optional
40+
GeneratedSecretName string `json:"generatedSecretName,omitempty"`
41+
// Wait for linked resource to be deleted
42+
// +optional
43+
WaitLinkedResourcesDeletion bool `json:"waitLinkedResourcesDeletion,omitempty"`
44+
}
45+
46+
type BackupProviderStatusPhase string
47+
48+
const (
49+
BackupProviderNoPhase BackupProviderStatusPhase = ""
50+
BackupProviderErrorPhase BackupProviderStatusPhase = "Error"
51+
BackupProviderValidPhase BackupProviderStatusPhase = "Valid"
52+
)
53+
54+
// PostgresqlBackupProviderStatus defines the observed state of PostgresqlBackupProvider.
55+
type PostgresqlBackupProviderStatus struct {
56+
// Current phase of the operator
57+
Phase BackupProviderStatusPhase `json:"phase,omitempty"`
58+
// Human-readable message indicating details about current operator phase or error.
59+
// +optional
60+
Message string `json:"message,omitempty"`
61+
// True if all resources are in a ready state and all work is done.
62+
// +optional
63+
Ready bool `json:"ready,omitempty"`
64+
// Resource Spec hash
65+
Hash string `json:"hash,omitempty"`
66+
// Generated secret name
67+
GeneratedSecretName string `json:"generatedSecretName,omitempty"`
68+
// Cron job name
69+
CronJobName string `json:"cronJobName,omitempty"`
70+
}
71+
72+
// +kubebuilder:object:root=true
73+
// +kubebuilder:subresource:status
74+
75+
// PostgresqlBackupProvider is the Schema for the postgresqlbackupproviders API.
76+
type PostgresqlBackupProvider struct {
77+
metav1.TypeMeta `json:",inline"`
78+
metav1.ObjectMeta `json:"metadata,omitempty"`
79+
80+
Spec PostgresqlBackupProviderSpec `json:"spec,omitempty"`
81+
Status PostgresqlBackupProviderStatus `json:"status,omitempty"`
82+
}
83+
84+
// +kubebuilder:object:root=true
85+
86+
// PostgresqlBackupProviderList contains a list of PostgresqlBackupProvider.
87+
type PostgresqlBackupProviderList struct {
88+
metav1.TypeMeta `json:",inline"`
89+
metav1.ListMeta `json:"metadata,omitempty"`
90+
Items []PostgresqlBackupProvider `json:"items"`
91+
}
92+
93+
func init() {
94+
SchemeBuilder.Register(&PostgresqlBackupProvider{}, &PostgresqlBackupProviderList{})
95+
}

api/postgresql/v1alpha1/zz_generated.deepcopy.go

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

0 commit comments

Comments
 (0)