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
726def04
Commit
726def04
authored
Oct 31, 2015
by
feihujiang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Make rootscoped resource no namespace selectable field
parent
c31a2222
Hide whitespace changes
Inline
Side-by-side
Showing
15 changed files
with
22 additions
and
16 deletions
+22
-16
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
+1
-1
matcher.go
pkg/registry/generic/matcher.go
+6
-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/node/strategy.go
+3
-2
strategy.go
pkg/registry/persistentvolume/strategy.go
+1
-1
strategy.go
pkg/registry/persistentvolumeclaim/strategy.go
+1
-1
strategy.go
pkg/registry/pod/strategy.go
+1
-1
strategy.go
pkg/registry/resourcequota/strategy.go
+1
-1
strategy.go
pkg/registry/serviceaccount/strategy.go
+1
-1
No files found.
pkg/registry/controller/strategy.go
View file @
726def04
...
@@ -100,7 +100,7 @@ func (rcStrategy) AllowUnconditionalUpdate() bool {
...
@@ -100,7 +100,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
)
objectMetaFieldsSet
:=
generic
.
ObjectMetaFieldsSet
(
controller
.
ObjectMeta
,
true
)
controllerSpecificFieldsSet
:=
fields
.
Set
{
controllerSpecificFieldsSet
:=
fields
.
Set
{
"status.replicas"
:
strconv
.
Itoa
(
controller
.
Status
.
Replicas
),
"status.replicas"
:
strconv
.
Itoa
(
controller
.
Status
.
Replicas
),
}
}
...
...
pkg/registry/daemonset/strategy.go
View file @
726def04
...
@@ -102,7 +102,7 @@ func (daemonSetStrategy) AllowUnconditionalUpdate() bool {
...
@@ -102,7 +102,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
)
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 @
726def04
...
@@ -97,7 +97,7 @@ func (deploymentStatusStrategy) ValidateUpdate(ctx api.Context, obj, old runtime
...
@@ -97,7 +97,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
)
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 @
726def04
...
@@ -89,5 +89,5 @@ func EndpointsAttributes(obj runtime.Object) (objLabels labels.Set, objFields fi
...
@@ -89,5 +89,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
),
nil
return
endpoints
.
Labels
,
generic
.
ObjectMetaFieldsSet
(
endpoints
.
ObjectMeta
,
true
),
nil
}
}
pkg/registry/event/strategy.go
View file @
726def04
...
@@ -80,7 +80,7 @@ func getAttrs(obj runtime.Object) (objLabels labels.Set, objFields fields.Set, e
...
@@ -80,7 +80,7 @@ func getAttrs(obj runtime.Object) (objLabels labels.Set, objFields fields.Set, e
l
=
labels
.
Set
{}
l
=
labels
.
Set
{}
}
}
objectMetaFieldsSet
:=
generic
.
ObjectMetaFieldsSet
(
event
.
ObjectMeta
)
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
,
...
...
pkg/registry/generic/matcher.go
View file @
726def04
...
@@ -27,7 +27,12 @@ import (
...
@@ -27,7 +27,12 @@ import (
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 set that represents the ObjectMeta.
func
ObjectMetaFieldsSet
(
objectMeta
api
.
ObjectMeta
)
fields
.
Set
{
func
ObjectMetaFieldsSet
(
objectMeta
api
.
ObjectMeta
,
hasNamespaceField
bool
)
fields
.
Set
{
if
!
hasNamespaceField
{
return
fields
.
Set
{
"metadata.name"
:
objectMeta
.
Name
,
}
}
return
fields
.
Set
{
return
fields
.
Set
{
"metadata.name"
:
objectMeta
.
Name
,
"metadata.name"
:
objectMeta
.
Name
,
"metadata.namespace"
:
objectMeta
.
Namespace
,
"metadata.namespace"
:
objectMeta
.
Namespace
,
...
...
pkg/registry/ingress/strategy.go
View file @
726def04
...
@@ -95,7 +95,7 @@ func (ingressStrategy) AllowUnconditionalUpdate() bool {
...
@@ -95,7 +95,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
)
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 @
726def04
...
@@ -97,7 +97,7 @@ func (jobStatusStrategy) ValidateUpdate(ctx api.Context, obj, old runtime.Object
...
@@ -97,7 +97,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
*
extensions
.
Job
)
fields
.
Set
{
func
JobToSelectableFields
(
job
*
extensions
.
Job
)
fields
.
Set
{
objectMetaFieldsSet
:=
generic
.
ObjectMetaFieldsSet
(
job
.
ObjectMeta
)
objectMetaFieldsSet
:=
generic
.
ObjectMetaFieldsSet
(
job
.
ObjectMeta
,
true
)
specificFieldsSet
:=
fields
.
Set
{
specificFieldsSet
:=
fields
.
Set
{
"status.successful"
:
strconv
.
Itoa
(
job
.
Status
.
Succeeded
),
"status.successful"
:
strconv
.
Itoa
(
job
.
Status
.
Succeeded
),
}
}
...
...
pkg/registry/namespace/strategy.go
View file @
726def04
...
@@ -144,7 +144,7 @@ func MatchNamespace(label labels.Selector, field fields.Selector) generic.Matche
...
@@ -144,7 +144,7 @@ func MatchNamespace(label labels.Selector, field fields.Selector) generic.Matche
// NamespaceToSelectableFields returns a label set that represents the object
// NamespaceToSelectableFields returns a label set that represents the object
func
NamespaceToSelectableFields
(
namespace
*
api
.
Namespace
)
labels
.
Set
{
func
NamespaceToSelectableFields
(
namespace
*
api
.
Namespace
)
labels
.
Set
{
objectMetaFieldsSet
:=
generic
.
ObjectMetaFieldsSet
(
namespace
.
ObjectMeta
)
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/node/strategy.go
View file @
726def04
...
@@ -114,10 +114,11 @@ type ResourceGetter interface {
...
@@ -114,10 +114,11 @@ type ResourceGetter interface {
// NodeToSelectableFields returns a label set that represents the object.
// NodeToSelectableFields returns a label set that represents the object.
func
NodeToSelectableFields
(
node
*
api
.
Node
)
fields
.
Set
{
func
NodeToSelectableFields
(
node
*
api
.
Node
)
fields
.
Set
{
return
fields
.
Set
{
objectMetaFieldsSet
:=
generic
.
ObjectMetaFieldsSet
(
node
.
ObjectMeta
,
false
)
"metadata.name"
:
node
.
Name
,
specificFieldsSet
:=
fields
.
Set
{
"spec.unschedulable"
:
fmt
.
Sprint
(
node
.
Spec
.
Unschedulable
),
"spec.unschedulable"
:
fmt
.
Sprint
(
node
.
Spec
.
Unschedulable
),
}
}
return
generic
.
MergeFieldsSets
(
objectMetaFieldsSet
,
specificFieldsSet
)
}
}
// MatchNode returns a generic matcher for a given label and field selector.
// MatchNode returns a generic matcher for a given label and field selector.
...
...
pkg/registry/persistentvolume/strategy.go
View file @
726def04
...
@@ -104,7 +104,7 @@ func MatchPersistentVolumes(label labels.Selector, field fields.Selector) generi
...
@@ -104,7 +104,7 @@ func MatchPersistentVolumes(label labels.Selector, field fields.Selector) generi
// PersistentVolumeToSelectableFields returns a label set that represents the object
// PersistentVolumeToSelectableFields returns a label set that represents the object
func
PersistentVolumeToSelectableFields
(
persistentvolume
*
api
.
PersistentVolume
)
labels
.
Set
{
func
PersistentVolumeToSelectableFields
(
persistentvolume
*
api
.
PersistentVolume
)
labels
.
Set
{
objectMetaFieldsSet
:=
generic
.
ObjectMetaFieldsSet
(
persistentvolume
.
ObjectMeta
)
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 @
726def04
...
@@ -104,7 +104,7 @@ func MatchPersistentVolumeClaim(label labels.Selector, field fields.Selector) ge
...
@@ -104,7 +104,7 @@ func MatchPersistentVolumeClaim(label labels.Selector, field fields.Selector) ge
// PersistentVolumeClaimToSelectableFields returns a label set that represents the object
// PersistentVolumeClaimToSelectableFields returns a label set that represents the object
func
PersistentVolumeClaimToSelectableFields
(
persistentvolumeclaim
*
api
.
PersistentVolumeClaim
)
labels
.
Set
{
func
PersistentVolumeClaimToSelectableFields
(
persistentvolumeclaim
*
api
.
PersistentVolumeClaim
)
labels
.
Set
{
objectMetaFieldsSet
:=
generic
.
ObjectMetaFieldsSet
(
persistentvolumeclaim
.
ObjectMeta
)
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/pod/strategy.go
View file @
726def04
...
@@ -166,7 +166,7 @@ func MatchPod(label labels.Selector, field fields.Selector) generic.Matcher {
...
@@ -166,7 +166,7 @@ func MatchPod(label labels.Selector, field fields.Selector) generic.Matcher {
// 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
)
objectMetaFieldsSet
:=
generic
.
ObjectMetaFieldsSet
(
pod
.
ObjectMeta
,
true
)
podSpecificFieldsSet
:=
fields
.
Set
{
podSpecificFieldsSet
:=
fields
.
Set
{
"spec.nodeName"
:
pod
.
Spec
.
NodeName
,
"spec.nodeName"
:
pod
.
Spec
.
NodeName
,
"status.phase"
:
string
(
pod
.
Status
.
Phase
),
"status.phase"
:
string
(
pod
.
Status
.
Phase
),
...
...
pkg/registry/resourcequota/strategy.go
View file @
726def04
...
@@ -107,5 +107,5 @@ func MatchResourceQuota(label labels.Selector, field fields.Selector) generic.Ma
...
@@ -107,5 +107,5 @@ func MatchResourceQuota(label labels.Selector, field fields.Selector) generic.Ma
// ResourceQuotaToSelectableFields returns a label set that represents the object
// ResourceQuotaToSelectableFields returns a label set that represents the object
func
ResourceQuotaToSelectableFields
(
resourcequota
*
api
.
ResourceQuota
)
labels
.
Set
{
func
ResourceQuotaToSelectableFields
(
resourcequota
*
api
.
ResourceQuota
)
labels
.
Set
{
return
labels
.
Set
(
generic
.
ObjectMetaFieldsSet
(
resourcequota
.
ObjectMeta
))
return
labels
.
Set
(
generic
.
ObjectMetaFieldsSet
(
resourcequota
.
ObjectMeta
,
true
))
}
}
pkg/registry/serviceaccount/strategy.go
View file @
726def04
...
@@ -86,5 +86,5 @@ func Matcher(label labels.Selector, field fields.Selector) generic.Matcher {
...
@@ -86,5 +86,5 @@ func Matcher(label labels.Selector, field fields.Selector) generic.Matcher {
// SelectableFields returns a label set that represents the object
// SelectableFields returns a label set that represents the object
func
SelectableFields
(
obj
*
api
.
ServiceAccount
)
labels
.
Set
{
func
SelectableFields
(
obj
*
api
.
ServiceAccount
)
labels
.
Set
{
return
labels
.
Set
(
generic
.
ObjectMetaFieldsSet
(
obj
.
ObjectMeta
))
return
labels
.
Set
(
generic
.
ObjectMetaFieldsSet
(
obj
.
ObjectMeta
,
true
))
}
}
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