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
2bbba1f6
Commit
2bbba1f6
authored
Oct 26, 2017
by
Pengfei Ni
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add node e2e tests for pulling images from credential providers
parent
0515895c
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
26 additions
and
8 deletions
+26
-8
runtime_conformance_test.go
test/e2e_node/runtime_conformance_test.go
+23
-5
kubelet.go
test/e2e_node/services/kubelet.go
+3
-3
No files found.
test/e2e_node/runtime_conformance_test.go
View file @
2bbba1f6
...
@@ -18,13 +18,17 @@ package e2e_node
...
@@ -18,13 +18,17 @@ package e2e_node
import
(
import
(
"fmt"
"fmt"
"io/ioutil"
"os"
"path"
"path"
"path/filepath"
"time"
"time"
"k8s.io/api/core/v1"
"k8s.io/api/core/v1"
"k8s.io/apimachinery/pkg/util/uuid"
"k8s.io/apimachinery/pkg/util/uuid"
"k8s.io/kubernetes/pkg/kubelet/images"
"k8s.io/kubernetes/pkg/kubelet/images"
"k8s.io/kubernetes/test/e2e/framework"
"k8s.io/kubernetes/test/e2e/framework"
"k8s.io/kubernetes/test/e2e_node/services"
.
"github.com/onsi/ginkgo"
.
"github.com/onsi/ginkgo"
.
"github.com/onsi/gomega"
.
"github.com/onsi/gomega"
...
@@ -256,11 +260,12 @@ while true; do sleep 1; done
...
@@ -256,11 +260,12 @@ while true; do sleep 1; done
// testing image pulling, these images don't need to be prepulled. The ImagePullPolicy
// testing image pulling, these images don't need to be prepulled. The ImagePullPolicy
// is v1.PullAlways, so it won't be blocked by framework image white list check.
// is v1.PullAlways, so it won't be blocked by framework image white list check.
for
_
,
testCase
:=
range
[]
struct
{
for
_
,
testCase
:=
range
[]
struct
{
description
string
description
string
image
string
image
string
secret
bool
secret
bool
phase
v1
.
PodPhase
credentialProvider
bool
waiting
bool
phase
v1
.
PodPhase
waiting
bool
}{
}{
{
{
description
:
"should not be able to pull image from invalid registry"
,
description
:
"should not be able to pull image from invalid registry"
,
...
@@ -299,6 +304,13 @@ while true; do sleep 1; done
...
@@ -299,6 +304,13 @@ while true; do sleep 1; done
phase
:
v1
.
PodRunning
,
phase
:
v1
.
PodRunning
,
waiting
:
false
,
waiting
:
false
,
},
},
{
description
:
"should be able to pull from private registry with credential provider"
,
image
:
"gcr.io/authenticated-image-pulling/alpine:3.1"
,
credentialProvider
:
true
,
phase
:
v1
.
PodRunning
,
waiting
:
false
,
},
}
{
}
{
testCase
:=
testCase
testCase
:=
testCase
It
(
testCase
.
description
+
" [Conformance]"
,
func
()
{
It
(
testCase
.
description
+
" [Conformance]"
,
func
()
{
...
@@ -323,6 +335,12 @@ while true; do sleep 1; done
...
@@ -323,6 +335,12 @@ while true; do sleep 1; done
defer
f
.
ClientSet
.
Core
()
.
Secrets
(
f
.
Namespace
.
Name
)
.
Delete
(
secret
.
Name
,
nil
)
defer
f
.
ClientSet
.
Core
()
.
Secrets
(
f
.
Namespace
.
Name
)
.
Delete
(
secret
.
Name
,
nil
)
container
.
ImagePullSecrets
=
[]
string
{
secret
.
Name
}
container
.
ImagePullSecrets
=
[]
string
{
secret
.
Name
}
}
}
if
testCase
.
credentialProvider
{
configFile
:=
filepath
.
Join
(
services
.
KubeletRootDirectory
,
"config.json"
)
err
:=
ioutil
.
WriteFile
(
configFile
,
[]
byte
(
auth
),
0644
)
Expect
(
err
)
.
NotTo
(
HaveOccurred
())
defer
os
.
Remove
(
configFile
)
}
// checkContainerStatus checks whether the container status matches expectation.
// checkContainerStatus checks whether the container status matches expectation.
checkContainerStatus
:=
func
()
error
{
checkContainerStatus
:=
func
()
error
{
status
,
err
:=
container
.
GetStatus
()
status
,
err
:=
container
.
GetStatus
()
...
...
test/e2e_node/services/kubelet.go
View file @
2bbba1f6
...
@@ -85,7 +85,7 @@ const (
...
@@ -85,7 +85,7 @@ const (
// Ports of different e2e services.
// Ports of different e2e services.
kubeletPort
=
"10250"
kubeletPort
=
"10250"
kubeletReadOnlyPort
=
"10255"
kubeletReadOnlyPort
=
"10255"
k
ubeletRootDirectory
=
"/var/lib/kubelet"
K
ubeletRootDirectory
=
"/var/lib/kubelet"
// Health check url of kubelet
// Health check url of kubelet
kubeletHealthCheckURL
=
"http://127.0.0.1:"
+
kubeletReadOnlyPort
+
"/healthz"
kubeletHealthCheckURL
=
"http://127.0.0.1:"
+
kubeletReadOnlyPort
+
"/healthz"
)
)
...
@@ -110,7 +110,7 @@ func (e *E2EServices) startKubelet() (*server, error) {
...
@@ -110,7 +110,7 @@ func (e *E2EServices) startKubelet() (*server, error) {
return
nil
,
err
return
nil
,
err
}
}
e
.
rmDirs
=
append
(
e
.
rmDirs
,
manifestPath
)
e
.
rmDirs
=
append
(
e
.
rmDirs
,
manifestPath
)
err
=
createRootDirectory
(
k
ubeletRootDirectory
)
err
=
createRootDirectory
(
K
ubeletRootDirectory
)
if
err
!=
nil
{
if
err
!=
nil
{
return
nil
,
err
return
nil
,
err
}
}
...
@@ -151,7 +151,7 @@ func (e *E2EServices) startKubelet() (*server, error) {
...
@@ -151,7 +151,7 @@ func (e *E2EServices) startKubelet() (*server, error) {
"--address"
,
"0.0.0.0"
,
"--address"
,
"0.0.0.0"
,
"--port"
,
kubeletPort
,
"--port"
,
kubeletPort
,
"--read-only-port"
,
kubeletReadOnlyPort
,
"--read-only-port"
,
kubeletReadOnlyPort
,
"--root-dir"
,
k
ubeletRootDirectory
,
"--root-dir"
,
K
ubeletRootDirectory
,
"--volume-stats-agg-period"
,
"10s"
,
// Aggregate volumes frequently so tests don't need to wait as long
"--volume-stats-agg-period"
,
"10s"
,
// Aggregate volumes frequently so tests don't need to wait as long
"--allow-privileged"
,
"true"
,
"--allow-privileged"
,
"true"
,
"--serialize-image-pulls"
,
"false"
,
"--serialize-image-pulls"
,
"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