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
4ba7fd5f
Commit
4ba7fd5f
authored
Jul 12, 2018
by
Jason Smith
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
added serviceAccountName to field selectors
parent
337dfe0a
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
17 additions
and
1 deletion
+17
-1
conversion.go
pkg/apis/core/v1/conversion.go
+1
-0
strategy.go
pkg/registry/core/pod/strategy.go
+2
-1
strategy_test.go
pkg/registry/core/pod/strategy_test.go
+14
-0
No files found.
pkg/apis/core/v1/conversion.go
View file @
4ba7fd5f
...
@@ -162,6 +162,7 @@ func addConversionFuncs(scheme *runtime.Scheme) error {
...
@@ -162,6 +162,7 @@ func addConversionFuncs(scheme *runtime.Scheme) error {
"spec.nodeName"
,
"spec.nodeName"
,
"spec.restartPolicy"
,
"spec.restartPolicy"
,
"spec.schedulerName"
,
"spec.schedulerName"
,
"spec.serviceAccountName"
,
"status.phase"
,
"status.phase"
,
"status.podIP"
,
"status.podIP"
,
"status.nominatedNodeName"
:
"status.nominatedNodeName"
:
...
...
pkg/registry/core/pod/strategy.go
View file @
4ba7fd5f
...
@@ -237,10 +237,11 @@ func PodToSelectableFields(pod *api.Pod) fields.Set {
...
@@ -237,10 +237,11 @@ func PodToSelectableFields(pod *api.Pod) fields.Set {
// amount of allocations needed to create the fields.Set. If you add any
// amount of allocations needed to create the fields.Set. If you add any
// field here or the number of object-meta related fields changes, this should
// field here or the number of object-meta related fields changes, this should
// be adjusted.
// be adjusted.
podSpecificFieldsSet
:=
make
(
fields
.
Set
,
8
)
podSpecificFieldsSet
:=
make
(
fields
.
Set
,
9
)
podSpecificFieldsSet
[
"spec.nodeName"
]
=
pod
.
Spec
.
NodeName
podSpecificFieldsSet
[
"spec.nodeName"
]
=
pod
.
Spec
.
NodeName
podSpecificFieldsSet
[
"spec.restartPolicy"
]
=
string
(
pod
.
Spec
.
RestartPolicy
)
podSpecificFieldsSet
[
"spec.restartPolicy"
]
=
string
(
pod
.
Spec
.
RestartPolicy
)
podSpecificFieldsSet
[
"spec.schedulerName"
]
=
string
(
pod
.
Spec
.
SchedulerName
)
podSpecificFieldsSet
[
"spec.schedulerName"
]
=
string
(
pod
.
Spec
.
SchedulerName
)
podSpecificFieldsSet
[
"spec.serviceAccountName"
]
=
string
(
pod
.
Spec
.
ServiceAccountName
)
podSpecificFieldsSet
[
"status.phase"
]
=
string
(
pod
.
Status
.
Phase
)
podSpecificFieldsSet
[
"status.phase"
]
=
string
(
pod
.
Status
.
Phase
)
podSpecificFieldsSet
[
"status.podIP"
]
=
string
(
pod
.
Status
.
PodIP
)
podSpecificFieldsSet
[
"status.podIP"
]
=
string
(
pod
.
Status
.
PodIP
)
podSpecificFieldsSet
[
"status.nominatedNodeName"
]
=
string
(
pod
.
Status
.
NominatedNodeName
)
podSpecificFieldsSet
[
"status.nominatedNodeName"
]
=
string
(
pod
.
Status
.
NominatedNodeName
)
...
...
pkg/registry/core/pod/strategy_test.go
View file @
4ba7fd5f
...
@@ -88,6 +88,20 @@ func TestMatchPod(t *testing.T) {
...
@@ -88,6 +88,20 @@ func TestMatchPod(t *testing.T) {
},
},
{
{
in
:
&
api
.
Pod
{
in
:
&
api
.
Pod
{
Spec
:
api
.
PodSpec
{
ServiceAccountName
:
"serviceAccount1"
},
},
fieldSelector
:
fields
.
ParseSelectorOrDie
(
"spec.serviceAccountName=serviceAccount1"
),
expectMatch
:
true
,
},
{
in
:
&
api
.
Pod
{
Spec
:
api
.
PodSpec
{
SchedulerName
:
"serviceAccount1"
},
},
fieldSelector
:
fields
.
ParseSelectorOrDie
(
"spec.serviceAccountName=serviceAccount2"
),
expectMatch
:
false
,
},
{
in
:
&
api
.
Pod
{
Status
:
api
.
PodStatus
{
Phase
:
api
.
PodRunning
},
Status
:
api
.
PodStatus
{
Phase
:
api
.
PodRunning
},
},
},
fieldSelector
:
fields
.
ParseSelectorOrDie
(
"status.phase=Running"
),
fieldSelector
:
fields
.
ParseSelectorOrDie
(
"status.phase=Running"
),
...
...
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