mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-08-13 13:55:41 +00:00
fix the left pre V1 field names in 290c4618c331f4f30a278af520121ff35
This commit is contained in:
parent
f990899290
commit
5673f73378
@ -42,7 +42,7 @@ func addConversionFuncs() {
|
|||||||
case "metadata.name",
|
case "metadata.name",
|
||||||
"metadata.namespace",
|
"metadata.namespace",
|
||||||
"status.phase",
|
"status.phase",
|
||||||
"spec.host":
|
"spec.nodeName":
|
||||||
return label, value, nil
|
return label, value, nil
|
||||||
default:
|
default:
|
||||||
return "", "", fmt.Errorf("field label not supported: %s", label)
|
return "", "", fmt.Errorf("field label not supported: %s", label)
|
||||||
|
@ -53,9 +53,10 @@ func addConversionFuncs() {
|
|||||||
switch label {
|
switch label {
|
||||||
case "metadata.name",
|
case "metadata.name",
|
||||||
"metadata.namespace",
|
"metadata.namespace",
|
||||||
"status.phase",
|
"status.phase":
|
||||||
"spec.host":
|
|
||||||
return label, value, nil
|
return label, value, nil
|
||||||
|
case "spec.host":
|
||||||
|
return "spec.nodeName", value, nil
|
||||||
default:
|
default:
|
||||||
return "", "", fmt.Errorf("field label not supported: %s", label)
|
return "", "", fmt.Errorf("field label not supported: %s", label)
|
||||||
}
|
}
|
||||||
|
@ -260,7 +260,7 @@ const (
|
|||||||
// Will be automatically emitted as the correct name for the API version.
|
// Will be automatically emitted as the correct name for the API version.
|
||||||
NodeUnschedulable = "spec.unschedulable"
|
NodeUnschedulable = "spec.unschedulable"
|
||||||
ObjectNameField = "metadata.name"
|
ObjectNameField = "metadata.name"
|
||||||
PodHost = "spec.host"
|
PodHost = "spec.nodeName"
|
||||||
SecretType = "type"
|
SecretType = "type"
|
||||||
|
|
||||||
EventReason = "reason"
|
EventReason = "reason"
|
||||||
@ -351,12 +351,8 @@ var fieldMappings = versionToResourceToFieldMapping{
|
|||||||
ObjectNameField: "metadata.name",
|
ObjectNameField: "metadata.name",
|
||||||
NodeUnschedulable: "spec.unschedulable",
|
NodeUnschedulable: "spec.unschedulable",
|
||||||
},
|
},
|
||||||
"minions": clientFieldNameToAPIVersionFieldName{
|
|
||||||
ObjectNameField: "metadata.name",
|
|
||||||
NodeUnschedulable: "spec.unschedulable",
|
|
||||||
},
|
|
||||||
"pods": clientFieldNameToAPIVersionFieldName{
|
"pods": clientFieldNameToAPIVersionFieldName{
|
||||||
PodHost: "spec.host",
|
PodHost: "spec.nodeName",
|
||||||
},
|
},
|
||||||
"secrets": clientFieldNameToAPIVersionFieldName{
|
"secrets": clientFieldNameToAPIVersionFieldName{
|
||||||
SecretType: "type",
|
SecretType: "type",
|
||||||
|
@ -323,13 +323,13 @@ func TestListPodListSelection(t *testing.T) {
|
|||||||
field: "status.phase=Failed",
|
field: "status.phase=Failed",
|
||||||
expectedIDs: util.NewStringSet("baz"),
|
expectedIDs: util.NewStringSet("baz"),
|
||||||
}, {
|
}, {
|
||||||
field: "spec.host=barhost",
|
field: "spec.nodeName=barhost",
|
||||||
expectedIDs: util.NewStringSet("bar"),
|
expectedIDs: util.NewStringSet("bar"),
|
||||||
}, {
|
}, {
|
||||||
field: "spec.host=",
|
field: "spec.nodeName=",
|
||||||
expectedIDs: util.NewStringSet("foo", "baz", "qux", "zot"),
|
expectedIDs: util.NewStringSet("foo", "baz", "qux", "zot"),
|
||||||
}, {
|
}, {
|
||||||
field: "spec.host!=",
|
field: "spec.nodeName!=",
|
||||||
expectedIDs: util.NewStringSet("bar"),
|
expectedIDs: util.NewStringSet("bar"),
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
@ -123,7 +123,7 @@ func MatchPod(label labels.Selector, field fields.Selector) generic.Matcher {
|
|||||||
func PodToSelectableFields(pod *api.Pod) fields.Set {
|
func PodToSelectableFields(pod *api.Pod) fields.Set {
|
||||||
return fields.Set{
|
return fields.Set{
|
||||||
"metadata.name": pod.Name,
|
"metadata.name": pod.Name,
|
||||||
"spec.host": pod.Spec.NodeName,
|
"spec.nodeName": pod.Spec.NodeName,
|
||||||
"status.phase": string(pod.Status.Phase),
|
"status.phase": string(pod.Status.Phase),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user