mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-23 19:56:01 +00:00
Merge pull request #5220 from nikhiljindal/camelCaseFieldSelectors
Changing v1beta3 field selectors to be camelCased
This commit is contained in:
commit
6062e14313
@ -1355,12 +1355,12 @@ func init() {
|
|||||||
case "name":
|
case "name":
|
||||||
return "name", value, nil
|
return "name", value, nil
|
||||||
case "DesiredState.Host":
|
case "DesiredState.Host":
|
||||||
return "Status.Host", value, nil
|
return "status.host", value, nil
|
||||||
case "DesiredState.Status":
|
case "DesiredState.Status":
|
||||||
podStatus := PodStatus(value)
|
podStatus := PodStatus(value)
|
||||||
var internalValue newer.PodPhase
|
var internalValue newer.PodPhase
|
||||||
newer.Scheme.Convert(&podStatus, &internalValue)
|
newer.Scheme.Convert(&podStatus, &internalValue)
|
||||||
return "Status.Phase", string(internalValue), nil
|
return "status.phase", string(internalValue), nil
|
||||||
default:
|
default:
|
||||||
return "", "", fmt.Errorf("field label not supported: %s", label)
|
return "", "", fmt.Errorf("field label not supported: %s", label)
|
||||||
}
|
}
|
||||||
|
@ -1271,12 +1271,12 @@ func init() {
|
|||||||
case "name":
|
case "name":
|
||||||
return "name", value, nil
|
return "name", value, nil
|
||||||
case "DesiredState.Host":
|
case "DesiredState.Host":
|
||||||
return "Status.Host", value, nil
|
return "status.host", value, nil
|
||||||
case "DesiredState.Status":
|
case "DesiredState.Status":
|
||||||
podStatus := PodStatus(value)
|
podStatus := PodStatus(value)
|
||||||
var internalValue newer.PodPhase
|
var internalValue newer.PodPhase
|
||||||
newer.Scheme.Convert(&podStatus, &internalValue)
|
newer.Scheme.Convert(&podStatus, &internalValue)
|
||||||
return "Status.Phase", string(internalValue), nil
|
return "status.phase", string(internalValue), nil
|
||||||
default:
|
default:
|
||||||
return "", "", fmt.Errorf("field label not supported: %s", label)
|
return "", "", fmt.Errorf("field label not supported: %s", label)
|
||||||
}
|
}
|
||||||
|
@ -29,9 +29,9 @@ func init() {
|
|||||||
switch label {
|
switch label {
|
||||||
case "name":
|
case "name":
|
||||||
fallthrough
|
fallthrough
|
||||||
case "Status.Phase":
|
case "status.phase":
|
||||||
fallthrough
|
fallthrough
|
||||||
case "Status.Host":
|
case "status.host":
|
||||||
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)
|
||||||
|
2
pkg/client/cache/listwatch_test.go
vendored
2
pkg/client/cache/listwatch_test.go
vendored
@ -53,7 +53,7 @@ func getHostFieldLabel() string {
|
|||||||
case "v1beta1", "v1beta2":
|
case "v1beta1", "v1beta2":
|
||||||
return "DesiredState.Host"
|
return "DesiredState.Host"
|
||||||
default:
|
default:
|
||||||
return "Status.Host"
|
return "status.host"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -57,6 +57,6 @@ func getHostFieldLabel(apiVersion string) string {
|
|||||||
case "v1beta1", "v1beta2":
|
case "v1beta1", "v1beta2":
|
||||||
return "DesiredState.Host"
|
return "DesiredState.Host"
|
||||||
default:
|
default:
|
||||||
return "Status.Host"
|
return "status.host"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -337,16 +337,16 @@ func TestListPodListSelection(t *testing.T) {
|
|||||||
label: "label=qux",
|
label: "label=qux",
|
||||||
expectedIDs: util.NewStringSet("qux"),
|
expectedIDs: util.NewStringSet("qux"),
|
||||||
}, {
|
}, {
|
||||||
field: "Status.Phase=Failed",
|
field: "status.phase=Failed",
|
||||||
expectedIDs: util.NewStringSet("baz"),
|
expectedIDs: util.NewStringSet("baz"),
|
||||||
}, {
|
}, {
|
||||||
field: "Status.Host=barhost",
|
field: "status.host=barhost",
|
||||||
expectedIDs: util.NewStringSet("bar"),
|
expectedIDs: util.NewStringSet("bar"),
|
||||||
}, {
|
}, {
|
||||||
field: "Status.Host=",
|
field: "status.host=",
|
||||||
expectedIDs: util.NewStringSet("foo", "baz", "qux", "zot"),
|
expectedIDs: util.NewStringSet("foo", "baz", "qux", "zot"),
|
||||||
}, {
|
}, {
|
||||||
field: "Status.Host!=",
|
field: "status.host!=",
|
||||||
expectedIDs: util.NewStringSet("bar"),
|
expectedIDs: util.NewStringSet("bar"),
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
@ -132,8 +132,8 @@ func MatchPod(label, field labels.Selector) generic.Matcher {
|
|||||||
func PodToSelectableFields(pod *api.Pod) labels.Set {
|
func PodToSelectableFields(pod *api.Pod) labels.Set {
|
||||||
return labels.Set{
|
return labels.Set{
|
||||||
"name": pod.Name,
|
"name": pod.Name,
|
||||||
"Status.Phase": string(pod.Status.Phase),
|
"status.phase": string(pod.Status.Phase),
|
||||||
"Status.Host": pod.Status.Host,
|
"status.host": pod.Status.Host,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -259,7 +259,7 @@ func getHostFieldLabel(apiVersion string) string {
|
|||||||
case "v1beta1", "v1beta2":
|
case "v1beta1", "v1beta2":
|
||||||
return "DesiredState.Host"
|
return "DesiredState.Host"
|
||||||
default:
|
default:
|
||||||
return "Status.Host"
|
return "status.host"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user