-
Notifications
You must be signed in to change notification settings - Fork 4.7k
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 legacy field selector for names #15963
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
package legacy | ||
|
||
import ( | ||
"k8s.io/apimachinery/pkg/runtime" | ||
) | ||
|
||
// LegacyMetaV1FieldSelectorConversionWithName auto-accepts metav1 values for name and namespace AND "name" | ||
// which many of our older resources used. | ||
func LegacyMetaV1FieldSelectorConversionWithName(label, value string) (string, string, error) { | ||
switch label { | ||
case "name": | ||
return "metadata.name", value, nil | ||
default: | ||
return runtime.DefaultMetaV1FieldSelectorConversion(label, value) | ||
} | ||
} |
This file was deleted.
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -280,12 +280,6 @@ func addConversionFuncs(scheme *runtime.Scheme) error { | |
return err | ||
} | ||
|
||
if err := scheme.AddFieldLabelConversionFunc("v1", "Image", | ||
oapi.GetFieldLabelConversionFunc(newer.ImageToSelectableFields(&newer.Image{}), nil), | ||
); err != nil { | ||
return err | ||
} | ||
|
||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why is this required for buildconfigs but not here? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. doesn't have name -> metadata.name |
||
if err := scheme.AddFieldLabelConversionFunc("v1", "ImageStream", | ||
oapi.GetFieldLabelConversionFunc(newer.ImageStreamToSelectableFields(&newer.ImageStream{}), map[string]string{"name": "metadata.name"}), | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Missing port to the new There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
didn't forget this one. This field selector actually lists many fields so the conversion can't be done via a straight default. It will require more thought and code. |
||
); err != 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.
Why is this required for buildconfigs but not here?
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 doesn't have a special case to map "name" to "metadata.name" for field selection.