Skip to content

Commit

Permalink
Attach to https in merlin (#173)
Browse files Browse the repository at this point in the history
Also some small improvements:
* Expose the merlin request timeout, so it's easy to change if necessary
* Make deregistration more resilient, which could fail due to the long lived grpc connection getting killed. Instead, create and close connections on demand.
  • Loading branch information
jsravn authored Apr 6, 2018
1 parent 3b069d1 commit 24b40b5
Show file tree
Hide file tree
Showing 20 changed files with 276 additions and 143 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
# v1.9.3
* Attach to https in addition to http for merlin.
* Fix merlin deregistration, which was failing due to long lived connections getting killed.

# v1.9.2
* Bug fix for merlin attacher - fix netlink and capabilities for feed-ingress.

Expand Down
19 changes: 12 additions & 7 deletions Gopkg.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 4 additions & 0 deletions Gopkg.toml
Original file line number Diff line number Diff line change
Expand Up @@ -28,3 +28,7 @@
[prune]
go-tests = true
unused-packages = true

[[constraint]]
branch = "master"
name = "github.com/onrik/logrus"
2 changes: 1 addition & 1 deletion alb/alb.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,11 @@ import (

"time"

log "github.com/Sirupsen/logrus"
"github.com/aws/aws-sdk-go/aws"
"github.com/aws/aws-sdk-go/aws/ec2metadata"
"github.com/aws/aws-sdk-go/aws/session"
aws_alb "github.com/aws/aws-sdk-go/service/elbv2"
log "github.com/sirupsen/logrus"
"github.com/sky-uk/feed/controller"
"github.com/sky-uk/feed/util"
)
Expand Down
2 changes: 1 addition & 1 deletion cmd/feed-dns/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import (

"time"

log "github.com/Sirupsen/logrus"
log "github.com/sirupsen/logrus"
"github.com/sky-uk/feed/controller"
"github.com/sky-uk/feed/dns"
"github.com/sky-uk/feed/dns/adapter"
Expand Down
31 changes: 19 additions & 12 deletions cmd/feed-ingress/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import (
"strconv"
"strings"

log "github.com/Sirupsen/logrus"
log "github.com/sirupsen/logrus"
"github.com/sky-uk/feed/alb"
"github.com/sky-uk/feed/controller"
"github.com/sky-uk/feed/elb"
Expand Down Expand Up @@ -60,9 +60,10 @@ var (
gorbBackendHealthcheckType string
gorbInterfaceProcFsPath string
merlinEndpoint string
merlinRequestTimeout time.Duration
merlinServiceID string
merlinHTTPSServiceID string
merlinInstanceIP string
merlinInstancePort uint
merlinForwardMethod string
merlinDrainDelay time.Duration
merlinHealthUpThreshold uint
Expand Down Expand Up @@ -255,9 +256,11 @@ func init() {
flag.StringVar(&merlinEndpoint, "merlin-endpoint", "",
"Merlin gRPC endpoint to connect to. Expected format is scheme://authority/endpoint_name (see "+
"https://github.com/grpc/grpc/blob/master/doc/naming.md). Will load balance between all available servers.")
flag.StringVar(&merlinServiceID, "merlin-service-id", "", "Merlin virtual service ID to attach to.")
flag.DurationVar(&merlinRequestTimeout, "merlin-request-timeout", time.Second*10,
"Timeout for any requests to merlin.")
flag.StringVar(&merlinServiceID, "merlin-service-id", "", "Merlin http virtual service ID to attach to.")
flag.StringVar(&merlinHTTPSServiceID, "merlin-https-service-id", "", "Merlin https virtual service ID to attach to.")
flag.StringVar(&merlinInstanceIP, "merlin-instance-ip", "", "Ingress IP to register with merlin")
flag.UintVar(&merlinInstancePort, "merlin-instance-port", 0, "Ingress port to register with merlin")
flag.StringVar(&merlinForwardMethod, "merlin-forward-method", defaultMerlinForwardMethod, "IPVS forwarding method,"+
" must be one of route, tunnel, or masq.")
flag.DurationVar(&merlinDrainDelay, "merlin-drain-delay", defaultDrainDelay, "Delay to wait after for connections"+
Expand All @@ -271,7 +274,8 @@ func init() {
flag.DurationVar(&merlinHealthTimeout, "merlin-health-timeout", defaultMerlinHealthTimeout,
"The timeout for health checks.")
flag.StringVar(&merlinVIP, "merlin-vip", "", "VIP to assign to loopback to support direct route and tunnel.")
flag.StringVar(&merlinVIPInterface, "merlin-vip-interface", defaultMerlinVIPInterface, "VIP interface to assign the VIP.")
flag.StringVar(&merlinVIPInterface, "merlin-vip-interface", defaultMerlinVIPInterface,
"VIP interface to assign the VIP.")
}

func main() {
Expand Down Expand Up @@ -372,13 +376,16 @@ func createIngressUpdaters() ([]controller.Updater, error) {

case "merlin":
config := merlin.Config{
Endpoint: merlinEndpoint,
ServiceID: merlinServiceID,
InstanceIP: merlinInstanceIP,
InstancePort: uint16(merlinInstancePort),
ForwardMethod: merlinForwardMethod,
DrainDelay: merlinDrainDelay,
HealthPort: uint16(ingressHealthPort),
Endpoint: merlinEndpoint,
Timeout: merlinRequestTimeout,
ServiceID: merlinServiceID,
HTTPSServiceID: merlinHTTPSServiceID,
InstanceIP: merlinInstanceIP,
InstancePort: uint16(ingressPort),
InstanceHTTPSPort: uint16(ingressHTTPSPort),
ForwardMethod: merlinForwardMethod,
DrainDelay: merlinDrainDelay,
HealthPort: uint16(ingressHealthPort),
// This value is hardcoded into the nginx template.
HealthPath: "health",
HealthUpThreshold: uint32(merlinHealthUpThreshold),
Expand Down
2 changes: 1 addition & 1 deletion controller/controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import (

"errors"

log "github.com/Sirupsen/logrus"
log "github.com/sirupsen/logrus"
"github.com/sky-uk/feed/k8s"
"github.com/sky-uk/feed/util"
"k8s.io/client-go/pkg/api/v1"
Expand Down
2 changes: 1 addition & 1 deletion dns/dns_updater.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ import (

"strings"

log "github.com/Sirupsen/logrus"
"github.com/aws/aws-sdk-go/service/route53"
log "github.com/sirupsen/logrus"
"github.com/sky-uk/feed/controller"
"github.com/sky-uk/feed/dns/adapter"
"github.com/sky-uk/feed/dns/r53"
Expand Down
2 changes: 1 addition & 1 deletion elb/elb.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,11 @@ import (

"time"

log "github.com/Sirupsen/logrus"
"github.com/aws/aws-sdk-go/aws"
"github.com/aws/aws-sdk-go/aws/ec2metadata"
"github.com/aws/aws-sdk-go/aws/session"
aws_elb "github.com/aws/aws-sdk-go/service/elb"
log "github.com/sirupsen/logrus"
"github.com/sky-uk/feed/controller"
"github.com/sky-uk/feed/util"
)
Expand Down
7 changes: 3 additions & 4 deletions examples/feed-ingress-deployment-merlin.yml
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@ spec:
args:
# Ingress nginx port that frontend will direct traffic towards.
- -ingress-port=80
- -ingress-https-port=443

# Health port on nginx, used by frontend to determine health.
- -ingress-health-port=8081
Expand Down Expand Up @@ -97,15 +98,13 @@ spec:
# gRPC endpoint
- -merlin-endpoint=dns:///merlin-servers

# Virtual Service ID to attach to
# Virtual Service IDs to attach to
- -merlin-service-id=my-virtual-service
- -merlin-https-service-id=my-https-virtual-service

# Real server IP to associate with virtual service - the IP of the ingress node.
- -merlin-instance-ip=$(INSTANCEIP)

# Real server port to associate with virtual service - the port of nginx.
- -merlin-instance-port=80

# Forward method that IPVS should use - pick route, masq, or tunnel.
- -merlin-forward-method=route

Expand Down
2 changes: 1 addition & 1 deletion gorb/gorb.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,9 @@ import (

"strconv"

log "github.com/Sirupsen/logrus"
"github.com/hashicorp/go-multierror"
"github.com/sethgrid/pester"
log "github.com/sirupsen/logrus"
"github.com/sky-uk/feed/controller"
)

Expand Down
2 changes: 1 addition & 1 deletion gorb/gorb_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,10 @@ import (
"net/url"
"testing"

log "github.com/Sirupsen/logrus"
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
"github.com/prometheus/client_golang/prometheus"
log "github.com/sirupsen/logrus"
"github.com/sky-uk/feed/controller"
"github.com/sky-uk/feed/util/metrics"
"github.com/stretchr/testify/mock"
Expand Down
2 changes: 1 addition & 1 deletion k8s/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import (

"errors"

log "github.com/Sirupsen/logrus"
log "github.com/sirupsen/logrus"
"k8s.io/client-go/kubernetes"
"k8s.io/client-go/pkg/api/v1"
"k8s.io/client-go/pkg/apis/extensions/v1beta1"
Expand Down
2 changes: 1 addition & 1 deletion k8s/watcher.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import (

"time"

log "github.com/Sirupsen/logrus"
log "github.com/sirupsen/logrus"
)

// Watcher provides channels for receiving updates. It tries its best to run forever, retrying
Expand Down
Loading

0 comments on commit 24b40b5

Please sign in to comment.