-
Notifications
You must be signed in to change notification settings - Fork 2.4k
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
Add podman play kube --no-hosts options #11707
Conversation
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: rhatdan The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
3ac7c05
to
ec31b01
Compare
cmd/podman/play/kube.go
Outdated
@@ -78,6 +78,7 @@ func init() { | |||
flags.StringVar(&kubeOptions.LogDriver, logDriverFlagName, "", "Logging driver for the container") | |||
_ = kubeCmd.RegisterFlagCompletionFunc(logDriverFlagName, common.AutocompleteLogDriver) | |||
|
|||
flags.BoolVar(&kubeOptions.NoHosts, "no-hosts", false, "Do not create /etc/hosts within the containers, instead use the version from the image") |
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 think...
flags.BoolVar(&kubeOptions.NoHosts, "no-hosts", false, "Do not create /etc/hosts within the containers, instead use the version from the image") | |
flags.BoolVar(&kubeOptions.NoHosts, "no-hosts", false, "Do not create /etc/hosts within the container, instead use the version from the image") |
@@ -138,6 +138,10 @@ Valid _mode_ values are: | |||
Note: Rootlesskit changes the source IP address of incoming packets to a IP address in the container network namespace, usually `10.0.2.100`. If your application requires the real source IP address, e.g. web server logs, use the slirp4netns port handler. The rootlesskit port handler is also used for rootless containers when connected to user-defined networks. | |||
- **port_handler=slirp4netns**: Use the slirp4netns port forwarding, it is slower than rootlesskit but preserves the correct source IP address. This port handler cannot be used for user-defined networks. | |||
|
|||
#### **--no-hosts** | |||
|
|||
Do not create /etc/hosts within the containers, instead use the version from the image |
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.
if you go singular above, go singular here too. Also add an ending period (.)
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.
It should go to all containers in Pod
test/e2e/play_kube_test.go
Outdated
@@ -1137,6 +1137,30 @@ var _ = Describe("Podman play kube", func() { | |||
Expect(infraContainerImage).To(Equal(config.DefaultInfraImage)) | |||
}) | |||
|
|||
It("podman play kube should use default infra_image", func() { |
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.
Is this actually a test of the default infra image? It looks like it's testing no-hosts only
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.
No cut and paste, fixed.
795e72d
to
a3bb7b5
Compare
@vrothberg @giuseppe @flouthoc @Luap99 PTAL |
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.
LGTM
@rhatdan If i am correct this will prevent inheriting I am not sure but i think use-case should support populating Just to clarify this i have also commented on the original issue itself. Apart from this point LGTM |
Ignoring |
@rhatdan Can we get a test with |
ah if it is expected behavior then i can see error is generated when both are set. LGTM |
pkg/domain/infra/abi/play.go
Outdated
@@ -182,6 +182,9 @@ func (ic *ContainerEngine) playKubePod(ctx context.Context, podName string, podY | |||
} | |||
|
|||
podOpt := entities.PodCreateOptions{Infra: true, Net: &entities.NetOptions{StaticIP: &net.IP{}, StaticMAC: &net.HardwareAddr{}}} | |||
podOpt.Net = &entities.NetOptions{ |
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.
move this above into the line with eh already declared net options. If I recall correctly StaticIP
and StaticMAC
need to be initialized or a nil pointer deref can happen
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.
Good catch.
@mheon I added thests. |
LGTM |
/hold |
Tests aren't hip @rhatdan |
New changes are detected. LGTM label has been removed. |
This option will setup the containers to not modify their /etc/hosts file and just use the one from the image. Fixes: containers#9500 Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
This option will setup the containers to not modify their /etc/hosts
file and just use the one from the image.
Fixes: #9500
Signed-off-by: Daniel J Walsh dwalsh@redhat.com