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
201d60b4
Commit
201d60b4
authored
Feb 22, 2016
by
Dawn Chen
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #21440 from bprashanth/glbc_name
Add image version to glbc name.
parents
1e680c9d
058db9a7
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
44 additions
and
17 deletions
+44
-17
glbc-controller.yaml
...er/addons/cluster-loadbalancing/glbc/glbc-controller.yaml
+1
-1
ingress.go
test/e2e/ingress.go
+15
-5
util.go
test/e2e/util.go
+28
-11
No files found.
cluster/addons/cluster-loadbalancing/glbc/glbc-controller.yaml
View file @
201d60b4
apiVersion
:
v1
apiVersion
:
v1
kind
:
ReplicationController
kind
:
ReplicationController
metadata
:
metadata
:
name
:
l7-lb-controller
name
:
l7-lb-controller
-v0.5.2
namespace
:
kube-system
namespace
:
kube-system
labels
:
labels
:
k8s-app
:
glbc
k8s-app
:
glbc
...
...
test/e2e/ingress.go
View file @
201d60b4
...
@@ -70,6 +70,10 @@ var (
...
@@ -70,6 +70,10 @@ var (
// Name of the loadbalancer controller within the cluster addon
// Name of the loadbalancer controller within the cluster addon
lbContainerName
=
"l7-lb-controller"
lbContainerName
=
"l7-lb-controller"
// Labels used to identify existing loadbalancer controllers.
// TODO: Pull this out of the RC manifest.
clusterAddonLBLabels
=
map
[
string
]
string
{
"k8s-app"
:
"glbc"
}
// If set, the test tries to perform an HTTP GET on each url endpoint of
// If set, the test tries to perform an HTTP GET on each url endpoint of
// the Ingress. Only set to false to short-circuit test runs in debugging.
// the Ingress. Only set to false to short-circuit test runs in debugging.
verifyHTTPGET
=
true
verifyHTTPGET
=
true
...
@@ -274,13 +278,19 @@ func (cont *IngressController) create() {
...
@@ -274,13 +278,19 @@ func (cont *IngressController) create() {
Expect
(
err
)
.
NotTo
(
HaveOccurred
())
Expect
(
err
)
.
NotTo
(
HaveOccurred
())
}
}
rc
:=
rcFromManifest
(
cont
.
rcPath
)
rc
:=
rcFromManifest
(
cont
.
rcPath
)
existingRc
,
err
:=
cont
.
c
.
ReplicationControllers
(
api
.
NamespaceSystem
)
.
Get
(
lbContainerName
)
listOpts
:=
api
.
ListOptions
{
LabelSelector
:
labels
.
SelectorFromSet
(
labels
.
Set
(
clusterAddonLBLabels
))}
existingRCs
,
err
:=
cont
.
c
.
ReplicationControllers
(
api
.
NamespaceSystem
)
.
List
(
listOpts
)
Expect
(
err
)
.
NotTo
(
HaveOccurred
())
Expect
(
err
)
.
NotTo
(
HaveOccurred
())
if
len
(
existingRCs
.
Items
)
!=
1
{
Failf
(
"Unexpected number of lb cluster addons %v with label %v in kube-system namespace"
,
len
(
existingRCs
.
Items
),
clusterAddonLBLabels
)
}
// Merge the existing spec and new spec. The modifications should not
// Merge the existing spec and new spec. The modifications should not
// manifest as functional changes to the controller. Most importantly, the
// manifest as functional changes to the controller. Most importantly, the
// podTemplate shouldn't change (but for the additional test cmd line flags)
// podTemplate shouldn't change (but for the additional test cmd line flags)
// to ensure we test actual cluster functionality across upgrades.
// to ensure we test actual cluster functionality across upgrades.
rc
.
Spec
=
existingR
c
.
Spec
rc
.
Spec
=
existingR
Cs
.
Items
[
0
]
.
Spec
rc
.
Name
=
"glbc"
rc
.
Name
=
"glbc"
rc
.
Namespace
=
cont
.
ns
rc
.
Namespace
=
cont
.
ns
rc
.
Labels
=
controllerLabels
rc
.
Labels
=
controllerLabels
...
@@ -413,7 +423,7 @@ var _ = Describe("GCE L7 LoadBalancer Controller [Feature:Ingress]", func() {
...
@@ -413,7 +423,7 @@ var _ = Describe("GCE L7 LoadBalancer Controller [Feature:Ingress]", func() {
client
=
framework
.
Client
client
=
framework
.
Client
ns
=
framework
.
Namespace
.
Name
ns
=
framework
.
Namespace
.
Name
// Scaled down the existing Ingress controller so it doesn't interfere with the test.
// Scaled down the existing Ingress controller so it doesn't interfere with the test.
Expect
(
scaleRCBy
Name
(
client
,
api
.
NamespaceSystem
,
lbContainerName
,
0
))
.
NotTo
(
HaveOccurred
())
Expect
(
scaleRCBy
Labels
(
client
,
api
.
NamespaceSystem
,
clusterAddonLBLabels
,
0
))
.
NotTo
(
HaveOccurred
())
addonDir
=
filepath
.
Join
(
addonDir
=
filepath
.
Join
(
testContext
.
RepoRoot
,
"cluster"
,
"addons"
,
"cluster-loadbalancing"
,
"glbc"
)
testContext
.
RepoRoot
,
"cluster"
,
"addons"
,
"cluster-loadbalancing"
,
"glbc"
)
...
@@ -464,7 +474,7 @@ var _ = Describe("GCE L7 LoadBalancer Controller [Feature:Ingress]", func() {
...
@@ -464,7 +474,7 @@ var _ = Describe("GCE L7 LoadBalancer Controller [Feature:Ingress]", func() {
return
true
,
nil
return
true
,
nil
})
})
// TODO: Remove this once issue #17802 is fixed
// TODO: Remove this once issue #17802 is fixed
Expect
(
scaleRCBy
Name
(
client
,
ingController
.
rc
.
Namespace
,
ingController
.
rc
.
Name
,
0
))
.
NotTo
(
HaveOccurred
())
Expect
(
scaleRCBy
Labels
(
client
,
ingController
.
rc
.
Namespace
,
ingController
.
rc
.
Labels
,
0
))
.
NotTo
(
HaveOccurred
())
// If the controller failed to cleanup the test will fail, but we want to cleanup
// If the controller failed to cleanup the test will fail, but we want to cleanup
// resources before that.
// resources before that.
...
@@ -475,7 +485,7 @@ var _ = Describe("GCE L7 LoadBalancer Controller [Feature:Ingress]", func() {
...
@@ -475,7 +485,7 @@ var _ = Describe("GCE L7 LoadBalancer Controller [Feature:Ingress]", func() {
Failf
(
"Failed to cleanup GCE L7 resources."
)
Failf
(
"Failed to cleanup GCE L7 resources."
)
}
}
// Restore the cluster Addon.
// Restore the cluster Addon.
Expect
(
scaleRCBy
Name
(
client
,
api
.
NamespaceSystem
,
lbContainerName
,
1
))
.
NotTo
(
HaveOccurred
())
Expect
(
scaleRCBy
Labels
(
client
,
api
.
NamespaceSystem
,
clusterAddonLBLabels
,
1
))
.
NotTo
(
HaveOccurred
())
framework
.
afterEach
()
framework
.
afterEach
()
Logf
(
"Successfully verified GCE L7 loadbalancer via Ingress."
)
Logf
(
"Successfully verified GCE L7 loadbalancer via Ingress."
)
})
})
...
...
test/e2e/util.go
View file @
201d60b4
...
@@ -2911,22 +2911,39 @@ func getNodePortURL(client *client.Client, ns, name string, svcPort int) (string
...
@@ -2911,22 +2911,39 @@ func getNodePortURL(client *client.Client, ns, name string, svcPort int) (string
return
""
,
fmt
.
Errorf
(
"Failed to find external address for service %v"
,
name
)
return
""
,
fmt
.
Errorf
(
"Failed to find external address for service %v"
,
name
)
}
}
// scaleRCBy
Name scales an RC via ns/name
lookup. If replicas == 0 it waits till
// scaleRCBy
Labels scales an RC via ns/label
lookup. If replicas == 0 it waits till
// none are running, otherwise it does what a synchronous scale operation would do.
// none are running, otherwise it does what a synchronous scale operation would do.
func
scaleRCByName
(
client
*
client
.
Client
,
ns
,
name
string
,
replicas
uint
)
error
{
func
scaleRCByLabels
(
client
*
client
.
Client
,
ns
string
,
l
map
[
string
]
string
,
replicas
uint
)
error
{
if
err
:=
ScaleRC
(
client
,
ns
,
name
,
replicas
,
false
);
err
!=
nil
{
listOpts
:=
api
.
ListOptions
{
LabelSelector
:
labels
.
SelectorFromSet
(
labels
.
Set
(
l
))}
return
err
rcs
,
err
:=
client
.
ReplicationControllers
(
ns
)
.
List
(
listOpts
)
}
rc
,
err
:=
client
.
ReplicationControllers
(
ns
)
.
Get
(
name
)
if
err
!=
nil
{
if
err
!=
nil
{
return
err
return
err
}
}
if
replicas
==
0
{
if
len
(
rcs
.
Items
)
==
0
{
return
waitForRCPodsGone
(
client
,
rc
)
return
fmt
.
Errorf
(
"RC with labels %v not found in ns %v"
,
l
,
ns
)
}
else
{
}
return
waitForPodsWithLabelRunning
(
Logf
(
"Scaling %v RCs with labels %v in ns %v to %v replicas."
,
len
(
rcs
.
Items
),
l
,
ns
,
replicas
)
client
,
ns
,
labels
.
SelectorFromSet
(
labels
.
Set
(
rc
.
Spec
.
Selector
)))
for
_
,
labelRC
:=
range
rcs
.
Items
{
name
:=
labelRC
.
Name
if
err
:=
ScaleRC
(
client
,
ns
,
name
,
replicas
,
false
);
err
!=
nil
{
return
err
}
rc
,
err
:=
client
.
ReplicationControllers
(
ns
)
.
Get
(
name
)
if
err
!=
nil
{
return
err
}
if
replicas
==
0
{
if
err
:=
waitForRCPodsGone
(
client
,
rc
);
err
!=
nil
{
return
err
}
}
else
{
if
err
:=
waitForPodsWithLabelRunning
(
client
,
ns
,
labels
.
SelectorFromSet
(
labels
.
Set
(
rc
.
Spec
.
Selector
)));
err
!=
nil
{
return
err
}
}
}
}
return
nil
}
}
func
getPodLogs
(
c
*
client
.
Client
,
namespace
,
podName
,
containerName
string
)
(
string
,
error
)
{
func
getPodLogs
(
c
*
client
.
Client
,
namespace
,
podName
,
containerName
string
)
(
string
,
error
)
{
...
...
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