Skip to content

feat: create new jujud controller binary#22460

Merged
iyiguncevik merged 4 commits into
juju:feature/standalone-controllerfrom
iyiguncevik:juju-9706-step-2
May 22, 2026
Merged

feat: create new jujud controller binary#22460
iyiguncevik merged 4 commits into
juju:feature/standalone-controllerfrom
iyiguncevik:juju-9706-step-2

Conversation

@iyiguncevik
Copy link
Copy Markdown
Contributor

@iyiguncevik iyiguncevik commented May 20, 2026

Creates a separate jujud controller binary by cloning cmd/jujuagentd/ to cmd/jujud/ as an independent Go package. This binary will become the controller application, packaged as the juju-controller snap.


Changes

New package: cmd/jujud/

  • Copied from cmd/jujuagentd/ with all import paths updated to cmd/jujud
  • Binary name: jujud (via SuperCommand Name field)
  • Logger prefix: juju.cmd.jujud
  • Dispatch case uses names.JujuController
  • Tool path references use names.JujuController
  • Initially has identical manifold wiring to jujuagentd (steps 3 & 4 will diverge them)

juju/names/names.go

  • Added JujuController = "jujud" constant
  • Renamed JujudJujuAgentd and JujudVersionsJujuVersions for clarity
  • All references across the codebase updated accordingly

Makefile

  • Added jujud to BUILD_CGO_AGENT_TARGETS, INSTALL_TARGETS (linux only)
  • Added .PHONY jujud install target and ${BUILD_DIR}/%/bin/jujud build target
  • Both require CGO, dqlite, and libsqlite3 build tags
  • jujud is not added to simplestreams packaging (distributed via snap only)

External references

  • cmd/package_test.go: added jujud to ignored packages
  • scripts/engine-dag/main.go: added cmd/jujud/agent/{machine,model} imports with --agent flag
  • cmd/containeragent/unit/package_test.go: added cmd/jujud/agent/* entries

Out of scope

  • Removing machine-agent manifolds (step 3)
  • Gating out-of-scope manifolds (step 4)
  • Snap packaging / CAAS Dockerfile changes

Checklist

  • Code style: imports ordered, good names, simple structure, etc
  • Comments saying why design decisions were made
  • Go unit tests, with comments saying what you're testing
  • Integration tests, with comments saying what you're testing
  • doc.go added or updated in changed packages

QA steps

Verify bootstrap is still working fine:

❯ juju bootstrap lxd src --build-agent

❯ jst -m controller
Model       Controller  Cloud/Region  Version      Timestamp
controller  src         lxd/default   4.1-beta2.1  17:48:52+02:00

App         Version  Status  Scale  Charm            Channel     Rev  Exposed  Message
controller           active      1  juju-controller  4.1/stable  157  no

Unit           Workload  Agent  Machine  Public address  Ports            Message
controller/0*  active    idle   0        10.159.202.172  17022,17070/tcp

Machine  State    Address         Inst id        Base          AZ      Message
0        started  10.159.202.172  juju-a2b1c8-0  ubuntu@24.04  tuxedo  Running

Relation provider     Requirer              Interface  Type  Message
controller:dbcluster  controller:dbcluster  dbcluster  peer

❯ juju ssh -m controller 0 -- ps -ef | grep juju
root        5879       1  0 15:42 ?        00:00:00 bash /etc/systemd/system/jujuagentd-machine-0-exec-start.sh
root        5883    5879  0 15:42 ?        00:00:02 /var/lib/juju/tools/machine-0/jujuagentd machine --data-dir /var/lib/juju --machine-id 0 --debug

Documentation changes

Links

Jira card: JUJU-9706

Copy cmd/jujuagentd/ to cmd/jujud/ as a separate Go package (Phase 1)
and update all Go import paths from cmd/jujuagentd to cmd/jujud (Phase 2).

The cmd/jujuagentd/ package is unchanged. The new cmd/jujud/ package
has all internal import paths, mockgen directives, and generated mock
source comments updated to reference cmd/jujud.
Add names.JujuController = "jujud" constant and rename names.Jujud to
names.JujuAgentd, names.JujudVersions to names.JujuVersions for clarity.
In the new cmd/jujud/ package:
- Update SuperCommand Name from "jujuagentd" to "jujud"
- Update dispatch case from jujunames.Jujud to jujunames.JujuController
- Update tool path references from jujunames.Jujud to jujunames.JujuController
Across the codebase, update all references from names.Jujud to
names.JujuAgentd and names.JujudVersions to names.JujuVersions to
reflect the constant rename.
Add jujud controller binary as a separate Makefile build target:
- Add jujud to BUILD_CGO_AGENT_TARGETS alongside jujuagentd
- Add jujud to INSTALL_TARGETS (linux only)
- Add .PHONY jujud install target with CGO/dqlite/libsqlite3 tags
- Add platform-specific ${BUILD_DIR}/%/bin/jujud build target

The jujud target is for local builds only and is not added to
simplestreams packaging.
Add cmd/jujud package to external reference files:
- cmd/package_test.go: add jujud to ignoredPackages
- scripts/engine-dag/main.go: add cmd/jujud/agent/machine and
  cmd/jujud/agent/model imports with --agent flag selector
- cmd/containeragent/unit/package_test.go: add cmd/jujud/agent/*
  entries alongside existing cmd/jujuagentd/agent/* entries
Copy link
Copy Markdown
Member

@SimonRichardson SimonRichardson left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Follow ups:

  1. Do we want two versions for jujud and jujuagentd? I don't think we do want to do that, but we should explore this.
  2. Versions of the agent and the controller will mismatch during an upgrade or via misconfigured setups, which I know we're not trying to solve yet, but we should keep a note. We should prevent an jujuagentd being able to be to talk to jujud that is lower version than itself. That sort of misconfiguration might be dangerous.

Comment thread Makefile
@@ -316,6 +318,13 @@ jujuagentd: musl-install-if-missing dqlite-install-if-missing
## jujuagentd: Install jujuagentd without updating dependencies
${run_cgo_install}
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We'll know this works when this becomes the following:

Suggested change
${run_cgo_install}
${run_go_install}

@iyiguncevik iyiguncevik merged commit ba9271b into juju:feature/standalone-controller May 22, 2026
23 of 26 checks passed
@iyiguncevik iyiguncevik deleted the juju-9706-step-2 branch May 22, 2026 12:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants