From 11a0ae79bb5a069c526d1da2fbbb09278759b8a1 Mon Sep 17 00:00:00 2001 From: Arnob kumar saha Date: Mon, 15 Jul 2024 13:28:16 +0600 Subject: [PATCH] Use DeletionPolicy in etcd Signed-off-by: Arnob kumar saha --- apis/kubedb/v1alpha1/conversion.go | 4 ++-- apis/kubedb/v1alpha1/zz_generated.conversion.go | 4 ++-- apis/kubedb/v1alpha2/etcd_helpers.go | 4 ++-- apis/kubedb/v1alpha2/etcd_types.go | 4 ++-- apis/kubedb/v1alpha2/openapi_generated.go | 4 ++-- crds/kubedb.com_etcds.yaml | 14 +++++++------- openapi/swagger.json | 8 ++++---- 7 files changed, 21 insertions(+), 21 deletions(-) diff --git a/apis/kubedb/v1alpha1/conversion.go b/apis/kubedb/v1alpha1/conversion.go index d308d6ecc7..b5a0a2b13f 100644 --- a/apis/kubedb/v1alpha1/conversion.go +++ b/apis/kubedb/v1alpha1/conversion.go @@ -280,7 +280,7 @@ func Convert_v1alpha1_EtcdSpec_To_v1alpha2_EtcdSpec(in *EtcdSpec, out *v1alpha2. }) } // WARNING: in.UpdateStrategy requires manual conversion: does not exist in peer-type - out.TerminationPolicy = v1alpha2.TerminationPolicy(in.TerminationPolicy) + out.DeletionPolicy = v1alpha2.TerminationPolicy(in.TerminationPolicy) return nil } @@ -304,7 +304,7 @@ func Convert_v1alpha2_EtcdSpec_To_v1alpha1_EtcdSpec(in *v1alpha2.EtcdSpec, out * out.PodTemplate = in.PodTemplate // WARNING: in.ServiceTemplates requires manual conversion: does not exist in peer-type // WARNING: in.Halted requires manual conversion: does not exist in peer-type - out.TerminationPolicy = TerminationPolicy(in.TerminationPolicy) + out.TerminationPolicy = TerminationPolicy(in.DeletionPolicy) return nil } diff --git a/apis/kubedb/v1alpha1/zz_generated.conversion.go b/apis/kubedb/v1alpha1/zz_generated.conversion.go index 7aa2f92c75..5202c5cc83 100644 --- a/apis/kubedb/v1alpha1/zz_generated.conversion.go +++ b/apis/kubedb/v1alpha1/zz_generated.conversion.go @@ -896,7 +896,7 @@ func autoConvert_v1alpha1_EtcdSpec_To_v1alpha2_EtcdSpec(in *EtcdSpec, out *v1alp out.PodTemplate = in.PodTemplate // WARNING: in.ServiceTemplate requires manual conversion: does not exist in peer-type // WARNING: in.UpdateStrategy requires manual conversion: does not exist in peer-type - out.TerminationPolicy = v1alpha2.TerminationPolicy(in.TerminationPolicy) + out.DeletionPolicy = v1alpha2.TerminationPolicy(in.TerminationPolicy) return nil } @@ -920,7 +920,7 @@ func autoConvert_v1alpha2_EtcdSpec_To_v1alpha1_EtcdSpec(in *v1alpha2.EtcdSpec, o out.PodTemplate = in.PodTemplate // WARNING: in.ServiceTemplates requires manual conversion: does not exist in peer-type // WARNING: in.Halted requires manual conversion: does not exist in peer-type - out.TerminationPolicy = TerminationPolicy(in.TerminationPolicy) + out.TerminationPolicy = TerminationPolicy(in.DeletionPolicy) return nil } diff --git a/apis/kubedb/v1alpha2/etcd_helpers.go b/apis/kubedb/v1alpha2/etcd_helpers.go index 60f3bb4723..d0708704c2 100644 --- a/apis/kubedb/v1alpha2/etcd_helpers.go +++ b/apis/kubedb/v1alpha2/etcd_helpers.go @@ -181,8 +181,8 @@ func (e *Etcd) SetDefaults() { if e.Spec.StorageType == "" { e.Spec.StorageType = StorageTypeDurable } - if e.Spec.TerminationPolicy == "" { - e.Spec.TerminationPolicy = TerminationPolicyDelete + if e.Spec.DeletionPolicy == "" { + e.Spec.DeletionPolicy = TerminationPolicyDelete } e.Spec.Monitor.SetDefaults() diff --git a/apis/kubedb/v1alpha2/etcd_types.go b/apis/kubedb/v1alpha2/etcd_types.go index caa57e978e..cbf151b155 100644 --- a/apis/kubedb/v1alpha2/etcd_types.go +++ b/apis/kubedb/v1alpha2/etcd_types.go @@ -90,9 +90,9 @@ type EtcdSpec struct { // +optional Halted bool `json:"halted,omitempty"` - // TerminationPolicy controls the delete operation for database + // DeletionPolicy controls the delete operation for database // +optional - TerminationPolicy TerminationPolicy `json:"terminationPolicy,omitempty"` + DeletionPolicy TerminationPolicy `json:"deletionPolicy,omitempty"` } type TLSPolicy struct { diff --git a/apis/kubedb/v1alpha2/openapi_generated.go b/apis/kubedb/v1alpha2/openapi_generated.go index f0cb1d2f0f..bb77c0167e 100644 --- a/apis/kubedb/v1alpha2/openapi_generated.go +++ b/apis/kubedb/v1alpha2/openapi_generated.go @@ -27409,9 +27409,9 @@ func schema_apimachinery_apis_kubedb_v1alpha2_EtcdSpec(ref common.ReferenceCallb Format: "", }, }, - "terminationPolicy": { + "deletionPolicy": { SchemaProps: spec.SchemaProps{ - Description: "TerminationPolicy controls the delete operation for database", + Description: "DeletionPolicy controls the delete operation for database", Type: []string{"string"}, Format: "", }, diff --git a/crds/kubedb.com_etcds.yaml b/crds/kubedb.com_etcds.yaml index 2f93dee895..55f5741d02 100644 --- a/crds/kubedb.com_etcds.yaml +++ b/crds/kubedb.com_etcds.yaml @@ -57,6 +57,13 @@ spec: type: string type: object x-kubernetes-map-type: atomic + deletionPolicy: + enum: + - Halt + - Delete + - WipeOut + - DoNotTerminate + type: string halted: type: boolean init: @@ -4064,13 +4071,6 @@ spec: - Durable - Ephemeral type: string - terminationPolicy: - enum: - - Halt - - Delete - - WipeOut - - DoNotTerminate - type: string tls: properties: member: diff --git a/openapi/swagger.json b/openapi/swagger.json index ae3495efeb..bef4e67f07 100644 --- a/openapi/swagger.json +++ b/openapi/swagger.json @@ -23640,6 +23640,10 @@ "description": "Database authentication secret", "$ref": "#/definitions/dev.kubedb.apimachinery.apis.kubedb.v1alpha2.SecretReference" }, + "deletionPolicy": { + "description": "DeletionPolicy controls the delete operation for database", + "type": "string" + }, "halted": { "description": "Indicates that the database is halted and all offshoot Kubernetes resources except PVCs are deleted.", "type": "boolean" @@ -23678,10 +23682,6 @@ "description": "StorageType can be durable (default) or ephemeral", "type": "string" }, - "terminationPolicy": { - "description": "TerminationPolicy controls the delete operation for database", - "type": "string" - }, "tls": { "description": "etcd cluster TLS configuration", "$ref": "#/definitions/dev.kubedb.apimachinery.apis.kubedb.v1alpha2.TLSPolicy"