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
9db6aa50
Commit
9db6aa50
authored
Feb 28, 2017
by
Wojciech Tyczynski
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Make secret tests work in large clusters
parent
70797f51
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
50 additions
and
14 deletions
+50
-14
projected.go
test/e2e/common/projected.go
+17
-7
secrets.go
test/e2e/common/secrets.go
+17
-7
util.go
test/e2e/framework/util.go
+16
-0
No files found.
test/e2e/common/projected.go
View file @
9db6aa50
...
@@ -172,13 +172,24 @@ var _ = framework.KubeDescribe("Projected", func() {
...
@@ -172,13 +172,24 @@ var _ = framework.KubeDescribe("Projected", func() {
It
(
"optional updates should be reflected in volume [Conformance] [Volume]"
,
func
()
{
It
(
"optional updates should be reflected in volume [Conformance] [Volume]"
,
func
()
{
// We may have to wait or a full sync period to elapse before the
// With SecretManager, we may have to wait up to full sync period + TTL of
// Kubelet projects the update into the volume and the container picks
// a secret to elapse before the Kubelet projects the update into the volume
// it up. This timeout is based on the default Kubelet sync period (1
// and the container picks it ip.
// minute) plus additional time for fudge factor.
// This timeout is based on default Kubelet sync period (1 minute) plus
const
podLogTimeout
=
300
*
time
.
Second
// maximum secret TTL (based on cluster size) plus additional time for fudge
trueVal
:=
true
// factor.
nodes
,
err
:=
f
.
ClientSet
.
Core
()
.
Nodes
()
.
List
(
metav1
.
ListOptions
{})
framework
.
ExpectNoError
(
err
)
// Since TTL the kubelet is using are stored in node object, for the timeout
// purpose we take it from a first node (all of them should be the same).
// We take the TTL from the first node.
secretTTL
,
exists
:=
framework
.
GetTTLAnnotationFromNode
(
&
nodes
.
Items
[
0
])
if
!
exists
{
framework
.
Logf
(
"Couldn't get ttl annotation from: %#v"
,
nodes
.
Items
[
0
])
}
podLogTimeout
:=
240
*
time
.
Second
+
secretTTL
trueVal
:=
true
volumeMountPath
:=
"/etc/projected-secret-volumes"
volumeMountPath
:=
"/etc/projected-secret-volumes"
deleteName
:=
"s-test-opt-del-"
+
string
(
uuid
.
NewUUID
())
deleteName
:=
"s-test-opt-del-"
+
string
(
uuid
.
NewUUID
())
...
@@ -221,7 +232,6 @@ var _ = framework.KubeDescribe("Projected", func() {
...
@@ -221,7 +232,6 @@ var _ = framework.KubeDescribe("Projected", func() {
}
}
By
(
fmt
.
Sprintf
(
"Creating secret with name %s"
,
deleteSecret
.
Name
))
By
(
fmt
.
Sprintf
(
"Creating secret with name %s"
,
deleteSecret
.
Name
))
var
err
error
if
deleteSecret
,
err
=
f
.
ClientSet
.
Core
()
.
Secrets
(
f
.
Namespace
.
Name
)
.
Create
(
deleteSecret
);
err
!=
nil
{
if
deleteSecret
,
err
=
f
.
ClientSet
.
Core
()
.
Secrets
(
f
.
Namespace
.
Name
)
.
Create
(
deleteSecret
);
err
!=
nil
{
framework
.
Failf
(
"unable to create test secret %s: %v"
,
deleteSecret
.
Name
,
err
)
framework
.
Failf
(
"unable to create test secret %s: %v"
,
deleteSecret
.
Name
,
err
)
}
}
...
...
test/e2e/common/secrets.go
View file @
9db6aa50
...
@@ -155,13 +155,24 @@ var _ = framework.KubeDescribe("Secrets", func() {
...
@@ -155,13 +155,24 @@ var _ = framework.KubeDescribe("Secrets", func() {
It
(
"optional updates should be reflected in volume [Conformance] [Volume]"
,
func
()
{
It
(
"optional updates should be reflected in volume [Conformance] [Volume]"
,
func
()
{
// We may have to wait or a full sync period to elapse before the
// With SecretManager, we may have to wait up to full sync period + TTL of
// Kubelet projects the update into the volume and the container picks
// a secret to elapse before the Kubelet projects the update into the volume
// it up. This timeout is based on the default Kubelet sync period (1
// and the container picks it ip.
// minute) plus additional time for fudge factor.
// This timeout is based on default Kubelet sync period (1 minute) plus
const
podLogTimeout
=
300
*
time
.
Second
// maximum secret TTL (based on cluster size) plus additional time for fudge
trueVal
:=
true
// factor.
nodes
,
err
:=
f
.
ClientSet
.
Core
()
.
Nodes
()
.
List
(
metav1
.
ListOptions
{})
framework
.
ExpectNoError
(
err
)
// Since TTL the kubelet is using are stored in node object, for the timeout
// purpose we take it from a first node (all of them should be the same).
// We take the TTL from the first node.
secretTTL
,
exists
:=
framework
.
GetTTLAnnotationFromNode
(
&
nodes
.
Items
[
0
])
if
!
exists
{
framework
.
Logf
(
"Couldn't get ttl annotation from: %#v"
,
nodes
.
Items
[
0
])
}
podLogTimeout
:=
240
*
time
.
Second
+
secretTTL
trueVal
:=
true
volumeMountPath
:=
"/etc/secret-volumes"
volumeMountPath
:=
"/etc/secret-volumes"
deleteName
:=
"s-test-opt-del-"
+
string
(
uuid
.
NewUUID
())
deleteName
:=
"s-test-opt-del-"
+
string
(
uuid
.
NewUUID
())
...
@@ -204,7 +215,6 @@ var _ = framework.KubeDescribe("Secrets", func() {
...
@@ -204,7 +215,6 @@ var _ = framework.KubeDescribe("Secrets", func() {
}
}
By
(
fmt
.
Sprintf
(
"Creating secret with name %s"
,
deleteSecret
.
Name
))
By
(
fmt
.
Sprintf
(
"Creating secret with name %s"
,
deleteSecret
.
Name
))
var
err
error
if
deleteSecret
,
err
=
f
.
ClientSet
.
Core
()
.
Secrets
(
f
.
Namespace
.
Name
)
.
Create
(
deleteSecret
);
err
!=
nil
{
if
deleteSecret
,
err
=
f
.
ClientSet
.
Core
()
.
Secrets
(
f
.
Namespace
.
Name
)
.
Create
(
deleteSecret
);
err
!=
nil
{
framework
.
Failf
(
"unable to create test secret %s: %v"
,
deleteSecret
.
Name
,
err
)
framework
.
Failf
(
"unable to create test secret %s: %v"
,
deleteSecret
.
Name
,
err
)
}
}
...
...
test/e2e/framework/util.go
View file @
9db6aa50
...
@@ -2527,6 +2527,22 @@ func WaitForAllNodesSchedulable(c clientset.Interface, timeout time.Duration) er
...
@@ -2527,6 +2527,22 @@ func WaitForAllNodesSchedulable(c clientset.Interface, timeout time.Duration) er
})
})
}
}
func
GetTTLAnnotationFromNode
(
node
*
v1
.
Node
)
(
time
.
Duration
,
bool
)
{
if
node
.
Annotations
==
nil
{
return
time
.
Duration
(
0
),
false
}
value
,
ok
:=
node
.
Annotations
[
v1
.
ObjectTTLAnnotationKey
]
if
!
ok
{
return
time
.
Duration
(
0
),
false
}
intValue
,
err
:=
strconv
.
Atoi
(
value
)
if
err
!=
nil
{
Logf
(
"Cannot convert TTL annotation from %#v to int"
,
*
node
)
return
time
.
Duration
(
0
),
false
}
return
time
.
Duration
(
intValue
)
*
time
.
Second
,
true
}
func
AddOrUpdateLabelOnNode
(
c
clientset
.
Interface
,
nodeName
string
,
labelKey
,
labelValue
string
)
{
func
AddOrUpdateLabelOnNode
(
c
clientset
.
Interface
,
nodeName
string
,
labelKey
,
labelValue
string
)
{
ExpectNoError
(
testutils
.
AddLabelsToNode
(
c
,
nodeName
,
map
[
string
]
string
{
labelKey
:
labelValue
}))
ExpectNoError
(
testutils
.
AddLabelsToNode
(
c
,
nodeName
,
map
[
string
]
string
{
labelKey
:
labelValue
}))
}
}
...
...
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