Evacuate via API - when is the host "really" evacuated

Hi all,

Currentlly I’m trying to figure out an automated way for maintenance tasks. I can evacuate via API. But how do I figure out that the host is completely evacuated? Currently I’m using the following code:

curl -s -u "${CATTLE_ACCESS_KEY}:${CATTLE_SECRET_KEY}" \
    -H 'Accept: application/json' \
    'https://rancher.office.sevenval.de/v2-beta/hosts/'"$host"'/instances' | \
    jq '.data[] | select(.state != "exited" and .state  != "removed") | select(.hostId | test("'"$host"'")) | select(.system | not) | { Name: .name , State: .state }'

When I evacuate a host the following happens:

  1. a lot of containers in the state removing and stopping
  2. only the agent container is shown, but in the UI I can still see some cotainers with a trash can symbol
  3. for a short time containers “reappear” with the state purging allthough the UI showed nothing

So I’m a bit puzzled as to what is the sign that an evacuation is “really” complete.

Any help would be much appreciated.

Cheers, Shorty

Any news about the topic? I’m also interested

Evacuate is async and there is no simple state to tell you it’s done.

The containers will go [stopping -> stopped ->] removing -> removed -> purging -> purged. The UI does not show removed/purging/purged resources. “exited” is not a valid state.