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
e479c521
Commit
e479c521
authored
Jul 01, 2015
by
Zach Loafman
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #10618 from marekbiskup/namespaces-in-addon-update
Namespaces in addon update
parents
9db58ff2
8df3a9ca
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
30 additions
and
26 deletions
+30
-26
kube-addon-update.sh
cluster/saltbase/salt/kube-addons/kube-addon-update.sh
+0
-0
addon_update.go
test/e2e/addon_update.go
+30
-26
No files found.
cluster/saltbase/salt/kube-addons/kube-addon-update.sh
View file @
e479c521
This diff is collapsed.
Click to expand it.
test/e2e/addon_update.go
View file @
e479c521
...
@@ -39,7 +39,7 @@ apiVersion: v1
...
@@ -39,7 +39,7 @@ apiVersion: v1
kind: ReplicationController
kind: ReplicationController
metadata:
metadata:
name: addon-test-v1
name: addon-test-v1
namespace:
default
namespace:
%s
labels:
labels:
k8s-app: addon-test
k8s-app: addon-test
version: v1
version: v1
...
@@ -69,7 +69,7 @@ apiVersion: v1
...
@@ -69,7 +69,7 @@ apiVersion: v1
kind: ReplicationController
kind: ReplicationController
metadata:
metadata:
name: addon-test-v2
name: addon-test-v2
namespace:
default
namespace:
%s
labels:
labels:
k8s-app: addon-test
k8s-app: addon-test
version: v2
version: v2
...
@@ -99,7 +99,7 @@ apiVersion: v1
...
@@ -99,7 +99,7 @@ apiVersion: v1
kind: Service
kind: Service
metadata:
metadata:
name: addon-test
name: addon-test
namespace:
default
namespace:
%s
labels:
labels:
k8s-app: addon-test
k8s-app: addon-test
kubernetes.io/cluster-service: "true"
kubernetes.io/cluster-service: "true"
...
@@ -118,7 +118,7 @@ apiVersion: v1
...
@@ -118,7 +118,7 @@ apiVersion: v1
kind: Service
kind: Service
metadata:
metadata:
name: addon-test-updated
name: addon-test-updated
namespace:
default
namespace:
%s
labels:
labels:
k8s-app: addon-test
k8s-app: addon-test
kubernetes.io/cluster-service: "true"
kubernetes.io/cluster-service: "true"
...
@@ -138,7 +138,7 @@ apiVersion: v1
...
@@ -138,7 +138,7 @@ apiVersion: v1
kind: ReplicationController
kind: ReplicationController
metadata:
metadata:
name: invalid-addon-test-v1
name: invalid-addon-test-v1
namespace:
default
namespace:
%s
labels:
labels:
k8s-app: invalid-addon-test
k8s-app: invalid-addon-test
version: v1
version: v1
...
@@ -167,7 +167,7 @@ apiVersion: v1
...
@@ -167,7 +167,7 @@ apiVersion: v1
kind: Service
kind: Service
metadata:
metadata:
name: ivalid-addon-test
name: ivalid-addon-test
namespace:
default
namespace:
%s
labels:
labels:
k8s-app: invalid-addon-test
k8s-app: invalid-addon-test
kubernetes.io/name: invalid-addon-test
kubernetes.io/name: invalid-addon-test
...
@@ -181,8 +181,8 @@ spec:
...
@@ -181,8 +181,8 @@ spec:
`
`
var
addonTestPollInterval
=
3
*
time
.
Second
var
addonTestPollInterval
=
3
*
time
.
Second
var
addonTestPollTimeout
=
1
*
time
.
Minute
var
addonTestPollTimeout
=
5
*
time
.
Minute
var
addonNamespace
=
api
.
NamespaceDefault
// addons are in the default namespace
var
defaultNsName
=
api
.
NamespaceDefault
type
stringPair
struct
{
type
stringPair
struct
{
data
,
fileName
string
data
,
fileName
string
...
@@ -260,12 +260,12 @@ var _ = Describe("Addon update", func() {
...
@@ -260,12 +260,12 @@ var _ = Describe("Addon update", func() {
svcInvalid
:=
"invalid-addon-service-v1.yaml"
svcInvalid
:=
"invalid-addon-service-v1.yaml"
var
remoteFiles
[]
stringPair
=
[]
stringPair
{
var
remoteFiles
[]
stringPair
=
[]
stringPair
{
{
addon_controller_v1
,
rcv1
},
{
fmt
.
Sprintf
(
addon_controller_v1
,
defaultNsName
)
,
rcv1
},
{
addon_controller_v2
,
rcv2
},
{
fmt
.
Sprintf
(
addon_controller_v2
,
namespace
.
Name
)
,
rcv2
},
{
addon_service_v1
,
svcv1
},
{
fmt
.
Sprintf
(
addon_service_v1
,
namespace
.
Name
)
,
svcv1
},
{
addon_service_v2
,
svcv2
},
{
fmt
.
Sprintf
(
addon_service_v2
,
namespace
.
Name
)
,
svcv2
},
{
invalid_addon_controller_v1
,
rcInvalid
},
{
fmt
.
Sprintf
(
invalid_addon_controller_v1
,
namespace
.
Name
)
,
rcInvalid
},
{
invalid_addon_service_v1
,
svcInvalid
},
{
fmt
.
Sprintf
(
invalid_addon_service_v1
,
defaultNsName
)
,
svcInvalid
},
}
}
for
_
,
p
:=
range
remoteFiles
{
for
_
,
p
:=
range
remoteFiles
{
...
@@ -293,8 +293,8 @@ var _ = Describe("Addon update", func() {
...
@@ -293,8 +293,8 @@ var _ = Describe("Addon update", func() {
sshExecAndVerify
(
sshClient
,
fmt
.
Sprintf
(
"sudo cp %s/%s %s/%s"
,
temporaryRemotePath
,
rcv1
,
destinationDir
,
rcv1
))
sshExecAndVerify
(
sshClient
,
fmt
.
Sprintf
(
"sudo cp %s/%s %s/%s"
,
temporaryRemotePath
,
rcv1
,
destinationDir
,
rcv1
))
sshExecAndVerify
(
sshClient
,
fmt
.
Sprintf
(
"sudo cp %s/%s %s/%s"
,
temporaryRemotePath
,
svcv1
,
destinationDir
,
svcv1
))
sshExecAndVerify
(
sshClient
,
fmt
.
Sprintf
(
"sudo cp %s/%s %s/%s"
,
temporaryRemotePath
,
svcv1
,
destinationDir
,
svcv1
))
waitForServiceInAddonTest
(
c
,
"addon-test"
,
true
)
waitForServiceInAddonTest
(
c
,
namespace
.
Name
,
"addon-test"
,
true
)
waitForReplicationControllerInAddonTest
(
c
,
"addon-test-v1"
,
true
)
waitForReplicationControllerInAddonTest
(
c
,
defaultNsName
,
"addon-test-v1"
,
true
)
By
(
"update manifests"
)
By
(
"update manifests"
)
sshExecAndVerify
(
sshClient
,
fmt
.
Sprintf
(
"sudo cp %s/%s %s/%s"
,
temporaryRemotePath
,
rcv2
,
destinationDir
,
rcv2
))
sshExecAndVerify
(
sshClient
,
fmt
.
Sprintf
(
"sudo cp %s/%s %s/%s"
,
temporaryRemotePath
,
rcv2
,
destinationDir
,
rcv2
))
...
@@ -307,34 +307,38 @@ var _ = Describe("Addon update", func() {
...
@@ -307,34 +307,38 @@ var _ = Describe("Addon update", func() {
* But it is ok - as long as we don't have rolling update, the result will be the same
* But it is ok - as long as we don't have rolling update, the result will be the same
*/
*/
waitForServiceInAddonTest
(
c
,
"addon-test-updated"
,
true
)
waitForServiceInAddonTest
(
c
,
namespace
.
Name
,
"addon-test-updated"
,
true
)
waitForReplicationControllerInAddonTest
(
c
,
"addon-test-v2"
,
true
)
waitForReplicationControllerInAddonTest
(
c
,
namespace
.
Name
,
"addon-test-v2"
,
true
)
waitForServiceInAddonTest
(
c
,
"addon-test"
,
false
)
waitForServiceInAddonTest
(
c
,
namespace
.
Name
,
"addon-test"
,
false
)
waitForReplicationControllerInAddonTest
(
c
,
"addon-test-v1"
,
false
)
waitForReplicationControllerInAddonTest
(
c
,
defaultNsName
,
"addon-test-v1"
,
false
)
By
(
"remove manifests"
)
By
(
"remove manifests"
)
sshExecAndVerify
(
sshClient
,
fmt
.
Sprintf
(
"sudo rm %s/%s"
,
destinationDir
,
rcv2
))
sshExecAndVerify
(
sshClient
,
fmt
.
Sprintf
(
"sudo rm %s/%s"
,
destinationDir
,
rcv2
))
sshExecAndVerify
(
sshClient
,
fmt
.
Sprintf
(
"sudo rm %s/%s"
,
destinationDir
,
svcv2
))
sshExecAndVerify
(
sshClient
,
fmt
.
Sprintf
(
"sudo rm %s/%s"
,
destinationDir
,
svcv2
))
waitForServiceInAddonTest
(
c
,
"addon-test-updated"
,
false
)
waitForServiceInAddonTest
(
c
,
namespace
.
Name
,
"addon-test-updated"
,
false
)
waitForReplicationControllerInAddonTest
(
c
,
"invalid-addon-test-v1
"
,
false
)
waitForReplicationControllerInAddonTest
(
c
,
namespace
.
Name
,
"addon-test-v2
"
,
false
)
By
(
"verify invalid API addons weren't created"
)
By
(
"verify invalid API addons weren't created"
)
_
,
err
=
c
.
ReplicationControllers
(
addonNamespac
e
)
.
Get
(
"invalid-addon-test-v1"
)
_
,
err
=
c
.
ReplicationControllers
(
namespace
.
Nam
e
)
.
Get
(
"invalid-addon-test-v1"
)
Expect
(
err
)
.
To
(
HaveOccurred
())
Expect
(
err
)
.
To
(
HaveOccurred
())
_
,
err
=
c
.
Services
(
addonNamespace
)
.
Get
(
"ivalid-addon-test"
)
_
,
err
=
c
.
ReplicationControllers
(
defaultNsName
)
.
Get
(
"invalid-addon-test-v1"
)
Expect
(
err
)
.
To
(
HaveOccurred
())
_
,
err
=
c
.
Services
(
namespace
.
Name
)
.
Get
(
"ivalid-addon-test"
)
Expect
(
err
)
.
To
(
HaveOccurred
())
_
,
err
=
c
.
Services
(
defaultNsName
)
.
Get
(
"ivalid-addon-test"
)
Expect
(
err
)
.
To
(
HaveOccurred
())
Expect
(
err
)
.
To
(
HaveOccurred
())
// invalid addons will be deleted by the deferred function
// invalid addons will be deleted by the deferred function
})
})
})
})
func
waitForServiceInAddonTest
(
c
*
client
.
Client
,
name
string
,
exist
bool
)
{
func
waitForServiceInAddonTest
(
c
*
client
.
Client
,
addonNamespace
,
name
string
,
exist
bool
)
{
expectNoError
(
waitForService
(
c
,
addonNamespace
,
name
,
exist
,
addonTestPollInterval
,
addonTestPollTimeout
))
expectNoError
(
waitForService
(
c
,
addonNamespace
,
name
,
exist
,
addonTestPollInterval
,
addonTestPollTimeout
))
}
}
func
waitForReplicationControllerInAddonTest
(
c
*
client
.
Client
,
name
string
,
exist
bool
)
{
func
waitForReplicationControllerInAddonTest
(
c
*
client
.
Client
,
addonNamespace
,
name
string
,
exist
bool
)
{
expectNoError
(
waitForReplicationController
(
c
,
addonNamespace
,
name
,
exist
,
addonTestPollInterval
,
addonTestPollTimeout
))
expectNoError
(
waitForReplicationController
(
c
,
addonNamespace
,
name
,
exist
,
addonTestPollInterval
,
addonTestPollTimeout
))
}
}
...
...
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