-
Notifications
You must be signed in to change notification settings - Fork 2.3k
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
Support k8s Deployment in play kube #6256
Support k8s Deployment in play kube #6256
Conversation
Hi @theunrealgeek. Thanks for your PR. I'm waiting for a containers member to verify that this patch is reasonable to test. If it is, they should reply with Once the patch is verified, the new status will be reflected by the I understand the commands that are listed here. 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. |
Thanks @theunrealgeek |
/ok-to-test |
cmd/podman/play/kube.go
Outdated
fmt.Printf("Pod:\n%s\n", report.Pod) | ||
switch len(report.Pods) { | ||
case 0: | ||
return nil |
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.
Hm. Are there cases where containers could be made, but not pods? We might want to make 0 print nothing but not return yet
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 actually disagree, there really shouldn't be a case containers are created and pods are not. I think return early here if no printing is needed
this looks awesome @theunrealgeek ! can you add some tests in the style of the tests in |
pkg/domain/infra/abi/play.go
Outdated
@@ -359,6 +414,11 @@ func kubeContainerToCreateConfig(ctx context.Context, containerYAML v1.Container | |||
containerConfig.Image = containerYAML.Image | |||
containerConfig.ImageID = newImage.ID() | |||
containerConfig.Name = containerYAML.Name | |||
|
|||
if podName != "" { |
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.
maybe fail here if podName is not specified?
Didn't realise there were tests for this, I'll add some new tests for the new stuff and fix any existing ones that break. |
@theunrealgeek Please rebase this PR |
I'm done fixing the existing tests and addressing most of the review comments. I need to add a few more tests with a |
1322ac2
to
56094b7
Compare
56094b7
to
b264998
Compare
@haircommander Can you please take a look at this again ? I've addressed most of the comments. There are still some failing CI tests which don't seem related to anything I have touched, but if they are, please let me know and I'll take a look at them. |
test/e2e/play_kube_test.go
Outdated
spec: | ||
hostname: unknown | ||
` | ||
|
||
var yamlTemplate = ` |
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.
nit: I would probably change this to podYAMLTemplate
now
test/e2e/play_kube_test.go
Outdated
|
||
return nil | ||
} | ||
|
||
func generateKubeYaml(pod *Pod, fileName string) error { |
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.
similarly, this should probably generatePodKubeYaml
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.
also, if there's any redundancy in this function with generateDeploymentKubeYaml, It'd be ideal if the similarities could be put in a function. I see you've made writeYAML, but haven't used it in generateKubeYaml
test/e2e/play_kube_test.go
Outdated
|
||
return nil | ||
} | ||
|
||
func generateKubeYaml(pod *Pod, fileName string) error { |
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.
second nit for this line: we should stick to either YAML or Yaml. I don't care which, but if you'd prefer to use YAML, can you change all of them?
@theunrealgeek excellent thank you. a couple more nits but all together looks great to me 👍 😃 |
(also, I agree, test failures look like registry issues. I've tried retriggering them) |
@theunrealgeek Any progress? |
Tests are fixed on master, FYI - a rebase should pick up the fix |
Signed-off-by: Aditya Kamath <theunrealgeek@gmail.com>
Signed-off-by: Aditya Kamath <theunrealgeek@gmail.com>
Signed-off-by: Aditya Kamath <theunrealgeek@gmail.com>
Signed-off-by: Aditya Kamath <theunrealgeek@gmail.com>
Signed-off-by: Aditya Kamath <theunrealgeek@gmail.com>
Signed-off-by: Aditya Kamath <theunrealgeek@gmail.com>
9c77473
to
10ebb74
Compare
@rhatdan Sorry about the delay, got involved in a prod incident on my day job. @haircommander I've addressed your comments. Thank you for your review :) |
@theunrealgeek No problem, thanks for the contribution. |
pkg/domain/infra/abi/play.go
Outdated
@@ -382,7 +445,10 @@ func kubeContainerToCreateConfig(ctx context.Context, containerYAML v1.Container | |||
|
|||
setupSecurityContext(&securityConfig, &userConfig, containerYAML) | |||
|
|||
securityConfig.SeccompProfilePath = seccompPaths.findForContainer(containerConfig.Name) | |||
// Since we prefix the container name with pod name to work-around the uniqueness requirement, | |||
// seccom stuff should reference the actual container name from the YAML |
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.
nit: s/seccom stuff/the seccomp profile
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.
Done 👍 @haircommander
Signed-off-by: Aditya Kamath <theunrealgeek@gmail.com>
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.
Just two non-blocking nits: other than that LGTM
Signed-off-by: Aditya Kamath <theunrealgeek@gmail.com>
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, thanks!
@haircommander PTAL
/approve |
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: rhatdan, theunrealgeek 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 |
LGTM 😃 |
cmd/podman/play/kube.go
Outdated
|
||
switch len(pod.Containers) { | ||
case 0: | ||
return nil |
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.
Should this be a continue
so we print all pods in the case that there are more than 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.
@mheon Good catch, copy paste error on my part from the previous version. I've fixed it, thanks
One last nit, otherwise LGTM. Clear to merge once fixed. |
Signed-off-by: Aditya Kamath <theunrealgeek@gmail.com>
/lgtm |
/hold cancel |
This PR is adding support for
Deployment
k8s Kind in addition to the already supportedPod
kind and is in response to #4093Deployment
kinds generally just spit out one or morePod
s from a template spec. Hence I have reused most of the existing code forPod
and just created multiple of these dictated by the replica count specified in theDeployment
YAML.The only breaking change in this PR is that container names from
play kube
now have the name of the pod prefixed to them sincepodman
needs unique container names overall and not unique container names per-pod as is the expectation from Kubernetes.