Skip to content

Commit e2388c3

Browse files
committed
feat: wip
1 parent 5c83ffd commit e2388c3

File tree

6 files changed

+55
-8
lines changed

6 files changed

+55
-8
lines changed

api/postgresql/v1alpha1/postgresqlbackup_types.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,8 @@ type PostgresqlBackupStatus struct {
6161
Ready bool `json:"ready,omitempty"`
6262
// Resource Spec hash
6363
Hash string `json:"hash,omitempty"`
64+
// BackupProvider spec hash
65+
ProviderHash string `json:"providerHash,omitempty"`
6466
}
6567

6668
// +kubebuilder:object:root=true

api/postgresql/v1alpha1/postgresqlbackupprovider_types.go

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -32,9 +32,21 @@ type PostgresqlBackupProviderSpec struct {
3232
// Cron job spec for backup runs
3333
// +required
3434
CronJobSpec *batchv1.CronJobSpec `json:"cronJobSpec,omitempty"`
35-
// Name used for cronjob
36-
// +optional
35+
// Name used for cronjob or job
36+
// +required
3737
CronJobName string `json:"cronJobName,omitempty"`
38+
// Map of string keys and values that can be used to organize and categorize
39+
// (scope and select) objects. May match selectors of replication controllers
40+
// and services.
41+
// More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/labels
42+
// +optional
43+
Labels map[string]string `json:"labels,omitempty"`
44+
// Annotations is an unstructured key value map stored with a resource that may be
45+
// set by external tools to store and retrieve arbitrary metadata. They are not
46+
// queryable and should be preserved when modifying objects.
47+
// More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/annotations
48+
// +optional
49+
Annotations map[string]string `json:"annotations,omitempty"`
3850
// Generated Secret name used to populate pg_dump information
3951
// +optional
4052
GeneratedSecretName string `json:"generatedSecretName,omitempty"`
@@ -61,8 +73,6 @@ type PostgresqlBackupProviderStatus struct {
6173
// True if all resources are in a ready state and all work is done.
6274
// +optional
6375
Ready bool `json:"ready,omitempty"`
64-
// Resource Spec hash
65-
Hash string `json:"hash,omitempty"`
6676
// Generated secret name
6777
GeneratedSecretName string `json:"generatedSecretName,omitempty"`
6878
// Cron job name

api/postgresql/v1alpha1/zz_generated.deepcopy.go

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

config/crd/bases/postgresql.easymile.com_postgresqlbackupproviders.yaml

Lines changed: 20 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -41,8 +41,17 @@ spec:
4141
description: PostgresqlBackupProviderSpec defines the desired state of
4242
PostgresqlBackupProvider.
4343
properties:
44+
annotations:
45+
additionalProperties:
46+
type: string
47+
description: |-
48+
Annotations is an unstructured key value map stored with a resource that may be
49+
set by external tools to store and retrieve arbitrary metadata. They are not
50+
queryable and should be preserved when modifying objects.
51+
More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/annotations
52+
type: object
4453
cronJobName:
45-
description: Name used for cronjob
54+
description: Name used for cronjob or job
4655
type: string
4756
cronJobSpec:
4857
description: Cron job spec for backup runs
@@ -9194,10 +9203,20 @@ spec:
91949203
generatedSecretName:
91959204
description: Generated Secret name used to populate pg_dump information
91969205
type: string
9206+
labels:
9207+
additionalProperties:
9208+
type: string
9209+
description: |-
9210+
Map of string keys and values that can be used to organize and categorize
9211+
(scope and select) objects. May match selectors of replication controllers
9212+
and services.
9213+
More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/labels
9214+
type: object
91979215
waitLinkedResourcesDeletion:
91989216
description: Wait for linked resource to be deleted
91999217
type: boolean
92009218
required:
9219+
- cronJobName
92019220
- cronJobSpec
92029221
type: object
92039222
status:
@@ -9210,9 +9229,6 @@ spec:
92109229
generatedSecretName:
92119230
description: Generated secret name
92129231
type: string
9213-
hash:
9214-
description: Resource Spec hash
9215-
type: string
92169232
message:
92179233
description: Human-readable message indicating details about current
92189234
operator phase or error.

config/crd/bases/postgresql.easymile.com_postgresqlbackups.yaml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,9 @@ spec:
8888
phase:
8989
description: Current phase of the operator
9090
type: string
91+
providerHash:
92+
description: BackupProvider spec hash
93+
type: string
9194
ready:
9295
description: True if all resources are in a ready state and all work
9396
is done.

internal/controller/postgresql/postgresqlbackup_controller.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -151,6 +151,8 @@ func (r *PostgresqlBackupReconciler) mainReconcile(
151151
return ctrl.Result{}, nil
152152
}
153153

154+
// Compute spec hash
155+
154156
// Success
155157
return r.manageSuccess(ctx, reqLogger, instance, originalPatch)
156158
}

0 commit comments

Comments
 (0)