Skip to content

Make crc-agent guest retries context-aware #35

Description

@caxu-rh

Problem

readGuestKubeconfig and retryRunPrivileged use local time.Now deadlines and time.Sleep calls without a context. When the VMI watch cancels the agent, SSH is closed, but these loops can continue trying until their local timeout.

References

  • cmd/crc-agent/guest.go:441-488
  • cmd/crc-agent/sshrunner.go:79-94

Suggested direction

Pass the caller context into both retry functions and use the existing wait.PollUntilContextTimeout pattern. Keep SSH closure so cancellation also interrupts blocked commands. Apply the configured SSHReadyTimeout to WaitForConnectivity and use a context-aware dial.

Tests

Add cancellation tests that verify prompt return and no further attempts, plus timeout coverage for SSH connectivity.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    kind/cleanupCategorizes issue or PR as related to cleaning up code, process, or technical debt.priority/important-longtermImportant over the long term, but may not be staffed and/or may need multiple releases to complete.

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions