Skip to content

Commit

Permalink
initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
joshuajerin committed Nov 25, 2024
1 parent 5b154ff commit b1e6d5a
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 1 deletion.
17 changes: 17 additions & 0 deletions tembo-operator/src/cloudnativepg/hibernate.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ use crate::cloudnativepg::clusters::{ClusterStatusConditions, ClusterStatusCondi
use crate::cloudnativepg::cnpg::{get_cluster, get_pooler, get_scheduled_backups};
use crate::cloudnativepg::poolers::Pooler;
use crate::cloudnativepg::scheduledbackups::ScheduledBackup;
use crate::ingress::delete_ingress_route_tcp;
use crate::Error;

use crate::{patch_cdb_status_merge, requeue_normal_with_jitter, Context};
Expand Down Expand Up @@ -145,6 +146,22 @@ pub async fn reconcile_cluster_hibernation(cdb: &CoreDB, ctx: &Arc<Context>) ->
}
}

// Delete the IngressRouteTCP route for hibernated instances
if let Err(err) = delete_ingress_route_tcp(
Api::namespaced(client, &namespace),
&namespace,
&format!("{}-ro-0", cdb.name_any().as_str()),
)
.await
{
warn!(
"Error deleting ingress route for {}: {}",
cdb.name_any(),
err
);
return Err(Action::requeue(Duration::from_secs(300)));
}

// Stop CNPG reconciliation for hibernated instances.
// We should not stop CNPG reconciliation until hibernation is fully completed,
// as the instance may not finish hibernating otherwise.
Expand Down
2 changes: 1 addition & 1 deletion tembo-operator/src/ingress.rs
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,7 @@ async fn apply_ingress_route_tcp(
Ok(())
}

async fn delete_ingress_route_tcp(
pub async fn delete_ingress_route_tcp(
ingress_route_tcp_api: Api<IngressRouteTCP>,
namespace: &str,
ingress_route_tcp_name: &String,
Expand Down

0 comments on commit b1e6d5a

Please sign in to comment.