mirror of
https://github.com/openziti/ziti.git
synced 2026-10-12 15:28:05 +00:00
Update tunneler service polling
This commit is contained in:
@@ -1,3 +1,13 @@
|
||||
# Release 0.18.7
|
||||
|
||||
## What's New
|
||||
|
||||
* Update ziti-tunnel service polling
|
||||
* Now uses new api (when available) to skip refreshing services if no services have been changed
|
||||
* Polling rate is passed through to sdk, so actual poll rate is now controlled
|
||||
* Don't panic on router startup, just show error message and exit
|
||||
|
||||
|
||||
# Release 0.18.6
|
||||
|
||||
## What's New
|
||||
|
||||
@@ -24,10 +24,10 @@ require (
|
||||
github.com/influxdata/influxdb1-client v0.0.0-20191209144304-8bf82d3c094d
|
||||
github.com/keybase/go-ps v0.0.0-20190827175125-91aafc93ba19
|
||||
github.com/michaelquigley/pfxlog v0.3.6
|
||||
github.com/openziti/edge v0.17.53
|
||||
github.com/openziti/edge v0.17.54
|
||||
github.com/openziti/fabric v0.15.15
|
||||
github.com/openziti/foundation v0.15.9
|
||||
github.com/openziti/sdk-golang v0.15.12
|
||||
github.com/openziti/sdk-golang v0.15.13
|
||||
github.com/pborman/uuid v1.2.0
|
||||
github.com/pkg/errors v0.9.1
|
||||
github.com/rcrowley/go-metrics v0.0.0-20200313005456-10cdbea86bc0
|
||||
|
||||
@@ -520,13 +520,14 @@ github.com/onsi/gomega v1.10.1 h1:o0+MgICZLuZ7xjH7Vx6zS/zcu93/BEp1VwkIW1mEXCE=
|
||||
github.com/onsi/gomega v1.10.1/go.mod h1:iN09h71vgCQne3DLsj+A5owkum+a2tYe+TOCB1ybHNo=
|
||||
github.com/opentracing/opentracing-go v1.2.0/go.mod h1:GxEUsuufX4nBwe+T+Wl9TAgYrxe9dPLANfrWvHYVTgc=
|
||||
github.com/openzipkin/zipkin-go v0.1.1/go.mod h1:NtoC/o8u3JlF1lSlyPNswIbeQH9bJTmOf0Erfk+hxe8=
|
||||
github.com/openziti/edge v0.17.53 h1:LJ2G6x/M+ZG+89yBHLdnKumXmkMIwnl+4LX53Bteb6g=
|
||||
github.com/openziti/edge v0.17.53/go.mod h1:irZJtq0WjOr/kNm35SZQopCxN7EenQsHctFXLxSAZ/U=
|
||||
github.com/openziti/edge v0.17.54 h1:23l6VwZGSYaTDRD68N0SDKvw04J010Znxu1LMEjXy1Q=
|
||||
github.com/openziti/edge v0.17.54/go.mod h1:pHFEpTmILwipHcmvMzSYDKLaWGgb5Iob/4CHp8UdppQ=
|
||||
github.com/openziti/fabric v0.15.15 h1:TvUnRoVmGQ/Uj0MAbLkJgEGaaEC5aDxU9UiXpT2N7/Q=
|
||||
github.com/openziti/fabric v0.15.15/go.mod h1:H2bwevoCxvJxr3xIsG9AQq9Wy+rxOMNrJTQaPzj/Pas=
|
||||
github.com/openziti/foundation v0.15.9 h1:Do/wohULRt+3H6mlB8SZmIUl/mbxUuN7/Lf7nbz6ZRo=
|
||||
github.com/openziti/foundation v0.15.9/go.mod h1:34ifQ24R2EUNjakzZBKY1M4EvnOWeIYJOrJxRGdRNh4=
|
||||
github.com/openziti/sdk-golang v0.15.11/go.mod h1:L1UbvXUV7DV6a3pd50CAJqtt9z6nN53p2cKNJlHZXR8=
|
||||
github.com/openziti/sdk-golang v0.15.12 h1:RDkqznApxSzbftAHsf99fHwSBdSAEKV21TgemjqYKA0=
|
||||
github.com/openziti/sdk-golang v0.15.12/go.mod h1:L1UbvXUV7DV6a3pd50CAJqtt9z6nN53p2cKNJlHZXR8=
|
||||
github.com/openziti/sdk-golang v0.15.13 h1:Pd5WqFcPxrM8o/VeqCoKeGCgL+pC9Y5dVb1tqMhRprI=
|
||||
github.com/openziti/sdk-golang v0.15.13/go.mod h1:L1UbvXUV7DV6a3pd50CAJqtt9z6nN53p2cKNJlHZXR8=
|
||||
github.com/orcaman/concurrent-map v0.0.0-20190826125027-8c72a8bb44f6 h1:lNCW6THrCKBiJBpz8kbVGjC7MgdCGKwuvBgc7LoD6sw=
|
||||
github.com/orcaman/concurrent-map v0.0.0-20190826125027-8c72a8bb44f6/go.mod h1:Lu3tH6HLW3feq74c2GC+jIMS/K2CFcDWnWD9XkenwhI=
|
||||
github.com/pascaldekloe/goe v0.0.0-20180627143212-57f6aae5913c/go.mod h1:lzWF7FIEvWOWxwDKqyGYQf6ZUaNfKdP144TG7ZOy1lc=
|
||||
|
||||
@@ -62,11 +62,11 @@ func run(cmd *cobra.Command, args []string) {
|
||||
xgress.GlobalRegistry().Register(xgress_edge_transport.BindingName, xgressEdgeTransportFactory)
|
||||
|
||||
if err := r.Run(); err != nil {
|
||||
logrus.Panicf("error starting (%v)", err)
|
||||
logrus.WithError(err).Fatal("error starting")
|
||||
}
|
||||
|
||||
} else {
|
||||
logrus.Panicf("error loading configuration (%v)", err)
|
||||
logrus.WithError(err).Fatal("error loading configuration")
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -24,6 +24,7 @@ import (
|
||||
"github.com/openziti/foundation/agent"
|
||||
"github.com/openziti/sdk-golang/ziti"
|
||||
"github.com/openziti/sdk-golang/ziti/config"
|
||||
"github.com/openziti/sdk-golang/ziti/edge"
|
||||
"github.com/openziti/ziti/common/enrollment"
|
||||
"github.com/sirupsen/logrus"
|
||||
"github.com/spf13/cobra"
|
||||
@@ -91,6 +92,11 @@ func rootPreRun(cmd *cobra.Command, _ []string) {
|
||||
}
|
||||
}
|
||||
|
||||
type serviceChangeEvent struct {
|
||||
eventType config.ServiceEventType
|
||||
service *edge.Service
|
||||
}
|
||||
|
||||
func rootPostRun(cmd *cobra.Command, _ []string) {
|
||||
log := pfxlog.Logger()
|
||||
|
||||
@@ -109,16 +115,40 @@ func rootPostRun(cmd *cobra.Command, _ []string) {
|
||||
entities.ClientConfigV1,
|
||||
entities.ServerConfigV1,
|
||||
}
|
||||
rootPrivateContext := ziti.NewContextWithConfig(zitiCfg)
|
||||
|
||||
var serviceListener *intercept.ServiceListener
|
||||
var serviceEventsC = make(chan *serviceChangeEvent)
|
||||
|
||||
svcPollRate, _ := cmd.Flags().GetUint(svcPollRateFlag)
|
||||
options := &config.Options{
|
||||
RefreshInterval: time.Duration(svcPollRate) * time.Second,
|
||||
OnServiceUpdate: func(eventType config.ServiceEventType, service *edge.Service) {
|
||||
serviceEventsC <- &serviceChangeEvent{
|
||||
eventType: eventType,
|
||||
service: service,
|
||||
}
|
||||
},
|
||||
}
|
||||
|
||||
rootPrivateContext := ziti.NewContextWithOpts(zitiCfg, options)
|
||||
|
||||
resolverConfig := cmd.Flag("resolver").Value.String()
|
||||
resolver = dns.NewResolver(resolverConfig)
|
||||
dnsIpRange, _ := cmd.Flags().GetString(dnsSvcIpRangeFlag)
|
||||
err = intercept.SetDnsInterceptIpRange(dnsIpRange)
|
||||
if err != nil {
|
||||
if err = intercept.SetDnsInterceptIpRange(dnsIpRange); err != nil {
|
||||
log.Fatalf("invalid dns service IP range %s: %v", dnsIpRange, err)
|
||||
}
|
||||
|
||||
intercept.ServicePoller(rootPrivateContext, interceptor, resolver, time.Duration(svcPollRate)*time.Second)
|
||||
interceptor.Start(rootPrivateContext)
|
||||
serviceListener = intercept.NewServiceListener(rootPrivateContext, interceptor, resolver)
|
||||
|
||||
go func() {
|
||||
for event := range serviceEventsC {
|
||||
serviceListener.HandleServicesChange(event.eventType, event.service)
|
||||
}
|
||||
}()
|
||||
if err = rootPrivateContext.Authenticate(); err != nil {
|
||||
log.WithError(err).Fatal("failed to authenticate")
|
||||
}
|
||||
serviceListener.WaitForShutdown()
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user