Skip to content

Commit 5dbd1f2

Browse files
authoredOct 26, 2022
Merge pull request #5 from pluralsh/master
add DeletionPolicy
2 parents 039c3e6 + c61f1a6 commit 5dbd1f2

File tree

4 files changed

+37
-0
lines changed

4 files changed

+37
-0
lines changed
 

‎apis/database/v1alpha1/database_types.go

+8
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,14 @@ type DatabaseSpec struct {
4444
// This field will be empty when the Database is dynamically provisioned by operator.
4545
// +optional
4646
ExistingDatabaseID string `json:"existingBucketID,omitempty"`
47+
48+
// DeletionPolicy is used to specify how to handle deletion. There are 2 possible values:
49+
// - Retain: Indicates that the database should not be deleted (default)
50+
// - Delete: Indicates that the database should be deleted
51+
//
52+
// +optional
53+
// +kubebuilder:default:=Retain
54+
DeletionPolicy DeletionPolicy `json:"deletionPolicy"`
4755
}
4856

4957
type DatabaseStatus struct {

‎apis/database/v1alpha1/databaseclass_types.go

+15
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,13 @@ func init() {
2222
SchemeBuilder.Register(&DatabaseClass{}, &DatabaseClassList{})
2323
}
2424

25+
type DeletionPolicy string
26+
27+
const (
28+
DeletionPolicyRetain DeletionPolicy = "Retain"
29+
DeletionPolicyDelete DeletionPolicy = "Delete"
30+
)
31+
2532
// +kubebuilder:object:root=true
2633
// +kubebuilder:resource:scope=Cluster
2734
type DatabaseClass struct {
@@ -37,6 +44,14 @@ type DatabaseClass struct {
3744
// for creating the database
3845
// +optional
3946
Parameters map[string]string `json:"parameters,omitempty"`
47+
48+
// DeletionPolicy is used to specify how to handle deletion. There are 2 possible values:
49+
// - Retain: Indicates that the database should not be deleted (default)
50+
// - Delete: Indicates that the database should be deleted
51+
//
52+
// +optional
53+
// +kubebuilder:default:=Retain
54+
DeletionPolicy DeletionPolicy `json:"deletionPolicy"`
4055
}
4156

4257
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object

‎config/crd/bases/database.plural.sh_databaseclasses.yaml

+7
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,13 @@ spec:
2424
of an object. Servers should convert recognized schemas to the latest
2525
internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources'
2626
type: string
27+
deletionPolicy:
28+
default: Retain
29+
description: 'DeletionPolicy is used to specify how to handle deletion.
30+
There are 2 possible values: - Retain: Indicates that the database should
31+
not be deleted (default) - Delete: Indicates that the database should
32+
be deleted'
33+
type: string
2734
driverName:
2835
description: DriverName is the name of driver associated with this database
2936
type: string

‎config/crd/bases/database.plural.sh_databases.yaml

+7
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,13 @@ spec:
7676
type: string
7777
type: object
7878
x-kubernetes-map-type: atomic
79+
deletionPolicy:
80+
default: Retain
81+
description: 'DeletionPolicy is used to specify how to handle deletion.
82+
There are 2 possible values: - Retain: Indicates that the database
83+
should not be deleted (default) - Delete: Indicates that the database
84+
should be deleted'
85+
type: string
7986
driverName:
8087
description: DriverName is the name of driver associated with this
8188
database

0 commit comments

Comments
 (0)
Please sign in to comment.