amphitheatre
amphitheatre copied to clipboard
Timeout Controller
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:
- The administrator can set a resource recovery duration, such as 2 weeks (default);
- this duration is annotated on each Playbook resource definition;
- 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;
- Additional consideration is given to support Webhook notification of events in the future;
Reference:
- Rust Kubernetes client and controller runtime https://github.com/kube-rs/kube
- Kube controller-rs example: https://github.com/kube-rs/controller-rs
- Amphitheatre Controllers: https://github.com/amphitheatre-app/amphitheatre/tree/master/controllers
- 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.
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
#235 This issue has been done.
#235 This issue has been done.
Cool,thanks very much!