amphitheatre icon indicating copy to clipboard operation
amphitheatre copied to clipboard

Timeout Controller

Open wangeguo opened this issue 1 year ago • 3 comments

By design, Playbook has a lifecycle, from creation, initialization, compilation build, deployment, running to destruction.

Currently, we need to implement a new controller to perform periodic resource recovery (destruction) of Playbook. The following is a technical description:

  1. The administrator can set a resource recovery duration, such as 2 weeks (default);
  2. this duration is annotated on each Playbook resource definition;
  3. Timeout Controller periodically scans for Playbooks that are about to expire and performs a series of actions, such as sending reminder emails or notifications (e.g. via Slack) 3 days or 2 days before the expiration date, and performs Playbook deletion on the same day;
  4. Additional consideration is given to support Webhook notification of events in the future;

Reference:

  1. Rust Kubernetes client and controller runtime https://github.com/kube-rs/kube
  2. Kube controller-rs example: https://github.com/kube-rs/controller-rs
  3. Amphitheatre Controllers: https://github.com/amphitheatre-app/amphitheatre/tree/master/controllers
  4. k8s-ttl-controller https://github.com/fpetkovski/k8s-ttl-controller

Note: Contributors are requested to provide technical design solutions and implementation plans in the comments, as we need to communicate more fully.

wangeguo avatar Jun 16 '23 14:06 wangeguo

Additional information: The Kubernetes platform itself has a ttl-controller that is only used for Job resource recovery, the code should be in the K8s repository and can also be viewed as a reference

wangeguo avatar Feb 02 '24 07:02 wangeguo

#235 This issue has been done.

Guocork avatar Sep 06 '24 07:09 Guocork

#235 This issue has been done.

Cool,thanks very much!

wangeguo avatar Sep 06 '24 07:09 wangeguo