|
| 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 | +} |
0 commit comments