Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
K
k3s
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Jacklull
k3s
Commits
b44b7169
Commit
b44b7169
authored
Aug 25, 2016
by
Kubernetes Submit Queue
Committed by
GitHub
Aug 25, 2016
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #31248 from wojtek-t/better_selectable_fields
Automatic merge from submit-queue Avoid unnecessary copies & allocations in field selectors
parents
fff95275
d5a596bc
Hide whitespace changes
Inline
Side-by-side
Showing
29 changed files
with
45 additions
and
54 deletions
+45
-54
strategy.go
federation/registry/cluster/strategy.go
+1
-1
strategy.go
pkg/registry/certificates/strategy.go
+1
-1
strategy.go
pkg/registry/configmap/strategy.go
+1
-1
strategy.go
pkg/registry/controller/strategy.go
+1
-1
strategy.go
pkg/registry/daemonset/strategy.go
+1
-1
strategy.go
pkg/registry/deployment/strategy.go
+1
-1
strategy.go
pkg/registry/endpoint/strategy.go
+1
-1
strategy.go
pkg/registry/event/strategy.go
+15
-14
strategy_test.go
pkg/registry/event/strategy_test.go
+2
-12
matcher.go
pkg/registry/generic/matcher.go
+2
-2
store_test.go
pkg/registry/generic/registry/store_test.go
+1
-1
strategy.go
pkg/registry/ingress/strategy.go
+1
-1
strategy.go
pkg/registry/job/strategy.go
+1
-1
strategy.go
pkg/registry/namespace/strategy.go
+1
-1
strategy.go
pkg/registry/networkpolicy/strategy.go
+1
-1
strategy.go
pkg/registry/node/strategy.go
+1
-1
strategy.go
pkg/registry/persistentvolume/strategy.go
+1
-1
strategy.go
pkg/registry/persistentvolumeclaim/strategy.go
+1
-1
strategy.go
pkg/registry/petset/strategy.go
+1
-1
strategy.go
pkg/registry/pod/strategy.go
+1
-1
strategy.go
pkg/registry/poddisruptionbudget/strategy.go
+1
-1
strategy.go
pkg/registry/podsecuritypolicy/strategy.go
+1
-1
strategy.go
pkg/registry/replicaset/strategy.go
+1
-1
strategy.go
pkg/registry/resourcequota/strategy.go
+1
-1
strategy.go
pkg/registry/scheduledjob/strategy.go
+1
-1
strategy.go
pkg/registry/secret/strategy.go
+1
-1
strategy.go
pkg/registry/service/strategy.go
+1
-1
strategy.go
pkg/registry/serviceaccount/strategy.go
+1
-1
strategy.go
pkg/registry/storageclass/strategy.go
+1
-1
No files found.
federation/registry/cluster/strategy.go
View file @
b44b7169
...
@@ -41,7 +41,7 @@ func (clusterStrategy) NamespaceScoped() bool {
...
@@ -41,7 +41,7 @@ func (clusterStrategy) NamespaceScoped() bool {
}
}
func
ClusterToSelectableFields
(
cluster
*
federation
.
Cluster
)
fields
.
Set
{
func
ClusterToSelectableFields
(
cluster
*
federation
.
Cluster
)
fields
.
Set
{
return
generic
.
ObjectMetaFieldsSet
(
cluster
.
ObjectMeta
,
false
)
return
generic
.
ObjectMetaFieldsSet
(
&
cluster
.
ObjectMeta
,
false
)
}
}
func
MatchCluster
(
label
labels
.
Selector
,
field
fields
.
Selector
)
*
generic
.
SelectionPredicate
{
func
MatchCluster
(
label
labels
.
Selector
,
field
fields
.
Selector
)
*
generic
.
SelectionPredicate
{
...
...
pkg/registry/certificates/strategy.go
View file @
b44b7169
...
@@ -184,5 +184,5 @@ func Matcher(label labels.Selector, field fields.Selector) *generic.SelectionPre
...
@@ -184,5 +184,5 @@ func Matcher(label labels.Selector, field fields.Selector) *generic.SelectionPre
// SelectableFields returns a field set that can be used for filter selection
// SelectableFields returns a field set that can be used for filter selection
func
SelectableFields
(
obj
*
certificates
.
CertificateSigningRequest
)
fields
.
Set
{
func
SelectableFields
(
obj
*
certificates
.
CertificateSigningRequest
)
fields
.
Set
{
return
generic
.
ObjectMetaFieldsSet
(
obj
.
ObjectMeta
,
false
)
return
generic
.
ObjectMetaFieldsSet
(
&
obj
.
ObjectMeta
,
false
)
}
}
pkg/registry/configmap/strategy.go
View file @
b44b7169
...
@@ -84,7 +84,7 @@ func (strategy) ValidateUpdate(ctx api.Context, newObj, oldObj runtime.Object) f
...
@@ -84,7 +84,7 @@ func (strategy) ValidateUpdate(ctx api.Context, newObj, oldObj runtime.Object) f
// ConfigMapToSelectableFields returns a field set that represents the object for matching purposes.
// ConfigMapToSelectableFields returns a field set that represents the object for matching purposes.
func
ConfigMapToSelectableFields
(
cfg
*
api
.
ConfigMap
)
fields
.
Set
{
func
ConfigMapToSelectableFields
(
cfg
*
api
.
ConfigMap
)
fields
.
Set
{
return
generic
.
ObjectMetaFieldsSet
(
cfg
.
ObjectMeta
,
true
)
return
generic
.
ObjectMetaFieldsSet
(
&
cfg
.
ObjectMeta
,
true
)
}
}
// MatchConfigMap returns a generic matcher for a given label and field selector.
// MatchConfigMap returns a generic matcher for a given label and field selector.
...
...
pkg/registry/controller/strategy.go
View file @
b44b7169
...
@@ -110,7 +110,7 @@ func (rcStrategy) AllowUnconditionalUpdate() bool {
...
@@ -110,7 +110,7 @@ func (rcStrategy) AllowUnconditionalUpdate() bool {
// ControllerToSelectableFields returns a field set that represents the object.
// ControllerToSelectableFields returns a field set that represents the object.
func
ControllerToSelectableFields
(
controller
*
api
.
ReplicationController
)
fields
.
Set
{
func
ControllerToSelectableFields
(
controller
*
api
.
ReplicationController
)
fields
.
Set
{
objectMetaFieldsSet
:=
generic
.
ObjectMetaFieldsSet
(
controller
.
ObjectMeta
,
true
)
objectMetaFieldsSet
:=
generic
.
ObjectMetaFieldsSet
(
&
controller
.
ObjectMeta
,
true
)
controllerSpecificFieldsSet
:=
fields
.
Set
{
controllerSpecificFieldsSet
:=
fields
.
Set
{
"status.replicas"
:
strconv
.
Itoa
(
int
(
controller
.
Status
.
Replicas
)),
"status.replicas"
:
strconv
.
Itoa
(
int
(
controller
.
Status
.
Replicas
)),
}
}
...
...
pkg/registry/daemonset/strategy.go
View file @
b44b7169
...
@@ -106,7 +106,7 @@ func (daemonSetStrategy) AllowUnconditionalUpdate() bool {
...
@@ -106,7 +106,7 @@ func (daemonSetStrategy) AllowUnconditionalUpdate() bool {
// DaemonSetToSelectableFields returns a field set that represents the object.
// DaemonSetToSelectableFields returns a field set that represents the object.
func
DaemonSetToSelectableFields
(
daemon
*
extensions
.
DaemonSet
)
fields
.
Set
{
func
DaemonSetToSelectableFields
(
daemon
*
extensions
.
DaemonSet
)
fields
.
Set
{
return
generic
.
ObjectMetaFieldsSet
(
daemon
.
ObjectMeta
,
true
)
return
generic
.
ObjectMetaFieldsSet
(
&
daemon
.
ObjectMeta
,
true
)
}
}
// MatchSetDaemon is the filter used by the generic etcd backend to route
// MatchSetDaemon is the filter used by the generic etcd backend to route
...
...
pkg/registry/deployment/strategy.go
View file @
b44b7169
...
@@ -112,7 +112,7 @@ func (deploymentStatusStrategy) ValidateUpdate(ctx api.Context, obj, old runtime
...
@@ -112,7 +112,7 @@ func (deploymentStatusStrategy) ValidateUpdate(ctx api.Context, obj, old runtime
// DeploymentToSelectableFields returns a field set that represents the object.
// DeploymentToSelectableFields returns a field set that represents the object.
func
DeploymentToSelectableFields
(
deployment
*
extensions
.
Deployment
)
fields
.
Set
{
func
DeploymentToSelectableFields
(
deployment
*
extensions
.
Deployment
)
fields
.
Set
{
return
generic
.
ObjectMetaFieldsSet
(
deployment
.
ObjectMeta
,
true
)
return
generic
.
ObjectMetaFieldsSet
(
&
deployment
.
ObjectMeta
,
true
)
}
}
// MatchDeployment is the filter used by the generic etcd backend to route
// MatchDeployment is the filter used by the generic etcd backend to route
...
...
pkg/registry/endpoint/strategy.go
View file @
b44b7169
...
@@ -90,5 +90,5 @@ func EndpointsAttributes(obj runtime.Object) (objLabels labels.Set, objFields fi
...
@@ -90,5 +90,5 @@ func EndpointsAttributes(obj runtime.Object) (objLabels labels.Set, objFields fi
if
!
ok
{
if
!
ok
{
return
nil
,
nil
,
fmt
.
Errorf
(
"invalid object type %#v"
,
obj
)
return
nil
,
nil
,
fmt
.
Errorf
(
"invalid object type %#v"
,
obj
)
}
}
return
endpoints
.
Labels
,
generic
.
ObjectMetaFieldsSet
(
endpoints
.
ObjectMeta
,
true
),
nil
return
endpoints
.
Labels
,
generic
.
ObjectMetaFieldsSet
(
&
endpoints
.
ObjectMeta
,
true
),
nil
}
}
pkg/registry/event/strategy.go
View file @
b44b7169
...
@@ -20,7 +20,6 @@ import (
...
@@ -20,7 +20,6 @@ import (
"fmt"
"fmt"
"k8s.io/kubernetes/pkg/api"
"k8s.io/kubernetes/pkg/api"
"k8s.io/kubernetes/pkg/api/errors"
"k8s.io/kubernetes/pkg/api/validation"
"k8s.io/kubernetes/pkg/api/validation"
"k8s.io/kubernetes/pkg/fields"
"k8s.io/kubernetes/pkg/fields"
"k8s.io/kubernetes/pkg/labels"
"k8s.io/kubernetes/pkg/labels"
...
@@ -71,20 +70,22 @@ func (eventStrategy) AllowUnconditionalUpdate() bool {
...
@@ -71,20 +70,22 @@ func (eventStrategy) AllowUnconditionalUpdate() bool {
}
}
func
MatchEvent
(
label
labels
.
Selector
,
field
fields
.
Selector
)
*
generic
.
SelectionPredicate
{
func
MatchEvent
(
label
labels
.
Selector
,
field
fields
.
Selector
)
*
generic
.
SelectionPredicate
{
return
&
generic
.
SelectionPredicate
{
Label
:
label
,
Field
:
field
,
GetAttrs
:
getAttrs
}
return
&
generic
.
SelectionPredicate
{
}
Label
:
label
,
Field
:
field
,
func
getAttrs
(
obj
runtime
.
Object
)
(
objLabels
labels
.
Set
,
objFields
fields
.
Set
,
err
error
)
{
GetAttrs
:
func
(
obj
runtime
.
Object
)
(
labels
.
Set
,
fields
.
Set
,
error
)
{
event
,
ok
:=
obj
.
(
*
api
.
Event
)
event
,
ok
:=
obj
.
(
*
api
.
Event
)
if
!
ok
{
if
!
ok
{
return
nil
,
nil
,
errors
.
NewInternalError
(
fmt
.
Errorf
(
"object is not of type event: %#v"
,
obj
))
return
nil
,
nil
,
fmt
.
Errorf
(
"not an event"
)
}
}
l
:=
event
.
Labels
return
labels
.
Set
(
event
.
Labels
),
EventToSelectableFields
(
event
),
nil
if
l
==
nil
{
},
l
=
labels
.
Set
{}
}
}
}
objectMetaFieldsSet
:=
generic
.
ObjectMetaFieldsSet
(
event
.
ObjectMeta
,
true
)
// EventToSelectableFields returns a field set that represents the object
func
EventToSelectableFields
(
event
*
api
.
Event
)
fields
.
Set
{
objectMetaFieldsSet
:=
generic
.
ObjectMetaFieldsSet
(
&
event
.
ObjectMeta
,
true
)
specificFieldsSet
:=
fields
.
Set
{
specificFieldsSet
:=
fields
.
Set
{
"involvedObject.kind"
:
event
.
InvolvedObject
.
Kind
,
"involvedObject.kind"
:
event
.
InvolvedObject
.
Kind
,
"involvedObject.namespace"
:
event
.
InvolvedObject
.
Namespace
,
"involvedObject.namespace"
:
event
.
InvolvedObject
.
Namespace
,
...
@@ -97,5 +98,5 @@ func getAttrs(obj runtime.Object) (objLabels labels.Set, objFields fields.Set, e
...
@@ -97,5 +98,5 @@ func getAttrs(obj runtime.Object) (objLabels labels.Set, objFields fields.Set, e
"source"
:
event
.
Source
.
Component
,
"source"
:
event
.
Source
.
Component
,
"type"
:
event
.
Type
,
"type"
:
event
.
Type
,
}
}
return
l
,
generic
.
MergeFieldsSets
(
objectMetaFieldsSet
,
specificFieldsSet
),
nil
return
generic
.
MergeFieldsSets
(
objectMetaFieldsSet
,
specificFieldsSet
)
}
}
pkg/registry/event/strategy_test.go
View file @
b44b7169
...
@@ -24,7 +24,6 @@ import (
...
@@ -24,7 +24,6 @@ import (
"k8s.io/kubernetes/pkg/api/testapi"
"k8s.io/kubernetes/pkg/api/testapi"
apitesting
"k8s.io/kubernetes/pkg/api/testing"
apitesting
"k8s.io/kubernetes/pkg/api/testing"
"k8s.io/kubernetes/pkg/fields"
"k8s.io/kubernetes/pkg/fields"
"k8s.io/kubernetes/pkg/labels"
"k8s.io/kubernetes/pkg/util/diff"
"k8s.io/kubernetes/pkg/util/diff"
)
)
...
@@ -60,13 +59,7 @@ func TestGetAttrs(t *testing.T) {
...
@@ -60,13 +59,7 @@ func TestGetAttrs(t *testing.T) {
Source
:
api
.
EventSource
{
Component
:
"test"
},
Source
:
api
.
EventSource
{
Component
:
"test"
},
Type
:
api
.
EventTypeNormal
,
Type
:
api
.
EventTypeNormal
,
}
}
label
,
field
,
err
:=
getAttrs
(
eventA
)
field
:=
EventToSelectableFields
(
eventA
)
if
err
!=
nil
{
t
.
Fatalf
(
"Unexpected error %v"
,
err
)
}
if
e
,
a
:=
label
,
(
labels
.
Set
{});
!
reflect
.
DeepEqual
(
e
,
a
)
{
t
.
Errorf
(
"diff: %s"
,
diff
.
ObjectDiff
(
e
,
a
))
}
expect
:=
fields
.
Set
{
expect
:=
fields
.
Set
{
"metadata.name"
:
"f0118"
,
"metadata.name"
:
"f0118"
,
"metadata.namespace"
:
"default"
,
"metadata.namespace"
:
"default"
,
...
@@ -87,10 +80,7 @@ func TestGetAttrs(t *testing.T) {
...
@@ -87,10 +80,7 @@ func TestGetAttrs(t *testing.T) {
}
}
func
TestSelectableFieldLabelConversions
(
t
*
testing
.
T
)
{
func
TestSelectableFieldLabelConversions
(
t
*
testing
.
T
)
{
_
,
fset
,
err
:=
getAttrs
(
&
api
.
Event
{})
fset
:=
EventToSelectableFields
(
&
api
.
Event
{})
if
err
!=
nil
{
t
.
Fatalf
(
"Unexpected error %v"
,
err
)
}
apitesting
.
TestSelectableFieldLabelConversionsOfKind
(
t
,
apitesting
.
TestSelectableFieldLabelConversionsOfKind
(
t
,
testapi
.
Default
.
GroupVersion
()
.
String
(),
testapi
.
Default
.
GroupVersion
()
.
String
(),
"Event"
,
"Event"
,
...
...
pkg/registry/generic/matcher.go
View file @
b44b7169
...
@@ -27,8 +27,8 @@ import (
...
@@ -27,8 +27,8 @@ import (
// AttrFunc returns label and field sets for List or Watch to compare against, or an error.
// AttrFunc returns label and field sets for List or Watch to compare against, or an error.
type
AttrFunc
func
(
obj
runtime
.
Object
)
(
label
labels
.
Set
,
field
fields
.
Set
,
err
error
)
type
AttrFunc
func
(
obj
runtime
.
Object
)
(
label
labels
.
Set
,
field
fields
.
Set
,
err
error
)
// ObjectMetaFieldsSet returns a fields
set
that represents the ObjectMeta.
// ObjectMetaFieldsSet returns a fields that represents the ObjectMeta.
func
ObjectMetaFieldsSet
(
objectMeta
api
.
ObjectMeta
,
hasNamespaceField
bool
)
fields
.
Set
{
func
ObjectMetaFieldsSet
(
objectMeta
*
api
.
ObjectMeta
,
hasNamespaceField
bool
)
fields
.
Set
{
if
!
hasNamespaceField
{
if
!
hasNamespaceField
{
return
fields
.
Set
{
return
fields
.
Set
{
"metadata.name"
:
objectMeta
.
Name
,
"metadata.name"
:
objectMeta
.
Name
,
...
...
pkg/registry/generic/registry/store_test.go
View file @
b44b7169
...
@@ -1142,7 +1142,7 @@ func newTestGenericStoreRegistry(t *testing.T, hasCacheEnabled bool) (*etcdtesti
...
@@ -1142,7 +1142,7 @@ func newTestGenericStoreRegistry(t *testing.T, hasCacheEnabled bool) (*etcdtesti
if
!
ok
{
if
!
ok
{
return
nil
,
nil
,
fmt
.
Errorf
(
"not a pod"
)
return
nil
,
nil
,
fmt
.
Errorf
(
"not a pod"
)
}
}
return
labels
.
Set
(
pod
.
ObjectMeta
.
Labels
),
generic
.
ObjectMetaFieldsSet
(
pod
.
ObjectMeta
,
true
),
nil
return
labels
.
Set
(
pod
.
ObjectMeta
.
Labels
),
generic
.
ObjectMetaFieldsSet
(
&
pod
.
ObjectMeta
,
true
),
nil
},
},
}
}
},
},
...
...
pkg/registry/ingress/strategy.go
View file @
b44b7169
...
@@ -99,7 +99,7 @@ func (ingressStrategy) AllowUnconditionalUpdate() bool {
...
@@ -99,7 +99,7 @@ func (ingressStrategy) AllowUnconditionalUpdate() bool {
// IngressToSelectableFields returns a field set that represents the object.
// IngressToSelectableFields returns a field set that represents the object.
func
IngressToSelectableFields
(
ingress
*
extensions
.
Ingress
)
fields
.
Set
{
func
IngressToSelectableFields
(
ingress
*
extensions
.
Ingress
)
fields
.
Set
{
return
generic
.
ObjectMetaFieldsSet
(
ingress
.
ObjectMeta
,
true
)
return
generic
.
ObjectMetaFieldsSet
(
&
ingress
.
ObjectMeta
,
true
)
}
}
// MatchIngress is the filter used by the generic etcd backend to ingress
// MatchIngress is the filter used by the generic etcd backend to ingress
...
...
pkg/registry/job/strategy.go
View file @
b44b7169
...
@@ -156,7 +156,7 @@ func (jobStatusStrategy) ValidateUpdate(ctx api.Context, obj, old runtime.Object
...
@@ -156,7 +156,7 @@ func (jobStatusStrategy) ValidateUpdate(ctx api.Context, obj, old runtime.Object
// JobSelectableFields returns a field set that represents the object for matching purposes.
// JobSelectableFields returns a field set that represents the object for matching purposes.
func
JobToSelectableFields
(
job
*
batch
.
Job
)
fields
.
Set
{
func
JobToSelectableFields
(
job
*
batch
.
Job
)
fields
.
Set
{
objectMetaFieldsSet
:=
generic
.
ObjectMetaFieldsSet
(
job
.
ObjectMeta
,
true
)
objectMetaFieldsSet
:=
generic
.
ObjectMetaFieldsSet
(
&
job
.
ObjectMeta
,
true
)
specificFieldsSet
:=
fields
.
Set
{
specificFieldsSet
:=
fields
.
Set
{
"status.successful"
:
strconv
.
Itoa
(
int
(
job
.
Status
.
Succeeded
)),
"status.successful"
:
strconv
.
Itoa
(
int
(
job
.
Status
.
Succeeded
)),
}
}
...
...
pkg/registry/namespace/strategy.go
View file @
b44b7169
...
@@ -151,7 +151,7 @@ func MatchNamespace(label labels.Selector, field fields.Selector) *generic.Selec
...
@@ -151,7 +151,7 @@ func MatchNamespace(label labels.Selector, field fields.Selector) *generic.Selec
// NamespaceToSelectableFields returns a field set that represents the object
// NamespaceToSelectableFields returns a field set that represents the object
func
NamespaceToSelectableFields
(
namespace
*
api
.
Namespace
)
fields
.
Set
{
func
NamespaceToSelectableFields
(
namespace
*
api
.
Namespace
)
fields
.
Set
{
objectMetaFieldsSet
:=
generic
.
ObjectMetaFieldsSet
(
namespace
.
ObjectMeta
,
false
)
objectMetaFieldsSet
:=
generic
.
ObjectMetaFieldsSet
(
&
namespace
.
ObjectMeta
,
false
)
specificFieldsSet
:=
fields
.
Set
{
specificFieldsSet
:=
fields
.
Set
{
"status.phase"
:
string
(
namespace
.
Status
.
Phase
),
"status.phase"
:
string
(
namespace
.
Status
.
Phase
),
// This is a bug, but we need to support it for backward compatibility.
// This is a bug, but we need to support it for backward compatibility.
...
...
pkg/registry/networkpolicy/strategy.go
View file @
b44b7169
...
@@ -92,7 +92,7 @@ func (networkPolicyStrategy) AllowUnconditionalUpdate() bool {
...
@@ -92,7 +92,7 @@ func (networkPolicyStrategy) AllowUnconditionalUpdate() bool {
// NetworkPolicyToSelectableFields returns a field set that represents the object.
// NetworkPolicyToSelectableFields returns a field set that represents the object.
func
NetworkPolicyToSelectableFields
(
networkPolicy
*
extensions
.
NetworkPolicy
)
fields
.
Set
{
func
NetworkPolicyToSelectableFields
(
networkPolicy
*
extensions
.
NetworkPolicy
)
fields
.
Set
{
return
generic
.
ObjectMetaFieldsSet
(
networkPolicy
.
ObjectMeta
,
true
)
return
generic
.
ObjectMetaFieldsSet
(
&
networkPolicy
.
ObjectMeta
,
true
)
}
}
// MatchNetworkPolicy is the filter used by the generic etcd backend to watch events
// MatchNetworkPolicy is the filter used by the generic etcd backend to watch events
...
...
pkg/registry/node/strategy.go
View file @
b44b7169
...
@@ -139,7 +139,7 @@ type ResourceGetter interface {
...
@@ -139,7 +139,7 @@ type ResourceGetter interface {
// NodeToSelectableFields returns a field set that represents the object.
// NodeToSelectableFields returns a field set that represents the object.
func
NodeToSelectableFields
(
node
*
api
.
Node
)
fields
.
Set
{
func
NodeToSelectableFields
(
node
*
api
.
Node
)
fields
.
Set
{
objectMetaFieldsSet
:=
generic
.
ObjectMetaFieldsSet
(
node
.
ObjectMeta
,
false
)
objectMetaFieldsSet
:=
generic
.
ObjectMetaFieldsSet
(
&
node
.
ObjectMeta
,
false
)
specificFieldsSet
:=
fields
.
Set
{
specificFieldsSet
:=
fields
.
Set
{
"spec.unschedulable"
:
fmt
.
Sprint
(
node
.
Spec
.
Unschedulable
),
"spec.unschedulable"
:
fmt
.
Sprint
(
node
.
Spec
.
Unschedulable
),
}
}
...
...
pkg/registry/persistentvolume/strategy.go
View file @
b44b7169
...
@@ -111,7 +111,7 @@ func MatchPersistentVolumes(label labels.Selector, field fields.Selector) *gener
...
@@ -111,7 +111,7 @@ func MatchPersistentVolumes(label labels.Selector, field fields.Selector) *gener
// PersistentVolumeToSelectableFields returns a field set that represents the object
// PersistentVolumeToSelectableFields returns a field set that represents the object
func
PersistentVolumeToSelectableFields
(
persistentvolume
*
api
.
PersistentVolume
)
fields
.
Set
{
func
PersistentVolumeToSelectableFields
(
persistentvolume
*
api
.
PersistentVolume
)
fields
.
Set
{
objectMetaFieldsSet
:=
generic
.
ObjectMetaFieldsSet
(
persistentvolume
.
ObjectMeta
,
false
)
objectMetaFieldsSet
:=
generic
.
ObjectMetaFieldsSet
(
&
persistentvolume
.
ObjectMeta
,
false
)
specificFieldsSet
:=
fields
.
Set
{
specificFieldsSet
:=
fields
.
Set
{
// This is a bug, but we need to support it for backward compatibility.
// This is a bug, but we need to support it for backward compatibility.
"name"
:
persistentvolume
.
Name
,
"name"
:
persistentvolume
.
Name
,
...
...
pkg/registry/persistentvolumeclaim/strategy.go
View file @
b44b7169
...
@@ -111,7 +111,7 @@ func MatchPersistentVolumeClaim(label labels.Selector, field fields.Selector) *g
...
@@ -111,7 +111,7 @@ func MatchPersistentVolumeClaim(label labels.Selector, field fields.Selector) *g
// PersistentVolumeClaimToSelectableFields returns a field set that represents the object
// PersistentVolumeClaimToSelectableFields returns a field set that represents the object
func
PersistentVolumeClaimToSelectableFields
(
persistentvolumeclaim
*
api
.
PersistentVolumeClaim
)
fields
.
Set
{
func
PersistentVolumeClaimToSelectableFields
(
persistentvolumeclaim
*
api
.
PersistentVolumeClaim
)
fields
.
Set
{
objectMetaFieldsSet
:=
generic
.
ObjectMetaFieldsSet
(
persistentvolumeclaim
.
ObjectMeta
,
true
)
objectMetaFieldsSet
:=
generic
.
ObjectMetaFieldsSet
(
&
persistentvolumeclaim
.
ObjectMeta
,
true
)
specificFieldsSet
:=
fields
.
Set
{
specificFieldsSet
:=
fields
.
Set
{
// This is a bug, but we need to support it for backward compatibility.
// This is a bug, but we need to support it for backward compatibility.
"name"
:
persistentvolumeclaim
.
Name
,
"name"
:
persistentvolumeclaim
.
Name
,
...
...
pkg/registry/petset/strategy.go
View file @
b44b7169
...
@@ -98,7 +98,7 @@ func (petSetStrategy) AllowUnconditionalUpdate() bool {
...
@@ -98,7 +98,7 @@ func (petSetStrategy) AllowUnconditionalUpdate() bool {
// PetSetToSelectableFields returns a field set that represents the object.
// PetSetToSelectableFields returns a field set that represents the object.
func
PetSetToSelectableFields
(
petSet
*
apps
.
PetSet
)
fields
.
Set
{
func
PetSetToSelectableFields
(
petSet
*
apps
.
PetSet
)
fields
.
Set
{
return
generic
.
ObjectMetaFieldsSet
(
petSet
.
ObjectMeta
,
true
)
return
generic
.
ObjectMetaFieldsSet
(
&
petSet
.
ObjectMeta
,
true
)
}
}
// MatchPetSet is the filter used by the generic etcd backend to watch events
// MatchPetSet is the filter used by the generic etcd backend to watch events
...
...
pkg/registry/pod/strategy.go
View file @
b44b7169
...
@@ -191,7 +191,7 @@ func NodeNameTriggerFunc(obj runtime.Object) []storage.MatchValue {
...
@@ -191,7 +191,7 @@ func NodeNameTriggerFunc(obj runtime.Object) []storage.MatchValue {
// PodToSelectableFields returns a field set that represents the object
// PodToSelectableFields returns a field set that represents the object
// TODO: fields are not labels, and the validation rules for them do not apply.
// TODO: fields are not labels, and the validation rules for them do not apply.
func
PodToSelectableFields
(
pod
*
api
.
Pod
)
fields
.
Set
{
func
PodToSelectableFields
(
pod
*
api
.
Pod
)
fields
.
Set
{
objectMetaFieldsSet
:=
generic
.
ObjectMetaFieldsSet
(
pod
.
ObjectMeta
,
true
)
objectMetaFieldsSet
:=
generic
.
ObjectMetaFieldsSet
(
&
pod
.
ObjectMeta
,
true
)
podSpecificFieldsSet
:=
fields
.
Set
{
podSpecificFieldsSet
:=
fields
.
Set
{
"spec.nodeName"
:
pod
.
Spec
.
NodeName
,
"spec.nodeName"
:
pod
.
Spec
.
NodeName
,
"spec.restartPolicy"
:
string
(
pod
.
Spec
.
RestartPolicy
),
"spec.restartPolicy"
:
string
(
pod
.
Spec
.
RestartPolicy
),
...
...
pkg/registry/poddisruptionbudget/strategy.go
View file @
b44b7169
...
@@ -97,7 +97,7 @@ func (podDisruptionBudgetStrategy) AllowUnconditionalUpdate() bool {
...
@@ -97,7 +97,7 @@ func (podDisruptionBudgetStrategy) AllowUnconditionalUpdate() bool {
// PodDisruptionBudgetToSelectableFields returns a field set that represents the object.
// PodDisruptionBudgetToSelectableFields returns a field set that represents the object.
func
PodDisruptionBudgetToSelectableFields
(
podDisruptionBudget
*
policy
.
PodDisruptionBudget
)
fields
.
Set
{
func
PodDisruptionBudgetToSelectableFields
(
podDisruptionBudget
*
policy
.
PodDisruptionBudget
)
fields
.
Set
{
return
generic
.
ObjectMetaFieldsSet
(
podDisruptionBudget
.
ObjectMeta
,
true
)
return
generic
.
ObjectMetaFieldsSet
(
&
podDisruptionBudget
.
ObjectMeta
,
true
)
}
}
// MatchPodDisruptionBudget is the filter used by the generic etcd backend to watch events
// MatchPodDisruptionBudget is the filter used by the generic etcd backend to watch events
...
...
pkg/registry/podsecuritypolicy/strategy.go
View file @
b44b7169
...
@@ -90,5 +90,5 @@ func MatchPodSecurityPolicy(label labels.Selector, field fields.Selector) *gener
...
@@ -90,5 +90,5 @@ func MatchPodSecurityPolicy(label labels.Selector, field fields.Selector) *gener
// PodSecurityPolicyToSelectableFields returns a label set that represents the object
// PodSecurityPolicyToSelectableFields returns a label set that represents the object
func
PodSecurityPolicyToSelectableFields
(
obj
*
extensions
.
PodSecurityPolicy
)
fields
.
Set
{
func
PodSecurityPolicyToSelectableFields
(
obj
*
extensions
.
PodSecurityPolicy
)
fields
.
Set
{
return
generic
.
ObjectMetaFieldsSet
(
obj
.
ObjectMeta
,
false
)
return
generic
.
ObjectMetaFieldsSet
(
&
obj
.
ObjectMeta
,
false
)
}
}
pkg/registry/replicaset/strategy.go
View file @
b44b7169
...
@@ -111,7 +111,7 @@ func (rsStrategy) AllowUnconditionalUpdate() bool {
...
@@ -111,7 +111,7 @@ func (rsStrategy) AllowUnconditionalUpdate() bool {
// ReplicaSetToSelectableFields returns a field set that represents the object.
// ReplicaSetToSelectableFields returns a field set that represents the object.
func
ReplicaSetToSelectableFields
(
rs
*
extensions
.
ReplicaSet
)
fields
.
Set
{
func
ReplicaSetToSelectableFields
(
rs
*
extensions
.
ReplicaSet
)
fields
.
Set
{
objectMetaFieldsSet
:=
generic
.
ObjectMetaFieldsSet
(
rs
.
ObjectMeta
,
true
)
objectMetaFieldsSet
:=
generic
.
ObjectMetaFieldsSet
(
&
rs
.
ObjectMeta
,
true
)
rsSpecificFieldsSet
:=
fields
.
Set
{
rsSpecificFieldsSet
:=
fields
.
Set
{
"status.replicas"
:
strconv
.
Itoa
(
int
(
rs
.
Status
.
Replicas
)),
"status.replicas"
:
strconv
.
Itoa
(
int
(
rs
.
Status
.
Replicas
)),
}
}
...
...
pkg/registry/resourcequota/strategy.go
View file @
b44b7169
...
@@ -114,5 +114,5 @@ func MatchResourceQuota(label labels.Selector, field fields.Selector) *generic.S
...
@@ -114,5 +114,5 @@ func MatchResourceQuota(label labels.Selector, field fields.Selector) *generic.S
// ResourceQuotaToSelectableFields returns a field set that represents the object
// ResourceQuotaToSelectableFields returns a field set that represents the object
func
ResourceQuotaToSelectableFields
(
resourcequota
*
api
.
ResourceQuota
)
fields
.
Set
{
func
ResourceQuotaToSelectableFields
(
resourcequota
*
api
.
ResourceQuota
)
fields
.
Set
{
return
generic
.
ObjectMetaFieldsSet
(
resourcequota
.
ObjectMeta
,
true
)
return
generic
.
ObjectMetaFieldsSet
(
&
resourcequota
.
ObjectMeta
,
true
)
}
}
pkg/registry/scheduledjob/strategy.go
View file @
b44b7169
...
@@ -98,7 +98,7 @@ func (scheduledJobStatusStrategy) ValidateUpdate(ctx api.Context, obj, old runti
...
@@ -98,7 +98,7 @@ func (scheduledJobStatusStrategy) ValidateUpdate(ctx api.Context, obj, old runti
// ScheduledJobToSelectableFields returns a field set that represents the object for matching purposes.
// ScheduledJobToSelectableFields returns a field set that represents the object for matching purposes.
func
ScheduledJobToSelectableFields
(
scheduledJob
*
batch
.
ScheduledJob
)
fields
.
Set
{
func
ScheduledJobToSelectableFields
(
scheduledJob
*
batch
.
ScheduledJob
)
fields
.
Set
{
return
generic
.
ObjectMetaFieldsSet
(
scheduledJob
.
ObjectMeta
,
true
)
return
generic
.
ObjectMetaFieldsSet
(
&
scheduledJob
.
ObjectMeta
,
true
)
}
}
// MatchScheduledJob is the filter used by the generic etcd backend to route
// MatchScheduledJob is the filter used by the generic etcd backend to route
...
...
pkg/registry/secret/strategy.go
View file @
b44b7169
...
@@ -110,7 +110,7 @@ func Matcher(label labels.Selector, field fields.Selector) *generic.SelectionPre
...
@@ -110,7 +110,7 @@ func Matcher(label labels.Selector, field fields.Selector) *generic.SelectionPre
// SelectableFields returns a field set that can be used for filter selection
// SelectableFields returns a field set that can be used for filter selection
func
SelectableFields
(
obj
*
api
.
Secret
)
fields
.
Set
{
func
SelectableFields
(
obj
*
api
.
Secret
)
fields
.
Set
{
objectMetaFieldsSet
:=
generic
.
ObjectMetaFieldsSet
(
obj
.
ObjectMeta
,
true
)
objectMetaFieldsSet
:=
generic
.
ObjectMetaFieldsSet
(
&
obj
.
ObjectMeta
,
true
)
secretSpecificFieldsSet
:=
fields
.
Set
{
secretSpecificFieldsSet
:=
fields
.
Set
{
"type"
:
string
(
obj
.
Type
),
"type"
:
string
(
obj
.
Type
),
}
}
...
...
pkg/registry/service/strategy.go
View file @
b44b7169
...
@@ -115,7 +115,7 @@ func MatchServices(label labels.Selector, field fields.Selector) *generic.Select
...
@@ -115,7 +115,7 @@ func MatchServices(label labels.Selector, field fields.Selector) *generic.Select
}
}
func
ServiceToSelectableFields
(
service
*
api
.
Service
)
fields
.
Set
{
func
ServiceToSelectableFields
(
service
*
api
.
Service
)
fields
.
Set
{
return
generic
.
ObjectMetaFieldsSet
(
service
.
ObjectMeta
,
true
)
return
generic
.
ObjectMetaFieldsSet
(
&
service
.
ObjectMeta
,
true
)
}
}
type
serviceStatusStrategy
struct
{
type
serviceStatusStrategy
struct
{
...
...
pkg/registry/serviceaccount/strategy.go
View file @
b44b7169
...
@@ -93,5 +93,5 @@ func Matcher(label labels.Selector, field fields.Selector) *generic.SelectionPre
...
@@ -93,5 +93,5 @@ func Matcher(label labels.Selector, field fields.Selector) *generic.SelectionPre
// SelectableFields returns a field set that represents the object
// SelectableFields returns a field set that represents the object
func
SelectableFields
(
obj
*
api
.
ServiceAccount
)
fields
.
Set
{
func
SelectableFields
(
obj
*
api
.
ServiceAccount
)
fields
.
Set
{
return
generic
.
ObjectMetaFieldsSet
(
obj
.
ObjectMeta
,
true
)
return
generic
.
ObjectMetaFieldsSet
(
&
obj
.
ObjectMeta
,
true
)
}
}
pkg/registry/storageclass/strategy.go
View file @
b44b7169
...
@@ -94,5 +94,5 @@ func MatchStorageClasses(label labels.Selector, field fields.Selector) *generic.
...
@@ -94,5 +94,5 @@ func MatchStorageClasses(label labels.Selector, field fields.Selector) *generic.
// StorageClassToSelectableFields returns a label set that represents the object
// StorageClassToSelectableFields returns a label set that represents the object
func
StorageClassToSelectableFields
(
storageClass
*
extensions
.
StorageClass
)
fields
.
Set
{
func
StorageClassToSelectableFields
(
storageClass
*
extensions
.
StorageClass
)
fields
.
Set
{
return
generic
.
ObjectMetaFieldsSet
(
storageClass
.
ObjectMeta
,
false
)
return
generic
.
ObjectMetaFieldsSet
(
&
storageClass
.
ObjectMeta
,
false
)
}
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment