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
Updates TransformXXX Functions in k8s pkg #26244
Conversation
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! The code looks good to me!
Outside the scope of this PR; I think at some point it would be more useful to extraxct the godoc for these functions to a common description, so we avoid having it duplicated that much; given its so easy to miss one and get inconsistent comments - given they ~all implement the same thing, just for different types.
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! /lgtm
One step further might be to leverage generics to extract all the common logic, having only a single function as parameter which takes care of the actual conversion from the source to the destination type. This would reduce the overall code duplication and ensure consistency across all implementations. Related: #26367 |
@giorio94 thanks for the heads-up regarding #26367. Based on my comment, we may be able to close this PR and have #26367 fix #26240. |
The two PRs are currently addressing two separate aspects (this one tackles the transformation functions which do an actual type transformation, while #26367 the ones which don't mutate the object type). |
@giorio94 thanks for the clarification. I noticed the |
Yeah, I agree that it is better to drive this fix to completion and tackle more invasive refactorings in a followup. |
I re-ran |
@danehans These changes look very reasonable to me, however I am still a bit confused as to how this situation might arise? In the only usage of this transform function in the operator, the k8s client service interface returns a |
/test |
@tommyp1ckles thanks for the review. I agree that |
@joestringer thanks for rerunning the K8sUpstreamNetConformance test. It's now passing but now the ConformanceEKS test is failing due to: Error reading Cilium logs: error getting cilium-agent logs for kube-system/cilium-zxm7g: Get "https://192.168.116.242:10250/containerLogs/kube-system/cilium-zxm7g/cilium-agent?sinceTime=2023-06-23T06%3A13%3A12Z×tamps=true": dial tcp 192.168.116.242:10250: i/o timeout
[=] Test [all-entities-deny] I don't believe the ConformanceEKS test failures are related to this PR. Are you able to rerun this test? |
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.
@danehans Thanks for the clarification, lgtm
/test |
I tried retriggering tests to kick off the gateway-conformance jobs, but I think actually the PR needs to be rebased against the latest main branch. @danehans could you rebase and retrigger the tests? |
Updates TransformXXX functions to not return an error if the provided object is the same type that is being transformed to. Instead, the provided object is returned without any transformations. Signed-off-by: Daneyon Hansen <daneyon.hansen@solo.io>
/test |
Updates TransformXXX functions to not return an error if the provided and returned objects are the same type. Instead, the provided object is returned without any transformations.
Fixes: #26240