Skip to content

fix(garm): make application removal safe during relation teardown #332

Description

@yanksyoon

Bug description

Removing the GARM application can race with Juju relation teardown. Relation-departed/broken hooks re-enter the normal reconcile path after relation data has already disappeared, causing the removal workflow to fail before or during application teardown.

Evidence from production removal test

During a targeted removal of github-runner-garm:

  • ingress-relation-departed failed with the relation snapshot warning "app" expected but not received.
  • garm-configurator-relation-broken failed repeatedly with the same snapshot warning and secret_get errors while reconstructing charm state.
  • postgresql-relation-broken and debug-ssh-relation-broken also observed missing relation snapshot data.
  • The unit remained in error/awaiting error resolution until failed hooks were marked resolved without retry.
  • A remaining cross-model debug-ssh relation had to be force-removed before the dying application disappeared.

Relevant Juju bug reference emitted by the relation libraries: https://bugs.launchpad.net/juju/+bug/1960934

Expected behavior

The remove path should not run normal relation-driven reconciliation after teardown has started. Relation-departed/broken handlers should tolerate missing snapshot data during application removal, and the dedicated on.remove cleanup should run while GARM and its database/API are still available.

Suggested direction

  • Gate or short-circuit relation handlers when the application is dying/removing.
  • Ensure cleanup ordering does not depend on relation data that Juju may remove first.
  • Add an integration test for application removal with all current relations, including cross-model relations.
  • Preserve the GARM encryption secret or otherwise define database/secret lifecycle for application recreation.

Environment

  • PS7 production Kubernetes model: k8s-pfe-ps7-prod-github-runner-prod
  • GARM revision: 104
  • Test ticket: ISD-6082

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions