Skip to content

Commit b5ca5a6

Browse files
authored
Merge pull request #19 from Mirantis/ivan4th/k8s-1.11
Support k8s 1.11
2 parents 0e9db74 + 8a4cfcb commit b5ca5a6

File tree

3 files changed

+27
-5
lines changed

3 files changed

+27
-5
lines changed

.circleci/config.yml

+14
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,11 @@ jobs:
8484
environment:
8585
K8S_VERSION: "1.10"
8686

87+
deployment-test-1.11:
88+
<<: *deployment_test
89+
environment:
90+
K8S_VERSION: "1.11"
91+
8792
workflows:
8893
version: 2
8994
build-test-and-publish:
@@ -118,13 +123,22 @@ workflows:
118123
only: /^v.*/
119124
branches:
120125
only: /.*/
126+
- deployment-test-1.11:
127+
requires:
128+
- build
129+
filters:
130+
tags:
131+
only: /^v.*/
132+
branches:
133+
only: /.*/
121134

122135
- publish:
123136
requires:
124137
- build
125138
- deployment-test-1.8
126139
- deployment-test-1.9
127140
- deployment-test-1.10
141+
- deployment-test-1.11
128142
filters:
129143
tags:
130144
only: /v.*/

pkg/proxy/proxy.go

+9-1
Original file line numberDiff line numberDiff line change
@@ -206,7 +206,15 @@ func (r *RuntimeProxy) clientForImage(image string, noErrorIfNotConnected bool)
206206
}
207207

208208
func (r *RuntimeProxy) fixStreamingUrl(url string) string {
209-
if strings.HasPrefix(url, "/") {
209+
// The URLs provided by dockershim in k8s 1.11+ look like this:
210+
// //[::]:35057/cri/exec/tb8rgDBh
211+
// These can be passed as-is to the client because they
212+
// include the port.
213+
// In k8s 1.10-, the following URLs are passed:
214+
// /cri/exec/94B_NhGa
215+
// These need to be replaced to make exec/attach work with
216+
// dockershim.
217+
if strings.HasPrefix(url, "/") && !strings.Contains(url, ":") {
210218
u := r.streamUrl
211219
u.Path = url
212220
return u.String()

pkg/proxy/proxy_test.go

+4-4
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ func newProxyTester(t *testing.T, secondSocketSpec string, fakeCriServerMakers [
9898
journal := proxytest.NewSimpleJournal()
9999
servers := []proxytest.FakeCriServer{
100100
fakeCriServerMakers[0](proxytest.NewPrefixJournal(journal, "1/"), "/cri"),
101-
fakeCriServerMakers[1](proxytest.NewPrefixJournal(journal, "2/"), "http://192.168.0.5:12345/stream"),
101+
fakeCriServerMakers[1](proxytest.NewPrefixJournal(journal, "2/"), "//[::]:12345/stream"),
102102
}
103103

104104
fakeImageNames1 := []string{"image1-1", "image1-2"}
@@ -1054,7 +1054,7 @@ func verifyCRIProxy(t *testing.T, secondSocketSpec string, useNewCriVersionForPr
10541054
Cmd: []string{"ls"},
10551055
},
10561056
resp: &runtimeapi.ExecResponse{
1057-
Url: "http://192.168.0.5:12345/stream",
1057+
Url: "//[::]:12345/stream",
10581058
},
10591059
journal: []string{"2/runtime/Exec"},
10601060
},
@@ -1076,7 +1076,7 @@ func verifyCRIProxy(t *testing.T, secondSocketSpec string, useNewCriVersionForPr
10761076
ContainerId: containerId2,
10771077
},
10781078
resp: &runtimeapi.AttachResponse{
1079-
Url: "http://192.168.0.5:12345/stream",
1079+
Url: "//[::]:12345/stream",
10801080
},
10811081
journal: []string{"2/runtime/Attach"},
10821082
},
@@ -1100,7 +1100,7 @@ func verifyCRIProxy(t *testing.T, secondSocketSpec string, useNewCriVersionForPr
11001100
Port: []int32{80},
11011101
},
11021102
resp: &runtimeapi.PortForwardResponse{
1103-
Url: "http://192.168.0.5:12345/stream",
1103+
Url: "//[::]:12345/stream",
11041104
},
11051105
journal: []string{"2/runtime/PortForward"},
11061106
},

0 commit comments

Comments
 (0)