Skip to content

CI-1: Add --cleanup / --teardown / --redeploy CLI flags #49

Description

@szachovy

Problem

There is no automated cleanup mechanism. The start_cluster() finally block only closes SSH/SFTP connections — it does not remove containers, volumes, networks, routes, or deployed files. After a failed run, manual cleanup on every node is required.

File: src/initialize.py

Fix

Add a teardown_cluster() method and expose it via CLI flags with the following behavior:

Existing deployment? --redeploy? Behavior
No N/A Fresh deploy (current)
Yes No Abort with clear message
Yes Yes Teardown → fresh deploy

Teardown per node:

  1. docker swarm leave --force
  2. docker rm -f $(docker ps -aq)
  3. docker volume rm $(docker volume ls -q)
  4. docker network rm superset-network docker_gwbridge
  5. rm -rf /opt/superset-cluster /opt/*.pyc
  6. For mgmt nodes: remove keepalived routes and VIP address

Acceptance Criteria

  • teardown_cluster() method implemented that removes containers, volumes, networks, routes, and deployed files on all nodes
  • Teardown exposed as ./superset-cluster --cleanup --mgmt-nodes ... --mysql-nodes ...
  • --redeploy flag triggers teardown then fresh deploy
  • Mgmt node teardown removes keepalived routes and VIP address
  • Teardown is idempotent (safe to run multiple times)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions