chapi
chapi copied to clipboard
Marathon: Provide command to clean empty groups
When you deploy services on Marathon and kill them later, the namespace / group will stay. If no app will be deployed in this group later on, this group will stay empty forever.
See

Current Behavior
After time your Marathon instance will have several empty groups in the UI / API.
Possible Solution
Provide Framework (Marathon / Chronos) specific commands.
For this request it would be the /v2/groups/{group_id}/ DELETE command descibed in https://mesosphere.github.io/marathon/api-console/index.html
So the descriptive workflow would be
- Get all groups from the server
- Check if they are empty
- When they are empty, delete the group
Steps to Reproduce (for bugs)
- Deploy a service on Marathon with ID
/foo/my-service - Delete the service from marathon
- The empty group
/foowill stay
Your Environment
- Chapi version: master (Rev: c683314)
- PHP version: v7.1.11
- Operating System and version: Mac OSx
- Mesos version: v1.1.0
- Marathon version: v 1.4.1
- Chronos version: -
This sounds like a result of how chapi creates the apps. In my experience with deploying directly against the Marathon API, when you use the POST /v2/apps endpoint, Marathon creates the necessary group(s) implicitly and automatically removes them when the job(s) are destroyed; I've never had to deal with the groups directly using this approach.
WIthout looking at the code, I'd guess chapi creates groups explicitly using /v2/groups so Marathon won't delete them automatically.