Currently the Provisioner task calls api/provisioner/provisioner.go StateAddresses() to fill out a record of what addresses should be used if you want to talk to Mongo.
However, that ignores things like 'juju-mgmt-space', and we only really want to talk to the Controller for anything that the Provisioner starts. (you obviously need to talk to Mongo when bootstrapping, but you can use 'localhost' for the single node case, and once you get past the single node case, you should be using an authenticated connection to the existing Juju controller to get StateServingInfo).
I have a feeling we can ultimately just rip out StateAddress and not have the Provisioner know anything about MongoInfo. (we could provide it for backward compatibility, but we really shouldn't need to, as it is a controller API, not an agent API.)
This came about because of https://bugs.launchpad.net/juju/+bug/1866623 where you can't bring up an LXD model on a K8s controller, because it thinks it needs machine addresses for the controllers. It shouldn't, though. So we should just stop depending on it, rather than trying to fake it for a K8s controller.
It gets even worse. controller/ authentication/ authentication. go has ator() that fills out an AuthenticationP rovider interface, which is just a 'simpleAuth' object.
NewAPIAuthentic
simpleAuth. SetupAuthentica tion *might* return auth.stateInfo if it is provided. Which holds a pointer to a MongoInfo. SetupAuthentica tion is apiserver/ facades/ client/ client/ instanceconfig. go: SetupAuthentica tion(machine, nil, apiInfo)
But the only caller of authentication.
_, apiInfo, err = authentication.
Which throws it away immediately. ceConfig(
The only other caller is:
func (task *provisionerTask) constructInstan
which only uses it if: AnyJobNeedsStat e(instanceConfi g.Jobs. ..) { g.Controller = &instancecfg. ControllerConfi g{ igningKey: publicKey,
if multiwatcher.
...
instanceConfi
PublicImageS
MongoInfo: stateInfo,
}
So, indeed, it almost never needs it, but it always asks for it.