-
Couldn't load subscription status.
- Fork 881
rkt: add --hostname option #2251
Conversation
|
@iaguis so would resolved break if a user changed the hostname within the container themselves? and is that a bad thing? |
|
I don't think I have enough context to answer that. Maybe @steveej can shed some light on it. |
stage1/init/init.go
Outdated
| // According to systemd manual (https://www.freedesktop.org/software/systemd/man/hostname.html) : | ||
| // "The /etc/hostname file configures the name of the local system that is set | ||
| // during boot using the sethostname system call" | ||
| if hostname == "" { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is not the common place. As the case "kvm" returns directly above.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ooops
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Updated, I don't know why this comment is still showing up on github...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Code was not changed, only moved, maybe this is a reason?
This is not something we can easily answer in general, and therefore nothing we have to worry about immediately. You can read https://www.freedesktop.org/software/systemd/man/nss-mymachines.html# to get an idea what can influence the configuration. I just checked the |
|
FWIW with |
|
g2k |
|
If the resolved thing is not something we should worry about for now, I'm OK with merging this. What do you think, @steveej? |
|
Is it possible that someone will add additional functional test for this before merge? It's not something what i need there strongly, but... (i know that i should ask about this @mstachowski when this was added to kvm flavor, but still...) |
|
I can add one if we decide it's ok to merge :) |
|
Added a functional test |
|
It will break fly :-( |
|
How about we introduce annotations for stage1 ACIs where supported commands (run, exec, gc) and their supported flags (--hostname, --dns, --port, ...) can be declared? stage0 could then check if it can pass all requested flags to the stage1 and either skip them or error out cleanly. Behavior on incompatibility should default to error but also be settable via a stage0 flag. |
|
Seems to me a bit too complicated, but reasonable. I have no strong feelings about this... But... This will open a door for new features (and so incompatibility between flavors) supported by one flavor or group of them - this seems more scary and exciting ;) |
This is a pretty big change, can we just ignore the flag in fly for now (like we do with the rest) so we can get this and discuss that in a new issue? |
| | `--dns` | `` | IP Address | Name server to write in `/etc/resolv.conf`. It can be specified several times | | ||
| | `--dns-opt` | `` | Option as described in the options section in resolv.conf(5) | DNS option to write in `/etc/resolv.conf`. It can be specified several times | | ||
| | `--dns-search` | `` | Domain name | DNS search domain to write in `/etc/resolv.conf`. It can be specified several times | | ||
| | `--hostname` | `` | A host name | Pod's hostname. If empty, it will be the "rkt-$PODUUID" | |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
s/the//
I added a commit doing that, addressed the review and added |
|
The I am not sure about adding a new parameter without introducing versioning in annotations as explained here: |
Could you break it apart to identify the most difficult/time-consuming steps that may be postponed? |
Let's do this. There are many outstanding issues with the fly/stage1 thing that need to be addressed, but adding another ignored flag is only making the situation marginally worse. |
|
I think this also affects how we get logs from journactl. |
|
You can do |
| * `--net[=$NET1,$NET2,...]` to configure the creation of a contained network. | ||
| See the [rkt networking documentation](../networking.md) for details. | ||
| * `--mds-token=$TOKEN` passes the auth token to the apps via `AC_METADATA_URL` env var | ||
| * `--hostname=$HOSTNAME` configures the host name of the pod. If empty, it will be "rkt-$PODUUID". Only available from ABI version 2. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Probably would be easier to read if there was a separate section like "flags added in interface version 2".
|
yea, we figured that out, but strangely, it doesn't work on my ubuntu box. |
baeeeb5 to
544e009
Compare
|
Updated. |
stage0/run.go
Outdated
| } | ||
|
|
||
| if cfg.Hostname != "" { | ||
| if s1v > 1 { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I wonder about defining a constant in interface.go, and then:
if s1v > interfaceVersionHostname {
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Dunno, it might be troublesome later. interfaceVersionThisThatAndOneMoreThingIfIRemeberedEverything.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That's how German works, right?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
actually, instead of a constant, define a function in interface.go:
if interfaceVersionSupportsHostname(s1v) {
}
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Or maybe make s1v an object instead of an integer, so you could add functions to it like func (s1v Stage1InterfaceVersion) SupportsHostname() bool {}
That would be an idea for a separate PR. ;P
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'll think about it... :P
|
LFAD, but maybe you'll want another stamp. |
It allows the user to specify a host name for the pod. If not specified, it will be "rkt-$PODUUID".
|
LGTM if green |
It allows the user to specify a host name for the pod. If not specified, it will be "rkt-$PODUUID".
This approach might not be OK if we want to use systemd-resolved, apparently it expects container's machine name to match the hostname.
cc @steveej @yifan-gu @sjpotter
Fixes #2245