-
Notifications
You must be signed in to change notification settings - Fork 472
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 utils to translate custom types #1310
Conversation
Hi @abhijit-dev82. Thanks for your PR. I'm waiting for a kubernetes-sigs 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. |
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: abhijit-dev82 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 |
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 @abhijit-dev82! This looks like a great start. Will discuss this at the community meeting on Monday to ensure that at least some implementations will actually make use of this. This seems like it could be very helpful, but don't want to introduce extra code to maintain until we're sure it will be used.
apis/v1alpha2/helper.go
Outdated
return portNum | ||
} | ||
|
||
func ListenerHostnameToPtr(host string) *Hostname { |
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 remove Listener
prefix here since Hostname can be used elsewhere.
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.
corrected
apis/v1beta1/helper.go
Outdated
@@ -0,0 +1,177 @@ | |||
/* | |||
Copyright 2020 The Kubernetes Authors. |
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.
Copyright 2020 The Kubernetes Authors. | |
Copyright 2022 The Kubernetes Authors. |
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.
corrected.
apis/v1alpha2/helper.go
Outdated
@@ -0,0 +1,177 @@ | |||
/* | |||
Copyright 2020 The Kubernetes Authors. |
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.
Copyright 2020 The Kubernetes Authors. | |
Copyright 2022 The Kubernetes Authors. |
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.
Corrected.
apis/v1beta1/helper.go
Outdated
return portNum | ||
} | ||
|
||
func ListenerHostnameToPtr(host string) *Hostname { |
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 remove Listener
prefix here since Hostname can be used elsewhere.
apis/v1beta1/helper.go
Outdated
|
||
package v1beta1 | ||
|
||
func SectionNameToPtr(sectionName string) *SectionName { |
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 most go linting will usually fail without comments describing each exported function
@abhijit-dev82 thank you for doing this, I will certainly use it so I can delete some code in my code base! Everything lgtm except I'm not loving the name and the location of the file, especially when I consider existing helper functionality. I opened an issue to explain: Consider a minor restructure of directory/file for util things · Issue #1336 · kubernetes-sigs/gateway-api. I'd hate to block the merging of this PR for something that is sorta trivial but brakes the interface so it will require some thinking. At the same time, I would love adding such helpful code in a place that makes great sense, given the context around it. |
I really like @carlisia's idea in #1336. @abhijit-dev82 do you think you could incorporate that restructuring into this PR? /ok-to-test |
There is one more input I'd like to offer. If we look at the existing conversion helpers (
...we see that there is no
|
This PR adds the directory structure mentioned above: #1337. |
@carlisia & @robscott Thank you for all the comments. I was away due to health reasons, hence was not able to make the necessary changes. I see that the directory changes are already done, will add the new file in the util dir. Do we need to see we can auto generate these translation routines based on the custom types defined . |
@abhijit-dev82: 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. |
Add utils to translate custom types
445eb1f
to
b1640c1
Compare
a012b32
to
b1640c1
Compare
@abhijit-dev82: The following test failed, say
Full PR test history. Your PR dashboard. Please help us cut down on flakes by linking to an open issue when you hit one in your PR. 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. I understand the commands that are listed here. |
What type of PR is this?
/kind cleanup
What this PR does / why we need it:
Proposed change set are helper functions to translate to and from custom types.
Which issue(s) this PR fixes:
Fixes #826
Does this PR introduce a user-facing change?:
No