Skip to content

Commit

Permalink
Merge pull request juju#16100 from SimonRichardson/inject-ctrl-config…
Browse files Browse the repository at this point in the history
…-httpserver

juju#16100

The following injects the controller config into the http server worker. This worker only uses the controller config in the manifold and any changes to this will cause the http server worker to bounce.

This makes it really easy to transfer the manifold over to the new domain package.

## Checklist

- [x] Code style: imports ordered, good names, simple structure, etc
- [x] Comments saying why design decisions were made
- [x] Go unit tests, with comments saying what you're testing

## QA steps

```sh
$ juju bootstrap lxd test --build-agent
$ juju enable-ha
$ juju add-model default
$ juju deploy ubuntu -n 3
$ juju controller-config api-port-open-delay=10s 
```

Interestingly, setting `juju controller-config api-port-open-delay=10s` doesn't cause the HTTP server to bounce, nor does it get the new value unless it bounces. Maybe we shouldn't allow you to tweak it?
  • Loading branch information
jujubot authored Aug 18, 2023
2 parents 4d7d159 + 81c3782 commit f18284a
Show file tree
Hide file tree
Showing 11 changed files with 1,067 additions and 920 deletions.
8 changes: 2 additions & 6 deletions cmd/jujud/agent/agenttest/agent.go
Original file line number Diff line number Diff line change
Expand Up @@ -123,15 +123,11 @@ type AgentSuite struct {
InitialDBOps []func(context.Context, coredatabase.TxnRunner) error
}

func (s *AgentSuite) SetUpSuite(c *gc.C) {
s.ApiServerSuite.SetUpSuite(c)

s.InitialDBOps = make([]func(context.Context, coredatabase.TxnRunner) error, 0)
}

func (s *AgentSuite) SetUpTest(c *gc.C) {
s.ApiServerSuite.SetUpTest(c)

s.InitialDBOps = make([]func(context.Context, coredatabase.TxnRunner) error, 0)

var err error
s.Environ, err = stateenvirons.GetNewEnvironFunc(environs.New)(s.ControllerModel(c))
c.Assert(err, jc.ErrorIsNil)
Expand Down
3 changes: 1 addition & 2 deletions cmd/jujud/agent/machine.go
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,6 @@ var (
// be expressed as explicit dependencies, but nobody has yet had
// the intestinal fortitude to untangle this package. Be that
// person! Juju Needs You.
useMultipleCPUs = utils.UseMultipleCPUs
reportOpenedState = func(*state.State) {}
getHostname = os.Hostname

Expand Down Expand Up @@ -485,7 +484,7 @@ func upgradeCertificateDNSNames(config agent.ConfigSetter) error {
func (a *MachineAgent) Run(ctx *cmd.Context) (err error) {
defer a.Done(err)
a.ctx = ctx
useMultipleCPUs()

if err := a.ReadConfig(a.Tag().String()); err != nil {
return errors.Errorf("cannot read agent configuration: %v", err)
}
Expand Down
1 change: 1 addition & 0 deletions cmd/jujud/agent/machine/manifolds.go
Original file line number Diff line number Diff line change
Expand Up @@ -557,6 +557,7 @@ func commonManifolds(config ManifoldsConfig) dependency.Manifolds {
AuthorityName: certificateWatcherName,
HubName: centralHubName,
StateName: stateName,
ServiceFactoryName: serviceFactoryName,
MuxName: httpServerArgsName,
APIServerName: apiServerName,
PrometheusRegisterer: config.PrometheusRegisterer,
Expand Down
Loading

0 comments on commit f18284a

Please sign in to comment.