mirror of
https://github.com/k3s-io/kubernetes.git
synced 2026-01-05 23:47:50 +00:00
Switch to versioned ListOptions in client.
This commit is contained in:
@@ -31,6 +31,14 @@ var Codec = runtime.CodecFor(Scheme, "")
|
||||
|
||||
func init() {
|
||||
Scheme.AddDefaultingFuncs(
|
||||
func(obj *ListOptions) {
|
||||
if obj.LabelSelector == nil {
|
||||
obj.LabelSelector = labels.Everything()
|
||||
}
|
||||
if obj.FieldSelector == nil {
|
||||
obj.FieldSelector = fields.Everything()
|
||||
}
|
||||
},
|
||||
func(obj *unversioned.ListOptions) {
|
||||
if obj.LabelSelector.Selector == nil {
|
||||
obj.LabelSelector = unversioned.LabelSelector{labels.Everything()}
|
||||
|
||||
@@ -71,6 +71,7 @@ func init() {
|
||||
&PersistentVolumeClaim{},
|
||||
&PersistentVolumeClaimList{},
|
||||
&DeleteOptions{},
|
||||
&ListOptions{},
|
||||
&PodAttachOptions{},
|
||||
&PodLogOptions{},
|
||||
&PodExecOptions{},
|
||||
@@ -83,7 +84,6 @@ func init() {
|
||||
|
||||
// Register Unversioned types
|
||||
// TODO this should not be done here
|
||||
Scheme.AddKnownTypes(SchemeGroupVersion, &unversioned.ListOptions{})
|
||||
Scheme.AddKnownTypes(SchemeGroupVersion, &unversioned.Status{})
|
||||
Scheme.AddKnownTypes(SchemeGroupVersion, &unversioned.APIVersions{})
|
||||
Scheme.AddKnownTypes(SchemeGroupVersion, &unversioned.APIGroupList{})
|
||||
@@ -123,6 +123,7 @@ func (*PersistentVolumeList) IsAnAPIObject() {}
|
||||
func (*PersistentVolumeClaim) IsAnAPIObject() {}
|
||||
func (*PersistentVolumeClaimList) IsAnAPIObject() {}
|
||||
func (*DeleteOptions) IsAnAPIObject() {}
|
||||
func (*ListOptions) IsAnAPIObject() {}
|
||||
func (*PodAttachOptions) IsAnAPIObject() {}
|
||||
func (*PodLogOptions) IsAnAPIObject() {}
|
||||
func (*PodExecOptions) IsAnAPIObject() {}
|
||||
|
||||
@@ -97,6 +97,12 @@ func FuzzerFor(t *testing.T, version string, src rand.Source) *fuzz.Fuzzer {
|
||||
j.ResourceVersion = strconv.FormatUint(c.RandUint64(), 10)
|
||||
j.SelfLink = c.RandString()
|
||||
},
|
||||
func(j *api.ListOptions, c fuzz.Continue) {
|
||||
label, _ := labels.Parse("a=b")
|
||||
j.LabelSelector = label
|
||||
field, _ := fields.ParseSelector("a=b")
|
||||
j.FieldSelector = field
|
||||
},
|
||||
func(j *unversioned.ListOptions, c fuzz.Continue) {
|
||||
// TODO: add some parsing
|
||||
label, _ := labels.Parse("a=b")
|
||||
|
||||
@@ -19,6 +19,8 @@ package api
|
||||
import (
|
||||
"k8s.io/kubernetes/pkg/api/resource"
|
||||
"k8s.io/kubernetes/pkg/api/unversioned"
|
||||
"k8s.io/kubernetes/pkg/fields"
|
||||
"k8s.io/kubernetes/pkg/labels"
|
||||
"k8s.io/kubernetes/pkg/runtime"
|
||||
"k8s.io/kubernetes/pkg/types"
|
||||
"k8s.io/kubernetes/pkg/util/intstr"
|
||||
@@ -1647,6 +1649,23 @@ type DeleteOptions struct {
|
||||
GracePeriodSeconds *int64 `json:"gracePeriodSeconds"`
|
||||
}
|
||||
|
||||
// ListOptions is the query options to a standard REST list call, and has future support for
|
||||
// watch calls.
|
||||
type ListOptions struct {
|
||||
unversioned.TypeMeta `json:",inline"`
|
||||
|
||||
// A selector based on labels
|
||||
LabelSelector labels.Selector
|
||||
// A selector based on fields
|
||||
FieldSelector fields.Selector
|
||||
// If true, watch for changes to this list
|
||||
Watch bool
|
||||
// The resource version to watch (no effect on list yet)
|
||||
ResourceVersion string
|
||||
// Timeout for the list/watch call.
|
||||
TimeoutSeconds *int64
|
||||
}
|
||||
|
||||
// PodLogOptions is the query options for a Pod's logs REST call
|
||||
type PodLogOptions struct {
|
||||
unversioned.TypeMeta
|
||||
|
||||
Reference in New Issue
Block a user