← Back to team overview

maas-devel team mailing list archive

Re: juju's private-address, DNS, MAAS and postgresql

 

On 8 November 2013 13:32, Andreas Hasenack <andreas@xxxxxxxxxxxxx> wrote:
>
> On Fri, Nov 8, 2013 at 11:15 AM, Gavin Panella <gavin.panella@xxxxxxxxxxxxx>
> wrote:
>>
>> Some solutions I can think of:
>>
>> 1. MAAS could arrange that reverse look-ups return the configured
>>    hostname of nodes instead of the generated one (using
>>    generated_hostname).
>
>
> Would work.
>
>>
>>
>> 2. Whatever writes pg_hba.conf could use the name from a reverse look-up
>>    instead of the hostname directly.
>
> Sounds cumbersome. The charm just gets private-address, and that is
> returning a name that it has to convert to an IP via a dns lookup?

Yeah, it is a bit, for no clear benefit over #2.

>
>>
>> 3. Whatever writes pg_hba.conf could use the IP address instead of the
>>    hostname directly.
>
> There is no IP address in the relation data. "relation-get private-address"
> returns a fqdn for some reason. I didn't check what unit-get returns on the
> postgresql server.

This wouldn't be too tricky; gethostip (in syslinux) would make this a
fairly trivial thing to do - or socket.gethostbyname() in Python. You
would need to add a trailing /32 to denote a host. See
http://www.postgresql.org/docs/9.1/static/auth-pg-hba-conf.html

>
>>
>> 4. Whatever writes pg_hba.conf could add extra rules for both of the
>>    above.
>>
>> I'm not sure of the repurcussions of a change like #1. We chose to use
>> the generated name for a reason, though I can't remember exactly what it
>> was. Not having to regenerate the zone file everytime the hostname is
>> changed might have been part of it.
>
> But you do add a CNAME everytime a machine comes up.

Yeah, which means we've not been averse to writing zone files, and so
that probably wasn't the reason we made it this way.

I suggest you do #3 for now while we try to figure this one out. To be
honest, I doubt we'll change MAAS's policy here soon; we've got too much
else to do already, and a switch to a different policy will have its own
problems most likely. Sorry :-/

>
>>
>> #2, #3 and #4 require changes to the charm, which I'll assume is easier
>> to do than making a change to core MAAS. I guess it's confusing to charm
>> authors though: a hostname is a hostname, right? It's an unexpected
>> wrinkle. We probably ought to fix #1, or at least justify better why
>> it's like that. In the meantime one of the other options ought to
>> unblock you.
>>
>> If you agree, can you file a bug about #1?
>
> What about the /etc/hosts entry pointing the machine name to 127.0.1.1, do
> you know what adds that? Is it juju? Without that entry, it also works.

I think this is just the usual setting-the-hostname stuff: MAAS will
pass in the configured hostname (instead of the generated one) to the OS
installer, which sets the hostname accordingly, and adds an /etc/hosts
line so that traffic destined for itself (by name) gets routed via the
lo interface. Someone else - roaksoax or smoser most likely - will have
to confirm or correct that explanation.

MAAS will also return this name to Juju, and so that's the name that
Juju passes around to hooks and suchlike.


Follow ups

References