Skip to content

managed application shows outofsync / missing health after re-create from unauthorized delete  #742

@drewbailey

Description

@drewbailey

Describe the bug

If an application is deleted from a managed agent, it gets re-created, then wedged and never receives any more updates

Steps to reproduce the behaviour

  1. Delete app on agent manually
  2. Agent detects "unauthorized deletion" → recreates app
  3. App was never unmanaged (since it was unauthorized deletion)
  4. Recreate tries Manage() → fails "already managed"
  5. Informer fires NewApp event for the recreated app
  6. NewApp handler also tries Manage() → fails "already managed"

Expected behavior

I think unmanaging before re-creating might make sense? Or Manage() becomes idempotent

Additional context

llm summarized logs for clarify / remove environment info

20:43:23  DEBUG  cluster1 found in agent cache
20:43:23  DEBUG  Status update queued
20:43:23  DEBUG  Status update processed

20:43:23  INFO   Updating application (rv=777063671)
20:43:23  INFO   Application updated

20:44:01  INFO   Updating application (rv=777064217)
20:44:01  INFO   Application updated
20:44:01  DEBUG  Ignored stale resource version

20:44:41–20:44:42
           DEBUG  cluster1 repeatedly reconciled
           DEBUG  Status updates queued and processed

20:44:43  WARN   Delete event detected
20:44:43  WARN   Unauthorized deletion — recreating application
20:44:43  INFO   Application successfully recreated

20:44:43  WARN   App already managed (duplicate manage attempt)
20:44:43  ERROR  Cannot manage app that is already managed

20:44:43  DEBUG  Final status event processed

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions