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
532a9d78
Commit
532a9d78
authored
Jun 29, 2017
by
Zihong Zheng
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[e2e-ingress] Get node tags from instance under GKE
parent
8bece8ec
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
18 additions
and
3 deletions
+18
-3
firewall_util.go
test/e2e/framework/firewall_util.go
+10
-0
ingress_utils.go
test/e2e/framework/ingress_utils.go
+2
-2
ingress.go
test/e2e/ingress.go
+6
-1
No files found.
test/e2e/framework/firewall_util.go
View file @
532a9d78
...
...
@@ -124,6 +124,16 @@ func SetInstanceTags(cloudConfig CloudConfig, instanceName, zone string, tags []
return
resTags
.
Items
}
// GetNodeTags gets k8s node tag from one of the nodes
func
GetNodeTags
(
c
clientset
.
Interface
,
cloudConfig
CloudConfig
)
[]
string
{
nodes
:=
GetReadySchedulableNodesOrDie
(
c
)
if
len
(
nodes
.
Items
)
==
0
{
Logf
(
"GetNodeTags: Found 0 node."
)
return
[]
string
{}
}
return
GetInstanceTags
(
cloudConfig
,
nodes
.
Items
[
0
]
.
Name
)
.
Items
}
// GetInstancePrefix returns the INSTANCE_PREFIX env we set for e2e cluster.
// From cluster/gce/config-test.sh, master name is set up using below format:
// MASTER_NAME="${INSTANCE_PREFIX}-master"
...
...
test/e2e/framework/ingress_utils.go
View file @
532a9d78
...
...
@@ -973,13 +973,13 @@ func (j *IngressTestJig) GetIngressNodePorts() []string {
}
// ConstructFirewallForIngress returns the expected GCE firewall rule for the ingress resource
func
(
j
*
IngressTestJig
)
ConstructFirewallForIngress
(
gceController
*
GCEIngressController
,
nodeTag
string
)
*
compute
.
Firewall
{
func
(
j
*
IngressTestJig
)
ConstructFirewallForIngress
(
gceController
*
GCEIngressController
,
nodeTag
s
[]
string
)
*
compute
.
Firewall
{
nodePorts
:=
j
.
GetIngressNodePorts
()
fw
:=
compute
.
Firewall
{}
fw
.
Name
=
gceController
.
GetFirewallRuleName
()
fw
.
SourceRanges
=
gcecloud
.
LoadBalancerSrcRanges
()
fw
.
TargetTags
=
[]
string
{
nodeTag
}
fw
.
TargetTags
=
nodeTags
fw
.
Allowed
=
[]
*
compute
.
FirewallAllowed
{
{
IPProtocol
:
"tcp"
,
...
...
test/e2e/ingress.go
View file @
532a9d78
...
...
@@ -124,7 +124,12 @@ var _ = framework.KubeDescribe("Loadbalancing: L7", func() {
By
(
"should have correct firewall rule for ingress"
)
fw
:=
gceController
.
GetFirewallRule
()
expFw
:=
jig
.
ConstructFirewallForIngress
(
gceController
,
cloudConfig
.
NodeTag
)
nodeTags
:=
[]
string
{
cloudConfig
.
NodeTag
}
if
framework
.
TestContext
.
Provider
!=
"gce"
{
// nodeTags would be different in GKE.
nodeTags
=
framework
.
GetNodeTags
(
jig
.
Client
,
cloudConfig
)
}
expFw
:=
jig
.
ConstructFirewallForIngress
(
gceController
,
nodeTags
)
// Passed the last argument as `true` to verify the backend ports is a subset
// of the allowed ports in firewall rule, given there may be other existing
// ingress resources and backends we are not aware of.
...
...
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