chapi icon indicating copy to clipboard operation
chapi copied to clipboard

Marathon: Provide command to clean empty groups

Open andygrunwald opened this issue 7 years ago • 1 comments

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

screen shot 2017-11-22 at 09 37 24

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)

  1. Deploy a service on Marathon with ID /foo/my-service
  2. Delete the service from marathon
  3. The empty group /foo will 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: -

andygrunwald avatar Nov 22 '17 08:11 andygrunwald

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.

ppar avatar Nov 22 '17 10:11 ppar