Skip to content

feat: edge agent should restart cleanly after join token is cleared #130

@mjudeikis-bot

Description

@mjudeikis-bot

Problem

The current join token flow tests that:

  1. Agent registers using join token
  2. Join token is cleared after registration
  3. Agent reconnects using saved kubeconfig

But we don't test (or guarantee) that after the join token is cleared, the edge agent can be restarted (e.g. systemd restart, pod restart) and still reconnect successfully using the saved kubeconfig — without needing a new join token.

Expected Behavior

After an agent successfully registers (join token consumed, kubeconfig saved):

  1. Agent process stops (crash, restart, upgrade, etc.)
  2. Agent restarts
  3. Agent detects saved kubeconfig (e.g. from Secret in-cluster or file on disk)
  4. Agent reconnects to hub using saved kubeconfig — no join token required
  5. Edge transitions to connected state normally

What to implement

  • E2e test: JoinTokenEdgeRestartAfterRegistration

    • Register edge via join token
    • Wait for token to be cleared
    • Stop the agent
    • Restart agent without --token flag
    • Assert edge reconnects and becomes connected
  • Verify agent code path: when no join token is provided and a saved kubeconfig exists, agent uses the saved kubeconfig directly (not the join flow)

Related

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