Skip to content

add DeletionPolicy #5

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Oct 26, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions apis/database/v1alpha1/database_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,14 @@ type DatabaseSpec struct {
// This field will be empty when the Database is dynamically provisioned by operator.
// +optional
ExistingDatabaseID string `json:"existingBucketID,omitempty"`

// DeletionPolicy is used to specify how to handle deletion. There are 2 possible values:
// - Retain: Indicates that the database should not be deleted (default)
// - Delete: Indicates that the database should be deleted
//
// +optional
// +kubebuilder:default:=Retain
DeletionPolicy DeletionPolicy `json:"deletionPolicy"`
}

type DatabaseStatus struct {
Expand Down
15 changes: 15 additions & 0 deletions apis/database/v1alpha1/databaseclass_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,13 @@ func init() {
SchemeBuilder.Register(&DatabaseClass{}, &DatabaseClassList{})
}

type DeletionPolicy string

const (
DeletionPolicyRetain DeletionPolicy = "Retain"
DeletionPolicyDelete DeletionPolicy = "Delete"
)

// +kubebuilder:object:root=true
// +kubebuilder:resource:scope=Cluster
type DatabaseClass struct {
Expand All @@ -37,6 +44,14 @@ type DatabaseClass struct {
// for creating the database
// +optional
Parameters map[string]string `json:"parameters,omitempty"`

// DeletionPolicy is used to specify how to handle deletion. There are 2 possible values:
// - Retain: Indicates that the database should not be deleted (default)
// - Delete: Indicates that the database should be deleted
//
// +optional
// +kubebuilder:default:=Retain
DeletionPolicy DeletionPolicy `json:"deletionPolicy"`
}

// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
Expand Down
7 changes: 7 additions & 0 deletions config/crd/bases/database.plural.sh_databaseclasses.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,13 @@ spec:
of an object. Servers should convert recognized schemas to the latest
internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources'
type: string
deletionPolicy:
default: Retain
description: 'DeletionPolicy is used to specify how to handle deletion.
There are 2 possible values: - Retain: Indicates that the database should
not be deleted (default) - Delete: Indicates that the database should
be deleted'
type: string
driverName:
description: DriverName is the name of driver associated with this database
type: string
Expand Down
7 changes: 7 additions & 0 deletions config/crd/bases/database.plural.sh_databases.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,13 @@ spec:
type: string
type: object
x-kubernetes-map-type: atomic
deletionPolicy:
default: Retain
description: 'DeletionPolicy is used to specify how to handle deletion.
There are 2 possible values: - Retain: Indicates that the database
should not be deleted (default) - Delete: Indicates that the database
should be deleted'
type: string
driverName:
description: DriverName is the name of driver associated with this
database
Expand Down