Skip to content

Commit

Permalink
two-factor delete handling of deletion rejection was implemented
Browse files Browse the repository at this point in the history
  • Loading branch information
Bohdan Siryk authored and Bohdan Siryk committed Oct 30, 2023
1 parent efeef06 commit 9653da5
Show file tree
Hide file tree
Showing 8 changed files with 40 additions and 0 deletions.
5 changes: 5 additions & 0 deletions controllers/clusters/cadence_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -794,6 +794,11 @@ func (r *CadenceReconciler) newWatchStatusJob(cadence *v1beta1.Cadence) schedule
iData, err := r.API.GetCadence(cadence.Status.ID)
if err != nil {
if errors.Is(err, instaclustr.NotFound) {
if cadence.DeletionTimestamp != nil {
_, err = r.HandleDeleteCluster(context.Background(), cadence, l)
return err
}

return r.handleExternalDelete(context.Background(), cadence)
}

Expand Down
5 changes: 5 additions & 0 deletions controllers/clusters/cassandra_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -880,6 +880,11 @@ func (r *CassandraReconciler) newWatchStatusJob(cassandra *v1beta1.Cassandra) sc
iData, err := r.API.GetCassandra(cassandra.Status.ID)
if err != nil {
if errors.Is(err, instaclustr.NotFound) {
if cassandra.DeletionTimestamp != nil {
_, err = r.handleDeleteCluster(context.Background(), l, cassandra)
return err
}

return r.handleExternalDelete(context.Background(), cassandra)
}

Expand Down
5 changes: 5 additions & 0 deletions controllers/clusters/kafka_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -711,6 +711,11 @@ func (r *KafkaReconciler) newWatchStatusJob(kafka *v1beta1.Kafka) scheduler.Job
iData, err := r.API.GetKafka(kafka.Status.ID)
if err != nil {
if errors.Is(err, instaclustr.NotFound) {
if kafka.DeletionTimestamp != nil {
_, err = r.handleDeleteCluster(context.Background(), kafka, l)
return err
}

return r.handleExternalDelete(context.Background(), kafka)
}

Expand Down
5 changes: 5 additions & 0 deletions controllers/clusters/kafkaconnect_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -503,6 +503,11 @@ func (r *KafkaConnectReconciler) newWatchStatusJob(kc *v1beta1.KafkaConnect) sch
iData, err := r.API.GetKafkaConnect(kc.Status.ID)
if err != nil {
if errors.Is(err, instaclustr.NotFound) {
if kc.DeletionTimestamp != nil {
_, err = r.handleDeleteCluster(context.Background(), kc, l)
return err
}

return r.handleExternalDelete(context.Background(), kc)
}

Expand Down
5 changes: 5 additions & 0 deletions controllers/clusters/opensearch_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -618,6 +618,11 @@ func (r *OpenSearchReconciler) newWatchStatusJob(o *v1beta1.OpenSearch) schedule
iData, err := r.API.GetOpenSearch(o.Status.ID)
if err != nil {
if errors.Is(err, instaclustr.NotFound) {
if o.DeletionTimestamp != nil {
_, err = r.HandleDeleteCluster(context.Background(), o, l)
return err
}

return r.handleExternalDelete(context.Background(), o)
}

Expand Down
5 changes: 5 additions & 0 deletions controllers/clusters/postgresql_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -1106,6 +1106,11 @@ func (r *PostgreSQLReconciler) newWatchStatusJob(pg *v1beta1.PostgreSQL) schedul
instPGData, err := r.API.GetPostgreSQL(pg.Status.ID)
if err != nil {
if errors.Is(err, instaclustr.NotFound) {
if pg.DeletionTimestamp != nil {
_, err = r.handleDeleteCluster(context.Background(), pg, l)
return err
}

return r.handleExternalDelete(context.Background(), pg)
}

Expand Down
5 changes: 5 additions & 0 deletions controllers/clusters/redis_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -916,6 +916,11 @@ func (r *RedisReconciler) newWatchStatusJob(redis *v1beta1.Redis) scheduler.Job
iData, err := r.API.GetRedis(redis.Status.ID)
if err != nil {
if errors.Is(err, instaclustr.NotFound) {
if redis.DeletionTimestamp != nil {
_, err = r.handleDeleteCluster(context.Background(), redis, l)
return err
}

return r.handleExternalDelete(context.Background(), redis)
}

Expand Down
5 changes: 5 additions & 0 deletions controllers/clusters/zookeeper_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -461,6 +461,11 @@ func (r *ZookeeperReconciler) newWatchStatusJob(zook *v1beta1.Zookeeper) schedul
iData, err := r.API.GetZookeeper(zook.Status.ID)
if err != nil {
if errors.Is(err, instaclustr.NotFound) {
if zook.DeletionTimestamp != nil {
_, err = r.handleDeleteCluster(context.Background(), zook, l)
return err
}

return r.handleExternalDelete(context.Background(), zook)
}

Expand Down

0 comments on commit 9653da5

Please sign in to comment.