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
dc5b35a5
Commit
dc5b35a5
authored
Jan 19, 2016
by
Yu-Ju Hong
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Set default status to pending for pods from non-apiserver sources
parent
d351a0f6
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
27 additions
and
0 deletions
+27
-0
common.go
pkg/kubelet/config/common.go
+3
-0
file_test.go
pkg/kubelet/config/file_test.go
+6
-0
http_test.go
pkg/kubelet/config/http_test.go
+18
-0
No files found.
pkg/kubelet/config/common.go
View file @
dc5b35a5
...
...
@@ -70,6 +70,9 @@ func applyDefaults(pod *api.Pod, source string, isFile bool, nodeName string) er
}
// The generated UID is the hash of the file.
pod
.
Annotations
[
kubetypes
.
ConfigHashAnnotationKey
]
=
string
(
pod
.
UID
)
// Set the default status to pending.
pod
.
Status
.
Phase
=
api
.
PodPending
return
nil
}
...
...
pkg/kubelet/config/file_test.go
View file @
dc5b35a5
...
...
@@ -93,6 +93,9 @@ func TestReadPodsFromFile(t *testing.T) {
Containers
:
[]
api
.
Container
{{
Name
:
"image"
,
Image
:
"test/image"
,
SecurityContext
:
securitycontext
.
ValidSecurityContextWithContainerDefaults
()}},
SecurityContext
:
&
api
.
PodSecurityContext
{},
},
Status
:
api
.
PodStatus
{
Phase
:
api
.
PodPending
,
},
},
expected
:
CreatePodUpdate
(
kubetypes
.
SET
,
kubetypes
.
FileSource
,
&
api
.
Pod
{
ObjectMeta
:
api
.
ObjectMeta
{
...
...
@@ -115,6 +118,9 @@ func TestReadPodsFromFile(t *testing.T) {
SecurityContext
:
securitycontext
.
ValidSecurityContextWithContainerDefaults
()}},
SecurityContext
:
&
api
.
PodSecurityContext
{},
},
Status
:
api
.
PodStatus
{
Phase
:
api
.
PodPending
,
},
}),
},
}
...
...
pkg/kubelet/config/http_test.go
View file @
dc5b35a5
...
...
@@ -147,6 +147,9 @@ func TestExtractPodsFromHTTP(t *testing.T) {
Containers
:
[]
api
.
Container
{{
Name
:
"1"
,
Image
:
"foo"
,
ImagePullPolicy
:
api
.
PullAlways
}},
SecurityContext
:
&
api
.
PodSecurityContext
{},
},
Status
:
api
.
PodStatus
{
Phase
:
api
.
PodPending
,
},
},
expected
:
CreatePodUpdate
(
kubetypes
.
SET
,
kubetypes
.
HTTPSource
,
...
...
@@ -172,6 +175,9 @@ func TestExtractPodsFromHTTP(t *testing.T) {
ImagePullPolicy
:
"Always"
,
}},
},
Status
:
api
.
PodStatus
{
Phase
:
api
.
PodPending
,
},
}),
},
{
...
...
@@ -192,6 +198,9 @@ func TestExtractPodsFromHTTP(t *testing.T) {
Containers
:
[]
api
.
Container
{{
Name
:
"1"
,
Image
:
"foo"
,
ImagePullPolicy
:
api
.
PullAlways
}},
SecurityContext
:
&
api
.
PodSecurityContext
{},
},
Status
:
api
.
PodStatus
{
Phase
:
api
.
PodPending
,
},
},
{
ObjectMeta
:
api
.
ObjectMeta
{
...
...
@@ -203,6 +212,9 @@ func TestExtractPodsFromHTTP(t *testing.T) {
Containers
:
[]
api
.
Container
{{
Name
:
"2"
,
Image
:
"bar:bartag"
,
ImagePullPolicy
:
""
}},
SecurityContext
:
&
api
.
PodSecurityContext
{},
},
Status
:
api
.
PodStatus
{
Phase
:
api
.
PodPending
,
},
},
},
},
...
...
@@ -230,6 +242,9 @@ func TestExtractPodsFromHTTP(t *testing.T) {
ImagePullPolicy
:
"Always"
,
}},
},
Status
:
api
.
PodStatus
{
Phase
:
api
.
PodPending
,
},
},
&
api
.
Pod
{
ObjectMeta
:
api
.
ObjectMeta
{
...
...
@@ -253,6 +268,9 @@ func TestExtractPodsFromHTTP(t *testing.T) {
ImagePullPolicy
:
"IfNotPresent"
,
}},
},
Status
:
api
.
PodStatus
{
Phase
:
api
.
PodPending
,
},
}),
},
}
...
...
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