Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow toolbox containers to be created with a custom hostname #1134

Closed

Conversation

nievesmontero
Copy link
Collaborator

Based on the following pull request #1007

The new `--hostname` flag is now available when invoking `toolbox
create` in order to create a container with a custom hostname. The new
flag does not enforce network-resolvability of any custom hostnames,
but it does require that the hostname is valid, per RFC 1123.

To preserve backward-compatibility, the hostname will still default to
"toolbox" if the flag is not specified.

Signed-off-by: Buckley Ross <[email protected]>
Change-Id: Ib3c0706e3a93a5748453e39998b9893e3e57c305
These tests ensure that the new `--hostname` flag works as intended.

Signed-off-by: Buckley Ross <[email protected]>
Change-Id: Id7b7775fe73a6600afe2dabb0d905be5ba17bb57
Updated the `toolbox create` manual page to cover the usage of the new
`--hostname` flag for specifying custom hostnames when creating new
containers.

Signed-off-by: Buckley Ross <[email protected]>
Change-Id: I16d7f63769c17aec1ff69d34ac8fe28f48827777
@softwarefactory-project-zuul
Copy link

Build failed.

✔️ unit-test SUCCESS in 7m 18s
✔️ unit-test-migration-path-for-coreos-toolbox SUCCESS in 7m 24s
system-test-fedora-rawhide FAILURE in 29m 07s
system-test-fedora-36 FAILURE in 10m 19s
system-test-fedora-35 FAILURE in 10m 12s

@debarshiray
Copy link
Member

Based on the following pull request #1007

What's the difference from #1007 ? Is this a rebase against main?

Copy link
Member

@debarshiray debarshiray left a comment

Choose a reason for hiding this comment

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

The tests are failing:

not ok 25 create: Create a container with a custom hostname ('test.host-name.local') in 530ms
# (from function `assert_success' in file test/system/libs/bats-assert/src/assert.bash, line 114,
#  in test file test/system/101-create.bats, line 102)
#   `assert_success' failed
#
# -- command failed --
# status : 1
# output : Error: invalid hostname
# --
#

@debarshiray
Copy link
Member

Also, there are several issues and pull requests discussing various approaches to improve the host name. For example, did you see #1086 that seems to implement #969 ?

I am curious why you picked #1007

I also remember that @allanday had some ideas about the host name, but I can't find a reference right now.

@@ -113,6 +121,10 @@ func init() {
}

func create(cmd *cobra.Command, args []string) error {
// This regex filters out strings which are not valid hostnames, according to RFC-1123.
// Source: https://stackoverflow.com/a/106223
var hostnameRegexp = regexp.MustCompile(`^(([a-zA-Z0-9]|[a-zA-Z0-9][a-zA-Z0-9\\-]*[a-zA-Z0-9])\\.)*([A-Za-z0-9]|[A-Za-z0-9][a-zA-Z0-9\\-]*[a-zA-Z0-9])$`)
Copy link
Member

Choose a reason for hiding this comment

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

Do we really need to have this regular expression directly in the code? Can't we use some Go package for it?

@nievesmontero
Copy link
Collaborator Author

Based on the following pull request #1007

What's the difference from #1007 ? Is this a rebase against main?

Exactly, this new pull request is #1007 rebased against main. As #1007 was a bit old, there were conflicts I had to solve in order to be able to rebase it.

@nievesmontero
Copy link
Collaborator Author

Also, there are several issues and pull requests discussing various approaches to improve the host name. For example, did you see #1086 that seems to implement #969 ?

I am curious why you picked #1007

I also remember that @allanday had some ideas about the host name, but I can't find a reference right now.

This pull request was picked randomly, trying to solve older pull requests.

@akdev1l
Copy link

akdev1l commented Oct 26, 2022

@nievesmontero I would be partial towards picking the newest PR to merge instead of the oldest one

disclaimer: I'm the guy behind #1086 - totally willing to get this merged if you need some help

@nievesmontero
Copy link
Collaborator Author

@akdev1l thank you for pointing this out. I have tried rebasing #1086 and it seems to work correctly. I will reach you if I need any help, thanks.

@debarshiray
Copy link
Member

Based on the following pull request #1007

What's the difference from #1007 ? Is this a rebase against main?

Exactly, this new pull request is #1007 rebased against main. As #1007
was a bit old, there were conflicts I had to solve in order to be able to
rebase it.

I see.

Among other things, the tests are failing for this pull request, while they were passing for #1007

@debarshiray
Copy link
Member

Also, there are several issues and pull requests discussing various approaches to improve the host name. For example, did you see #1086 that seems to implement #969 ?
I am curious why you picked #1007
I also remember that @allanday had some ideas about the host name, but I can't find a reference right now.

This pull request was picked randomly, trying to solve older pull requests.

I see. This can't be solved randomly. :)

We have two broad issues. One is about improving the default hostname for the containers (see #969), and the other is about making it easier to visually distinguish between containers (see #98).

I suggest going through those two issues, and all the other issues and pull requests linked from them to get a good idea of the current situation. That will give you a good idea of what needs to be done.

@debarshiray
Copy link
Member

I am going to have to close this pull request because the comments from #1007 apply to this one too.

@buck-ross
Copy link

As the author of #1007, I agree with the decision to close both that PR and this one. #1086 seems to be a much simpler solution which addresses my initial issue without over-complicating things. Not to mention that the passage of time appears to have made integrating my original changes significantly more difficult.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants