-
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 static ip to kube play #8617
Conversation
Signed-off-by: Michael Ernst <[email protected]>
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: mier85 The full list of commands accepted by this bot can be found here.
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
Lack of documentation and unit tests in https://github.com/containers/podman/blob/master/test/e2e/play_kube_test.go |
@zhangguanzhang I will add the documentation in https://github.com/containers/podman/blob/master/docs/source/markdown/podman-play-kube.1.md and some unit tests in the file you pointed to. |
👌 |
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.
Thanks for the contribution @mier85
I left some comment to simplify this a bit.
podman play kube
can be run via the api and podman-remote. So you also need to add this option to the api and remote client.
The api parameter is defined here: https://github.com/containers/podman/blob/0c2a43b99db8a4fd75412a277da6de2731017d3e/pkg/api/handlers/libpod/play.go
Documentation for the api parameter has to be added here: https://github.com/containers/podman/blob/0c2a43b99db8a4fd75412a277da6de2731017d3e/pkg/api/server/register_play.go
Parameter for the remote client has to be added here: https://github.com/containers/podman/blob/master/pkg/bindings/play/play.go
@@ -23,6 +24,7 @@ type playKubeOptionsWrapper struct { | |||
TLSVerifyCLI bool | |||
CredentialsCLI string | |||
StartCLI bool | |||
StaticIPCLI string |
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.
Not needed see other comment
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.
flags will make things much easier, will update that
staticIPFlagName := "ip" | ||
flags.StringVar(&kubeOptions.StaticIPCLI, staticIPFlagName, "", "Static IP address to assign to this pod") | ||
_ = kubeCmd.RegisterFlagCompletionFunc(staticIPFlagName, completion.AutocompleteDefault) | ||
|
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.
You can just use an IP flag. No need for the extra parsing logic
staticIPFlagName := "ip" | |
flags.StringVar(&kubeOptions.StaticIPCLI, staticIPFlagName, "", "Static IP address to assign to this pod") | |
_ = kubeCmd.RegisterFlagCompletionFunc(staticIPFlagName, completion.AutocompleteDefault) | |
staticIPFlagName := "ip" | |
flags.IPVar(&kubeOptions.StaticIP, staticIPFlagName, nil, "Static IP address to assign to this pod") | |
_ = kubeCmd.RegisterFlagCompletionFunc(staticIPFlagName, completion.AutocompleteNone) | |
if kubeOptions.StaticIPCLI != "" { | ||
ipAddress := net.ParseIP(kubeOptions.StaticIPCLI) | ||
if ipAddress == nil { | ||
return fmt.Errorf("failed parsing ip address: %s", kubeOptions.StaticIPCLI) | ||
} | ||
kubeOptions.StaticIP = ipAddress | ||
} | ||
|
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.
Not needed see other comment
A friendly reminder that this PR had no activity for 30 days. |
@mier85 Still working on this? We need to get this in by next week, for the 3.0 release, if we are going to get it done. |
@rhatdan still working on it. Will try to get this done ASAP this week. But I have a question. As several Pods could be spawned when deploying ( e.g. replicas in a kubernetes manifest ) , a single static IP wouldn't work. In this case, should be assign a range starting with the IP or should we fail and ask for several IPs or should this be a "single container only" option? |
I am no kubernetes expert, but I would figure fail would be the correct thing to do. |
Making static IPs incompatible with Deployments, at least initially, sounds like a fine solution. |
@mier85: i see it that way: |
Friendly ping. Are we good to continue? |
@umohnani8 Could you take this one over? |
@mier85: PR needs rebase. Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. |
Replaced by #10043 |
Signed-off-by: Michael Ernst [email protected]
this is implementing #8442
tried running lint & validate & tests, but they all failed before and after my commit. ( even tried the gate which is still partially in the CONTRIBUE.md but then realized that this seems to be no longer a thing )