Skip to content

Commit

Permalink
Update DB api type to DeletionPolicy and SQL Server APIs (#1343)
Browse files Browse the repository at this point in the history
Signed-off-by: Neaj Morshad <[email protected]>
  • Loading branch information
Neaj-Morshad-101 authored Nov 11, 2024
1 parent 5fc3a8d commit a8c8c1e
Show file tree
Hide file tree
Showing 65 changed files with 176 additions and 499 deletions.
18 changes: 9 additions & 9 deletions apis/kubedb/v1alpha1/conversion.go
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ func Convert_v1alpha1_ElasticsearchSpec_To_v1alpha2_ElasticsearchSpec(in *Elasti
}
out.MaxUnavailable = (*intstr.IntOrString)(unsafe.Pointer(in.MaxUnavailable))
// WARNING: in.UpdateStrategy requires manual conversion: does not exist in peer-type
out.TerminationPolicy = v1alpha2.TerminationPolicy(in.TerminationPolicy)
out.TerminationPolicy = v1alpha2.DeletionPolicy(in.TerminationPolicy)
return nil
}

Expand Down Expand Up @@ -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.DeletionPolicy = v1alpha2.TerminationPolicy(in.TerminationPolicy)
out.DeletionPolicy = v1alpha2.DeletionPolicy(in.TerminationPolicy)
return nil
}

Expand Down Expand Up @@ -365,7 +365,7 @@ func Convert_v1alpha1_MariaDBSpec_To_v1alpha2_MariaDBSpec(in *MariaDBSpec, out *
})
}
// WARNING: in.UpdateStrategy requires manual conversion: does not exist in peer-type
out.TerminationPolicy = v1alpha2.TerminationPolicy(in.TerminationPolicy)
out.TerminationPolicy = v1alpha2.DeletionPolicy(in.TerminationPolicy)
return nil
}

Expand Down Expand Up @@ -434,7 +434,7 @@ func Convert_v1alpha1_MemcachedSpec_To_v1alpha2_MemcachedSpec(in *MemcachedSpec,
})
}
// WARNING: in.UpdateStrategy requires manual conversion: does not exist in peer-type
out.TerminationPolicy = v1alpha2.TerminationPolicy(in.TerminationPolicy)
out.TerminationPolicy = v1alpha2.DeletionPolicy(in.TerminationPolicy)
return nil
}

Expand Down Expand Up @@ -537,7 +537,7 @@ func Convert_v1alpha1_MongoDBSpec_To_v1alpha2_MongoDBSpec(in *MongoDBSpec, out *
})
}
// WARNING: in.UpdateStrategy requires manual conversion: does not exist in peer-type
out.TerminationPolicy = v1alpha2.TerminationPolicy(in.TerminationPolicy)
out.TerminationPolicy = v1alpha2.DeletionPolicy(in.TerminationPolicy)
return nil
}

Expand Down Expand Up @@ -722,7 +722,7 @@ func Convert_v1alpha1_MySQLSpec_To_v1alpha2_MySQLSpec(in *MySQLSpec, out *v1alph
})
}
// WARNING: in.UpdateStrategy requires manual conversion: does not exist in peer-type
out.TerminationPolicy = v1alpha2.TerminationPolicy(in.TerminationPolicy)
out.TerminationPolicy = v1alpha2.DeletionPolicy(in.TerminationPolicy)
return nil
}

Expand Down Expand Up @@ -834,7 +834,7 @@ func Convert_v1alpha1_PerconaXtraDBSpec_To_v1alpha2_PerconaXtraDBSpec(in *Percon
})
}
// WARNING: in.UpdateStrategy requires manual conversion: does not exist in peer-type
out.TerminationPolicy = v1alpha2.TerminationPolicy(in.TerminationPolicy)
out.TerminationPolicy = v1alpha2.DeletionPolicy(in.TerminationPolicy)
return nil
}

Expand Down Expand Up @@ -932,7 +932,7 @@ func Convert_v1alpha1_PostgresSpec_To_v1alpha2_PostgresSpec(in *PostgresSpec, ou
})
}
// WARNING: in.UpdateStrategy requires manual conversion: does not exist in peer-type
out.TerminationPolicy = v1alpha2.TerminationPolicy(in.TerminationPolicy)
out.TerminationPolicy = v1alpha2.DeletionPolicy(in.TerminationPolicy)
return nil
}

