Skip to content

Commit a32f852

Browse files
committed
Check for PublishMode=="ingress" before configuring ELB
Signed-off-by: Madhu Venugopal <[email protected]>
1 parent 0d68e08 commit a32f852

File tree

8 files changed

+19
-17
lines changed

8 files changed

+19
-17
lines changed

pkg/loadbalancer/docker.go

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,17 +3,18 @@ package loadbalancer
33
import (
44
"crypto/tls"
55
"fmt"
6-
log "github.com/Sirupsen/logrus"
7-
"github.com/docker/engine-api/client"
8-
"github.com/docker/go-connections/sockets"
9-
"github.com/docker/go-connections/tlsconfig"
106
"net/http"
117
"os"
128
"runtime"
9+
10+
log "github.com/Sirupsen/logrus"
11+
"github.com/docker/docker/client"
12+
"github.com/docker/go-connections/sockets"
13+
"github.com/docker/go-connections/tlsconfig"
1314
)
1415

1516
const (
16-
clientVersion = "1.24"
17+
clientVersion = "1.25"
1718
)
1819

1920
// NewDockerClient creates a new API client.

pkg/loadbalancer/info.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ package loadbalancer
22

33
import (
44
log "github.com/Sirupsen/logrus"
5-
"github.com/docker/engine-api/client"
5+
"github.com/docker/docker/client"
66
"golang.org/x/net/context"
77
)
88

pkg/loadbalancer/listener.go

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,12 @@ package loadbalancer
22

33
import (
44
"fmt"
5-
log "github.com/Sirupsen/logrus"
6-
"github.com/docker/engine-api/types/swarm"
75
"net/url"
86
"strconv"
97
"strings"
8+
9+
log "github.com/Sirupsen/logrus"
10+
"github.com/docker/docker/api/types/swarm"
1011
)
1112

1213
type listener struct {
@@ -131,7 +132,7 @@ func listenersFromExposedPorts(service swarm.Service) []*listener {
131132
requestedPublishPorts := map[uint32]uint32{} // key - target port Y (app/container port), value = publish port X
132133
if service.Spec.EndpointSpec != nil {
133134
for _, p := range service.Spec.EndpointSpec.Ports {
134-
if p.PublishedPort > 0 {
135+
if p.PublishedPort > 0 && strings.EqualFold(string(p.PublishMode), "ingress") {
135136
// Only if the user has specify the desired publish port
136137
requestedPublishPorts[p.TargetPort] = p.PublishedPort
137138
}

pkg/loadbalancer/listener_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
package loadbalancer
22

33
import (
4-
"github.com/docker/engine-api/types/swarm"
4+
"github.com/docker/docker/types/swarm"
55
"github.com/stretchr/testify/require"
66
"testing"
77
)

pkg/loadbalancer/poll.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@ package loadbalancer
22

33
import (
44
log "github.com/Sirupsen/logrus"
5-
"github.com/docker/engine-api/client"
6-
"github.com/docker/engine-api/types"
7-
"github.com/docker/engine-api/types/swarm"
5+
"github.com/docker/docker/api/types"
6+
"github.com/docker/docker/api/types/swarm"
7+
"github.com/docker/docker/client"
88
"golang.org/x/net/context"
99
"reflect"
1010
"sync"

pkg/loadbalancer/poll_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
package loadbalancer
22

33
import (
4-
mock_client "github.com/docker/editions/mock/docker/engine-api/client"
5-
"github.com/docker/engine-api/types/swarm"
4+
"github.com/docker/docker/api/types/swarm"
5+
mock_client "github.com/docker/editions/mock/docker/docker/client"
66
"github.com/golang/mock/gomock"
77
"github.com/stretchr/testify/require"
88
"golang.org/x/net/context"

pkg/loadbalancer/services.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ package loadbalancer
33
import (
44
"fmt"
55
log "github.com/Sirupsen/logrus"
6-
"github.com/docker/engine-api/types/swarm"
6+
"github.com/docker/docker/api/types/swarm"
77
"time"
88
)
99

pkg/loadbalancer/services_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
package loadbalancer
22

33
import (
4-
"github.com/docker/engine-api/types/swarm"
4+
"github.com/docker/docker/api/types/swarm"
55
"github.com/stretchr/testify/require"
66
"testing"
77
)

0 commit comments

Comments
 (0)