-
Notifications
You must be signed in to change notification settings - Fork 339
Add GetGroupVersionKind and Selector WithPod #1043
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
Conversation
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: savitaashture The full list of commands accepted by this bot can be found here. DetailsNeeds approval from an approver in each of these files:Approvers can indicate their approval by writing |
| // WithPodSpec is the shell around the PodSpecable within WithPod. | ||
| type WithPodSpec struct { | ||
| Template PodSpecable `json:"template,omitempty"` | ||
| Selector *metav1.LabelSelector `json:"selector"` |
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.
This would break compatibility with our own PodSpecables, like Service and Configuration.
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 that's the case then do we need to write new one because for controllers selector is mandatory
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.
See my comment on the PR. I think we shouldn't actually reserialize from the PodSpecable as that's a lossy conversion (as you noticed).
Instead, we should only override the relevant part of the unstructured that's been updated and part of PodSpecable
| } | ||
|
|
||
| // GetGroupVersionKind returns a GroupVersionKind. | ||
| func (*WithPod) GetGroupVersionKind() schema.GroupVersionKind { |
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 sure if this is the right thing to do here as WithPod doesn't really exist. Should this read the actual GroupVersionKind from the typeMeta?
439ef64 to
546e090
Compare
|
The following is the coverage report on the affected files.
|
|
closing PR because it may break compatibility with |
Background:
as per the comments 1 and 2 usage of
PodSpecableduck type helps to reduce lot of duplicate codeIssue:
To use duck type for Deployment, DaemonSet, StatefulSet etc...
Selectorfield is mandatory and which is missing in WithPod and alsoGetGroupVersionKindimplementation