Expand Down Expand Up @@ -1005,7 +1005,7 @@ func Convert_v1alpha1_RedisSpec_To_v1alpha2_RedisSpec(in *RedisSpec, out *v1alph
})
}
// WARNING: in.UpdateStrategy requires manual conversion: does not exist in peer-type
out.TerminationPolicy = v1alpha2.TerminationPolicy(in.TerminationPolicy)
out.TerminationPolicy = v1alpha2.DeletionPolicy(in.TerminationPolicy)
return nil
}

Expand Down
18 changes: 9 additions & 9 deletions apis/kubedb/v1alpha1/zz_generated.conversion.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion apis/kubedb/v1alpha2/cassandra_helpers.go
Original file line number Diff line number Diff line change
Expand Up @@ -269,7 +269,7 @@ func (r *Cassandra) ResourceSingular() string {

func (r *Cassandra) SetDefaults() {
if r.Spec.DeletionPolicy == "" {
r.Spec.DeletionPolicy = TerminationPolicyDelete
r.Spec.DeletionPolicy = DeletionPolicyDelete
}

var casVersion catalog.CassandraVersion
Expand Down
2 changes: 1 addition & 1 deletion apis/kubedb/v1alpha2/cassandra_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ type CassandraSpec struct {

// DeletionPolicy controls the delete operation for database
// +optional
DeletionPolicy TerminationPolicy `json:"deletionPolicy,omitempty"`
DeletionPolicy DeletionPolicy `json:"deletionPolicy,omitempty"`

// HealthChecker defines attributes of the health checker
// +optional
Expand Down
2 changes: 1 addition & 1 deletion apis/kubedb/v1alpha2/cassandra_webhook.go
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ func (r *Cassandra) ValidateDelete() (admission.Warnings, error) {
cassandralog.Info("validate delete", "name", r.Name)

var allErr field.ErrorList
if r.Spec.DeletionPolicy == TerminationPolicyDoNotTerminate {
if r.Spec.DeletionPolicy == DeletionPolicyDoNotTerminate {
allErr = append(allErr, field.Invalid(field.NewPath("spec").Child("deletionPolicy"),
r.Name,
"Can not delete as terminationPolicy is set to \"DoNotTerminate\""))
Expand Down
2 changes: 1 addition & 1 deletion apis/kubedb/v1alpha2/clickhouse_helpers.go
Original file line number Diff line number Diff line change
Expand Up @@ -370,7 +370,7 @@ func (c *ClickHouse) SetDefaults() {
c.Spec.Replicas = pointer.Int32P(1)
}
if c.Spec.DeletionPolicy == "" {
c.Spec.DeletionPolicy = TerminationPolicyDelete
c.Spec.DeletionPolicy = DeletionPolicyDelete
}
if c.Spec.StorageType == "" {
c.Spec.StorageType = StorageTypeDurable
Expand Down
2 changes: 1 addition & 1 deletion apis/kubedb/v1alpha2/clickhouse_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ type ClickHouseSpec struct {

// DeletionPolicy controls the delete operation for database
// +optional
DeletionPolicy TerminationPolicy `json:"deletionPolicy,omitempty"`
DeletionPolicy DeletionPolicy `json:"deletionPolicy,omitempty"`

// HealthChecker defines attributes of the health checker
// +optional
Expand Down
2 changes: 1 addition & 1 deletion apis/kubedb/v1alpha2/clickhouse_webhook.go
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ func (c *ClickHouse) ValidateDelete() (admission.Warnings, error) {
clickhouselog.Info("validate delete", "name", c.Name)

var allErr field.ErrorList
if c.Spec.DeletionPolicy == TerminationPolicyDoNotTerminate {
if c.Spec.DeletionPolicy == DeletionPolicyDoNotTerminate {
allErr = append(allErr, field.Invalid(field.NewPath("spec").Child("teminationPolicy"),
c.Name,
"Can not delete as terminationPolicy is set to \"DoNotTerminate\""))
Expand Down
22 changes: 11 additions & 11 deletions apis/kubedb/v1alpha2/conversion.go
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,7 @@ func Convert_v1_MariaDBSpec_To_v1alpha2_MariaDBSpec(in *v1.MariaDBSpec, out *Mar
out.RequireSSL = in.RequireSSL
out.TLS = (*clientgoapiv1.TLSConfig)(unsafe.Pointer(in.TLS))
out.Halted = in.Halted
out.TerminationPolicy = TerminationPolicy(in.DeletionPolicy)
out.TerminationPolicy = DeletionPolicy(in.DeletionPolicy)
out.AllowedSchemas = (*AllowedConsumers)(unsafe.Pointer(in.AllowedSchemas))
out.HealthChecker = in.HealthChecker
out.Archiver = (*Archiver)(unsafe.Pointer(in.Archiver))
Expand Down Expand Up @@ -264,7 +264,7 @@ func Convert_v1_PostgresSpec_To_v1alpha2_PostgresSpec(in *v1.PostgresSpec, out *
out.ServiceTemplates = *(*[]NamedServiceTemplateSpec)(unsafe.Pointer(&in.ServiceTemplates))
out.TLS = (*clientgoapiv1.TLSConfig)(unsafe.Pointer(in.TLS))
out.Halted = in.Halted
out.TerminationPolicy = TerminationPolicy(in.DeletionPolicy)
out.TerminationPolicy = DeletionPolicy(in.DeletionPolicy)
out.EnforceFsGroup = in.EnforceFsGroup
out.AllowedSchemas = (*AllowedConsumers)(unsafe.Pointer(in.AllowedSchemas))
out.HealthChecker = in.HealthChecker
Expand Down Expand Up @@ -369,7 +369,7 @@ func Convert_v1_MySQLSpec_To_v1alpha2_MySQLSpec(in *v1.MySQLSpec, out *MySQLSpec
out.RequireSSL = in.RequireSSL
out.TLS = (*clientgoapiv1.TLSConfig)(unsafe.Pointer(in.TLS))
out.Halted = in.Halted
out.TerminationPolicy = TerminationPolicy(in.DeletionPolicy)
out.TerminationPolicy = DeletionPolicy(in.DeletionPolicy)
out.UseAddressType = AddressType(in.UseAddressType)
out.AllowedSchemas = (*AllowedConsumers)(unsafe.Pointer(in.AllowedSchemas))
out.AllowedReadReplicas = (*AllowedConsumers)(unsafe.Pointer(in.AllowedReadReplicas))
Expand Down Expand Up @@ -611,7 +611,7 @@ func Convert_v1_MongoDBSpec_To_v1alpha2_MongoDBSpec(in *v1.MongoDBSpec, out *Mon
out.TLS = (*clientgoapiv1.TLSConfig)(unsafe.Pointer(in.TLS))
out.KeyFileSecret = (*corev1.LocalObjectReference)(unsafe.Pointer(in.KeyFileSecret))
out.Halted = in.Halted
out.TerminationPolicy = TerminationPolicy(in.DeletionPolicy)
out.TerminationPolicy = DeletionPolicy(in.DeletionPolicy)
out.StorageEngine = StorageEngine(in.StorageEngine)
out.AllowedSchemas = (*AllowedConsumers)(unsafe.Pointer(in.AllowedSchemas))
if in.Arbiter != nil {
Expand Down Expand Up @@ -761,7 +761,7 @@ func Convert_v1_RedisSpec_To_v1alpha2_RedisSpec(in *v1.RedisSpec, out *RedisSpec
out.ServiceTemplates = *(*[]NamedServiceTemplateSpec)(unsafe.Pointer(&in.ServiceTemplates))
out.TLS = (*clientgoapiv1.TLSConfig)(unsafe.Pointer(in.TLS))
out.Halted = in.Halted
out.TerminationPolicy = TerminationPolicy(in.DeletionPolicy)
out.TerminationPolicy = DeletionPolicy(in.DeletionPolicy)
out.AllowedSchemas = (*AllowedConsumers)(unsafe.Pointer(in.AllowedSchemas))
out.HealthChecker = in.HealthChecker
return nil
Expand Down Expand Up @@ -829,7 +829,7 @@ func Convert_v1_PerconaXtraDBSpec_To_v1alpha2_PerconaXtraDBSpec(in *v1.PerconaXt
out.RequireSSL = in.RequireSSL
out.TLS = (*clientgoapiv1.TLSConfig)(unsafe.Pointer(in.TLS))
out.Halted = in.Halted
out.TerminationPolicy = TerminationPolicy(in.DeletionPolicy)
out.TerminationPolicy = DeletionPolicy(in.DeletionPolicy)
out.AllowedSchemas = (*AllowedConsumers)(unsafe.Pointer(in.AllowedSchemas))
out.HealthChecker = in.HealthChecker
out.SystemUserSecrets = (*SystemUserSecretsSpec)(unsafe.Pointer(in.SystemUserSecrets))
Expand Down Expand Up @@ -958,7 +958,7 @@ func Convert_v1_ElasticsearchSpec_To_v1alpha2_ElasticsearchSpec(in *v1.Elasticse
out.InternalUsers = *(*map[string]ElasticsearchUserSpec)(unsafe.Pointer(&in.InternalUsers))
out.RolesMapping = *(*map[string]ElasticsearchRoleMapSpec)(unsafe.Pointer(&in.RolesMapping))
out.Halted = in.Halted
out.TerminationPolicy = TerminationPolicy(in.DeletionPolicy)
out.TerminationPolicy = DeletionPolicy(in.DeletionPolicy)
out.KernelSettings = (*KernelSettings)(unsafe.Pointer(in.KernelSettings))
out.HeapSizePercentage = (*int32)(unsafe.Pointer(in.HeapSizePercentage))
out.HealthChecker = in.HealthChecker
Expand All @@ -977,7 +977,7 @@ func Convert_v1_MemcachedSpec_To_v1alpha2_MemcachedSpec(in *v1.MemcachedSpec, ou
out.ServiceTemplates = *(*[]NamedServiceTemplateSpec)(unsafe.Pointer(&in.ServiceTemplates))
out.TLS = (*clientgoapiv1.TLSConfig)(unsafe.Pointer(in.TLS))
out.Halted = in.Halted
out.TerminationPolicy = TerminationPolicy(in.DeletionPolicy)
out.TerminationPolicy = DeletionPolicy(in.DeletionPolicy)
out.HealthChecker = in.HealthChecker
return nil
}
Expand Down Expand Up @@ -1025,7 +1025,7 @@ func Convert_v1_PgBouncerSpec_To_v1alpha2_PgBouncerSpec(in *v1.PgBouncerSpec, ou
out.Monitor = (*monitoringagentapiapiv1.AgentSpec)(unsafe.Pointer(in.Monitor))
out.SSLMode = PgBouncerSSLMode(in.SSLMode)
out.TLS = (*clientgoapiv1.TLSConfig)(unsafe.Pointer(in.TLS))
out.TerminationPolicy = PgBouncerTerminationPolicy(in.DeletionPolicy)
out.TerminationPolicy = DeletionPolicy(in.DeletionPolicy)
out.HealthChecker = in.HealthChecker
return nil
}
Expand Down Expand Up @@ -1069,7 +1069,7 @@ func Convert_v1_ProxySQLSpec_To_v1alpha2_ProxySQLSpec(in *v1.ProxySQLSpec, out *
}
out.ServiceTemplates = *(*[]NamedServiceTemplateSpec)(unsafe.Pointer(&in.ServiceTemplates))
out.TLS = (*clientgoapiv1.TLSConfig)(unsafe.Pointer(in.TLS))
out.TerminationPolicy = TerminationPolicy(in.DeletionPolicy)
out.TerminationPolicy = DeletionPolicy(in.DeletionPolicy)
out.HealthChecker = in.HealthChecker
return nil
}
Expand Down Expand Up @@ -1113,7 +1113,7 @@ func Convert_v1_RedisSentinelSpec_To_v1alpha2_RedisSentinelSpec(in *v1.RedisSent
out.DisableAuth = in.DisableAuth
out.Halted = in.Halted
out.Monitor = (*monitoringagentapiapiv1.AgentSpec)(unsafe.Pointer(in.Monitor))
out.TerminationPolicy = TerminationPolicy(in.DeletionPolicy)
out.TerminationPolicy = DeletionPolicy(in.DeletionPolicy)
out.HealthChecker = in.HealthChecker
return nil
}
Expand Down
2 changes: 1 addition & 1 deletion apis/kubedb/v1alpha2/druid_helpers.go
Original file line number Diff line number Diff line change
Expand Up @@ -431,7 +431,7 @@ func (d *Druid) GetCertSecretName(alias DruidCertificateAlias) string {

func (d *Druid) SetDefaults() {
if d.Spec.DeletionPolicy == "" {
d.Spec.DeletionPolicy = TerminationPolicyDelete
d.Spec.DeletionPolicy = DeletionPolicyDelete
}

if d.Spec.EnableSSL {
Expand Down
2 changes: 1 addition & 1 deletion apis/kubedb/v1alpha2/druid_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ type DruidSpec struct {

// DeletionPolicy controls the delete operation for database
// +optional
DeletionPolicy TerminationPolicy `json:"deletionPolicy,omitempty"`
DeletionPolicy DeletionPolicy `json:"deletionPolicy,omitempty"`

// HealthChecker defines attributes of the health checker
// +optional
Expand Down
2 changes: 1 addition & 1 deletion apis/kubedb/v1alpha2/elasticsearch_helpers.go
Original file line number Diff line number Diff line change
Expand Up @@ -436,7 +436,7 @@ func (e *Elasticsearch) SetDefaults(esVersion *catalog.ElasticsearchVersion, top
}

if e.Spec.TerminationPolicy == "" {
e.Spec.TerminationPolicy = TerminationPolicyDelete
e.Spec.TerminationPolicy = DeletionPolicyDelete
}

if e.Spec.PodTemplate.Spec.ServiceAccountName == "" {
Expand Down
2 changes: 1 addition & 1 deletion apis/kubedb/v1alpha2/elasticsearch_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@ type ElasticsearchSpec struct {

// TerminationPolicy controls the delete operation for database
// +optional
TerminationPolicy TerminationPolicy `json:"terminationPolicy,omitempty"`
TerminationPolicy DeletionPolicy `json:"terminationPolicy,omitempty"`

// KernelSettings contains the additional kernel settings.
// +optional
Expand Down
2 changes: 1 addition & 1 deletion apis/kubedb/v1alpha2/etcd_helpers.go
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,7 @@ func (e *Etcd) SetDefaults() {
e.Spec.StorageType = StorageTypeDurable
}
if e.Spec.DeletionPolicy == "" {
e.Spec.DeletionPolicy = TerminationPolicyDelete
e.Spec.DeletionPolicy = DeletionPolicyDelete
}

e.Spec.Monitor.SetDefaults()
Expand Down
2 changes: 1 addition & 1 deletion apis/kubedb/v1alpha2/etcd_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ type EtcdSpec struct {

// DeletionPolicy controls the delete operation for database
// +optional
DeletionPolicy TerminationPolicy `json:"deletionPolicy,omitempty"`
DeletionPolicy DeletionPolicy `json:"deletionPolicy,omitempty"`
}

type TLSPolicy struct {
Expand Down
2 changes: 1 addition & 1 deletion apis/kubedb/v1alpha2/ferretdb_helpers.go
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,7 @@ func (f *FerretDB) SetDefaults() {
}

if f.Spec.DeletionPolicy == "" {
f.Spec.DeletionPolicy = TerminationPolicyWipeOut
f.Spec.DeletionPolicy = DeletionPolicyWipeOut
}

if f.Spec.SSLMode == "" {
Expand Down
2 changes: 1 addition & 1 deletion apis/kubedb/v1alpha2/ferretdb_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ type FerretDBSpec struct {

// DeletionPolicy controls the delete operation for database
// +optional
DeletionPolicy TerminationPolicy `json:"deletionPolicy,omitempty"`
DeletionPolicy DeletionPolicy `json:"deletionPolicy,omitempty"`

// HealthChecker defines attributes of the health checker
// +optional
Expand Down
Loading

0 comments on commit a8c8c1e

Please sign in to comment.