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
f057be81
Commit
f057be81
authored
Mar 27, 2018
by
Ashley Gau
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add http2 <-> https conversion test
parent
7f62dd2e
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
155 additions
and
0 deletions
+155
-0
ingress.go
test/e2e/network/ingress.go
+113
-0
ing.yaml
test/e2e/testing-manifests/ingress/http2/ing.yaml
+9
-0
rc.yaml
test/e2e/testing-manifests/ingress/http2/rc.yaml
+16
-0
svc.yaml
test/e2e/testing-manifests/ingress/http2/svc.yaml
+17
-0
No files found.
test/e2e/network/ingress.go
View file @
f057be81
...
...
@@ -564,6 +564,119 @@ var _ = SIGDescribe("Loadbalancing: L7", func() {
})
})
Describe
(
"GCE [Slow] [Feature:HTTP2]"
,
func
()
{
var
gceController
*
framework
.
GCEIngressController
// Platform specific setup
BeforeEach
(
func
()
{
framework
.
SkipUnlessProviderIs
(
"gce"
,
"gke"
)
By
(
"Initializing gce controller"
)
gceController
=
&
framework
.
GCEIngressController
{
Ns
:
ns
,
Client
:
jig
.
Client
,
Cloud
:
framework
.
TestContext
.
CloudConfig
,
}
err
:=
gceController
.
Init
()
Expect
(
err
)
.
NotTo
(
HaveOccurred
())
})
// Platform specific cleanup
AfterEach
(
func
()
{
if
CurrentGinkgoTestDescription
()
.
Failed
{
framework
.
DescribeIng
(
ns
)
}
if
jig
.
Ingress
==
nil
{
By
(
"No ingress created, no cleanup necessary"
)
return
}
By
(
"Deleting ingress"
)
jig
.
TryDeleteIngress
()
By
(
"Cleaning up cloud resources"
)
Expect
(
gceController
.
CleanupGCEIngressController
())
.
NotTo
(
HaveOccurred
())
})
It
(
"should be able to switch between HTTPS and HTTP2 modes"
,
func
()
{
By
(
"Create a basic HTTP2 ingress"
)
jig
.
CreateIngress
(
filepath
.
Join
(
framework
.
IngressManifestPath
,
"http2"
),
ns
,
map
[
string
]
string
{},
map
[
string
]
string
{})
jig
.
WaitForIngress
(
true
)
address
,
err
:=
jig
.
WaitForIngressAddress
(
jig
.
Client
,
jig
.
Ingress
.
Namespace
,
jig
.
Ingress
.
Name
,
framework
.
LoadBalancerPollTimeout
)
By
(
fmt
.
Sprintf
(
"Polling on address %s and verify the backend is serving HTTP2"
,
address
))
timeoutClient
:=
&
http
.
Client
{
Timeout
:
framework
.
IngressReqTimeout
}
err
=
wait
.
PollImmediate
(
framework
.
LoadBalancerPollInterval
,
framework
.
LoadBalancerPollTimeout
,
func
()
(
bool
,
error
)
{
resp
,
err
:=
framework
.
SimpleGET
(
timeoutClient
,
fmt
.
Sprintf
(
"http://%s"
,
address
),
""
)
if
err
!=
nil
{
framework
.
Logf
(
"SimpleGET failed: %v"
,
err
)
return
false
,
nil
}
if
!
strings
.
Contains
(
resp
,
"request_version=2"
)
{
return
false
,
fmt
.
Errorf
(
"request wasn't served by HTTP2, response body: %s"
,
resp
)
}
if
!
strings
.
Contains
(
resp
,
"request_scheme=https"
)
{
return
false
,
fmt
.
Errorf
(
"request wasn't served by HTTPS, response body: %s"
,
resp
)
}
framework
.
Logf
(
"Poll succeeded, request was served by HTTP2"
)
return
true
,
nil
})
Expect
(
err
)
.
NotTo
(
HaveOccurred
(),
"Failed to get HTTP2"
)
By
(
"Switch backend service to use HTTPS"
)
svcList
,
err
:=
f
.
ClientSet
.
CoreV1
()
.
Services
(
ns
)
.
List
(
metav1
.
ListOptions
{})
Expect
(
err
)
.
NotTo
(
HaveOccurred
())
for
_
,
svc
:=
range
svcList
.
Items
{
svc
.
Annotations
[
framework
.
ServiceApplicationProtocolKey
]
=
`{"http2":"HTTPS"}`
_
,
err
=
f
.
ClientSet
.
CoreV1
()
.
Services
(
ns
)
.
Update
(
&
svc
)
Expect
(
err
)
.
NotTo
(
HaveOccurred
())
}
resp
:=
""
err
=
wait
.
PollImmediate
(
framework
.
LoadBalancerPollInterval
,
framework
.
LoadBalancerPollTimeout
,
func
()
(
bool
,
error
)
{
resp
,
err
=
framework
.
SimpleGET
(
timeoutClient
,
fmt
.
Sprintf
(
"http://%s"
,
address
),
""
)
if
err
!=
nil
{
framework
.
Logf
(
"SimpleGET failed: %v"
,
err
)
return
false
,
nil
}
if
!
strings
.
Contains
(
resp
,
"request_version=1.1"
)
{
framework
.
Logf
(
"Waiting for transition to HTTP/1"
)
return
false
,
nil
}
framework
.
Logf
(
"Poll succeeded, request was served by HTTP"
)
return
true
,
nil
})
Expect
(
err
)
.
NotTo
(
HaveOccurred
(),
fmt
.
Sprintf
(
"Failed to get HTTP, response body: %v"
,
resp
))
By
(
"Switch backend service to use HTTP2"
)
svcList
,
err
=
f
.
ClientSet
.
CoreV1
()
.
Services
(
ns
)
.
List
(
metav1
.
ListOptions
{})
Expect
(
err
)
.
NotTo
(
HaveOccurred
())
for
_
,
svc
:=
range
svcList
.
Items
{
svc
.
Annotations
[
framework
.
ServiceApplicationProtocolKey
]
=
`{"http2":"HTTP2"}`
_
,
err
=
f
.
ClientSet
.
CoreV1
()
.
Services
(
ns
)
.
Update
(
&
svc
)
Expect
(
err
)
.
NotTo
(
HaveOccurred
())
}
timeoutClient
=
&
http
.
Client
{
Timeout
:
framework
.
IngressReqTimeout
}
err
=
wait
.
PollImmediate
(
framework
.
LoadBalancerPollInterval
,
framework
.
LoadBalancerPollTimeout
,
func
()
(
bool
,
error
)
{
resp
,
err
=
framework
.
SimpleGET
(
timeoutClient
,
fmt
.
Sprintf
(
"http://%s"
,
address
),
""
)
if
err
!=
nil
{
framework
.
Logf
(
"SimpleGET failed: %v"
,
err
)
return
false
,
nil
}
if
!
strings
.
Contains
(
resp
,
"request_version=2"
)
{
framework
.
Logf
(
"Waiting for transition to HTTP/2"
)
return
false
,
nil
}
if
!
strings
.
Contains
(
resp
,
"request_scheme=https"
)
{
return
false
,
nil
}
framework
.
Logf
(
"Poll succeeded, request was served by HTTP2"
)
return
true
,
nil
})
Expect
(
err
)
.
NotTo
(
HaveOccurred
(),
fmt
.
Sprintf
(
"Failed to get HTTP2, response body: %v"
,
resp
))
})
})
Describe
(
"GCE [Slow] [Feature:kubemci]"
,
func
()
{
var
gceController
*
framework
.
GCEIngressController
var
ipName
,
ipAddress
string
...
...
test/e2e/testing-manifests/ingress/http2/ing.yaml
0 → 100644
View file @
f057be81
apiVersion
:
extensions/v1beta1
kind
:
Ingress
metadata
:
name
:
echomap
spec
:
# kubemci requires a default backend.
backend
:
serviceName
:
echoheaders
servicePort
:
443
test/e2e/testing-manifests/ingress/http2/rc.yaml
0 → 100644
View file @
f057be81
apiVersion
:
extensions/v1beta1
kind
:
Deployment
metadata
:
name
:
echoheaders
spec
:
replicas
:
1
template
:
metadata
:
labels
:
app
:
echoheaders
spec
:
containers
:
-
name
:
echoheaders
image
:
k8s.gcr.io/echoserver:1.10
ports
:
-
containerPort
:
8443
test/e2e/testing-manifests/ingress/http2/svc.yaml
0 → 100644
View file @
f057be81
apiVersion
:
v1
kind
:
Service
metadata
:
annotations
:
service.alpha.kubernetes.io/app-protocols
:
'
{"http2":"HTTP2"}'
name
:
echoheaders
labels
:
app
:
echoheaders
spec
:
type
:
NodePort
ports
:
-
port
:
443
targetPort
:
8443
protocol
:
TCP
name
:
http2
selector
:
app
:
echoheaders
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