8000 agent: give the shared jiji-proxy a single owner per host · Issue #146 · acidtib/jiji · GitHub
[go: up one dir, main page]

Skip to content

agent: give the shared jiji-proxy a single owner per host #146

Open

Description

@acidtib

Problem

One jiji-proxy container per host serves every project on it, and every project's jiji-agent reconciles that container. Today any agent may recreate it: the host lease (host_lease::try_acquire in crates/jiji-agent/src/proxy_bringup.rs) only stops two agents from recreating it at the same moment, and it is released at the end of each tick. There is no lasting owner.

#142 (for #140) handles the fights we know about without an owner:

  • From jiji-agent v0.7.4, an agent never replaces a newer proxy, so among current agents the newest image wins and stays.
  • A newer agent that has replaced a running proxy 3 times within 10 minutes stops replacing a running proxy until it restarts, and reports the conflict in jiji network diagnostics.
  • jiji server upgrade and jiji network diagnostics list other projects' agents on the host and warn about ones older than v0.7.4 or not running.

A sticky owner was left out because it doesn't help with the case that caused #140: agents older than v0.7.4 would ignore any new lease. It may still be worth doing for future agents, so the proxy's lifecycle has exactly one decision-maker.

What a sticky owner would look like

  • One agent per host holds a lease, for example a file under /etc/jiji/proxy naming the owning project and its agent version, refreshed on every tick and expiring after N missed ticks.
  • Only the owner creates, recreates, or upgrades the container. The other agents only attach their own bridge and apply their own routes, as they already do every tick.
  • Ownership moves to the agent with the newest paired proxy version, so upgrading any project still upgrades the shared proxy.
  • An owner whose project is torn down or whose agent stops releases the lease, or lets it expire, so another agent takes over.

Open questions

  • Does this fix a real failure mode that the "never downgrade" rule and the recreate guard leave open? If not, close this as not needed.
  • How should an owner handle a co-resident agent that requires a newer proxy than the owner pairs with: hand over ownership, or upgrade on its behalf?
  • What happens to the lease file across jiji server teardown and host reboots?

Related surfaces to keep stable either way

Needs real-host validation (Docker and Podman, two projects on different agent versions) before it ships, like #142.

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

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions

      0