Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Send bind success notifications to the SDK if supported #1579

Merged
merged 3 commits into from
Dec 13, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 6 additions & 3 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,15 +42,18 @@ ziti fabric raft remove-member ctrl3

## Component Updates and Bug Fixes

* github.com/openziti/edge-api: [v0.26.1 -> v0.26.5](https://github.com/openziti/edge-api/compare/v0.26.1...v0.26.5)
* github.com/openziti/edge-api: [v0.26.1 -> v0.26.6](https://github.com/openziti/edge-api/compare/v0.26.1...v0.26.6)
* github.com/openziti/sdk-golang: [v0.20.139 -> v0.21.2](https://github.com/openziti/sdk-golang/compare/v0.20.139...v0.21.2)
* [Issue #465](https://github.com/openziti/sdk-golang/issues/465) - Allow listen options to specify how many listeners need to be established before returning
* [Issue #462](https://github.com/openziti/sdk-golang/issues/462) - Allow refreshing a single service

* github.com/openziti/ziti: [v0.31.2 -> v0.31.3](https://github.com/openziti/ziti/compare/v0.31.2...v0.31.3)
* [Issue #1578](https://github.com/openziti/ziti/issues/1578) - Send BindSuccess notifications to SDK if supported
* [Issue #1544](https://github.com/openziti/ziti/issues/1544) - Support transfer raft leadership via REST
* [Issue #1543](https://github.com/openziti/ziti/issues/1543) - Support add/remove raft peer via REST
* [Issue #1496](https://github.com/openziti/ziti/issues/1496) - Configurable Timer needed to close idle circuits
* [Issue #1402](https://github.com/openziti/ziti/issues/1402) - Allow router to decomission itself



# Release 0.31.2

## What's New
Expand Down
4 changes: 2 additions & 2 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -48,13 +48,13 @@ require (
github.com/natefinch/lumberjack v2.0.0+incompatible
github.com/openziti/agent v1.0.16
github.com/openziti/channel/v2 v2.0.111
github.com/openziti/edge-api v0.26.5
github.com/openziti/edge-api v0.26.6
github.com/openziti/foundation/v2 v2.0.35
github.com/openziti/identity v1.0.68
github.com/openziti/jwks v1.0.3
github.com/openziti/metrics v1.2.40
github.com/openziti/runzmd v1.0.36
github.com/openziti/sdk-golang v0.20.139
github.com/openziti/sdk-golang v0.21.2
github.com/openziti/secretstream v0.1.14
github.com/openziti/storage v0.2.26
github.com/openziti/transport/v2 v2.0.119
Expand Down
8 changes: 4 additions & 4 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -584,8 +584,8 @@ github.com/openziti/channel/v2 v2.0.111 h1:ZZDyUUFcyshitXjUqAMjdAKbaDMpgV7oX1Jp1
github.com/openziti/channel/v2 v2.0.111/go.mod h1:abw0qwT0MzWvh1eI2P6D6CD17PRHL8EEo1d3DHCyCdM=
github.com/openziti/dilithium v0.3.3 h1:PLgQ6PMNLSTzCFbX/h98cmudgz/cU6TmjdSv5NAPD8k=
github.com/openziti/dilithium v0.3.3/go.mod h1:vsCjI2AU/hon9e+dLhUFbCNGesJDj2ASgkySOcpmvjo=
github.com/openziti/edge-api v0.26.5 h1:O360x1ucLiCzibDBIVPEDlW5iZmA1pBVx/kfXKZusH8=
github.com/openziti/edge-api v0.26.5/go.mod h1:JskiZuulHR6CCCGT7P6MLupnC21Reg8viw127F4MRE8=
github.com/openziti/edge-api v0.26.6 h1:qM5XRaYYZxRIkb3xDkAU1D2EkQx8a+oHvCWbd+v0fbA=
github.com/openziti/edge-api v0.26.6/go.mod h1:DX+fKivCRgnl5oxuLLoEx044arhjlgI7peGlqxN+Iks=
github.com/openziti/foundation/v2 v2.0.35 h1:4VaMwZ2kAy6jwBYeQIBN2m8rcGroTDX4A2Jp7NAKb6M=
github.com/openziti/foundation/v2 v2.0.35/go.mod h1:Xnb3IxP1e1UcgLggqSunEpCjH3iHozkPi9Bd9GESbwo=
github.com/openziti/identity v1.0.68 h1:SaFr7BeFQBoWQDiT28vUb8D9w7v6lIAK6/9RkwmV0OU=
Expand All @@ -596,8 +596,8 @@ github.com/openziti/metrics v1.2.40 h1:gySRgR8prCPqaEjmUtX0eXFs7NkI9uPAzp+z6A8+J
github.com/openziti/metrics v1.2.40/go.mod h1:HXdVryf3xpZfnY4VcaOjMxiBv+qw0wJlEJNLbooB9hY=
github.com/openziti/runzmd v1.0.36 h1:HOqTZFzTTFu52qmCAQfFvKDmCSl8ZqP1PQQ0UnJIA4E=
github.com/openziti/runzmd v1.0.36/go.mod h1:jYqummjskmFh63htJFF2SrUuvxNQifqd5REUhYVaY/A=
github.com/openziti/sdk-golang v0.20.139 h1:1TaRTd5KmSrfHR6W3ASuj651o37h4NOXTRC6K53Pf3k=
github.com/openziti/sdk-golang v0.20.139/go.mod h1:z2gUWwonLa+haq40cfsNE2P23RoD+SZhxWulG7w7aI0=
github.com/openziti/sdk-golang v0.21.2 h1:P66cslOAmQX37VFan+df+MoD2PqaFjHWDNMpuhhXHSo=
github.com/openziti/sdk-golang v0.21.2/go.mod h1:mepEUD39DsBm/v1WVLedYRoYCFdet5mmJ5Sxqm/zkFI=
github.com/openziti/secretstream v0.1.14 h1:Ta+nB5Prcct+L5LIKUA1nE56QhWS6lMPQYTlpxUltU0=
github.com/openziti/secretstream v0.1.14/go.mod h1:/hhuLfu+GIv0+cnapfsu/VOnXEvmTt3GKtCu+lQ0RIw=
github.com/openziti/storage v0.2.26 h1:15EbOC6A//dsdLSs/RYJP6Qn3Rj6Od4btXEWGezatxc=
Expand Down
29 changes: 15 additions & 14 deletions router/xgress_edge/fabric.go
Original file line number Diff line number Diff line change
Expand Up @@ -66,20 +66,21 @@ func (self terminatorState) String() string {

type edgeTerminator struct {
edge.MsgChannel
edgeClientConn *edgeClientConn
terminatorId concurrenz.AtomicValue[string]
listenerId string
token string
instance string
instanceSecret []byte
cost uint16
precedence edge_ctrl_pb.TerminatorPrecedence
hostData map[uint32][]byte
assignIds bool
onClose func()
v2 bool
state concurrenz.AtomicValue[terminatorState]
postValidate bool
edgeClientConn *edgeClientConn
terminatorId concurrenz.AtomicValue[string]
listenerId string
token string
instance string
instanceSecret []byte
cost uint16
precedence edge_ctrl_pb.TerminatorPrecedence
hostData map[uint32][]byte
assignIds bool
onClose func()
v2 bool
state concurrenz.AtomicValue[terminatorState]
postValidate bool
notifyEstablished bool
}

func (self *edgeTerminator) inspect(fixInvalidTerminators bool) (*edge.InspectResult, error) {
Expand Down
4 changes: 3 additions & 1 deletion router/xgress_edge/factory.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ import (
"github.com/openziti/channel/v2"
"github.com/openziti/foundation/v2/versions"
"github.com/openziti/metrics"
"github.com/openziti/sdk-golang/ziti/edge"
"github.com/openziti/transport/v2"
"github.com/openziti/ziti/common/pb/edge_ctrl_pb"
"github.com/openziti/ziti/router"
Expand Down Expand Up @@ -156,7 +157,8 @@ func (factory *Factory) CreateListener(optionsData xgress.OptionsData) (xgress.L
}

headers := map[int32][]byte{
channel.HelloVersionHeader: versionHeader,
channel.HelloVersionHeader: versionHeader,
edge.SupportsBindSuccessHeader: {1},
}

return newListener(factory.env.GetRouterId(), factory, options, headers), nil
Expand Down
11 changes: 11 additions & 0 deletions router/xgress_edge/hosted.go
Original file line number Diff line number Diff line change
Expand Up @@ -319,6 +319,17 @@ func (self *hostedServiceRegistry) HandleCreateTerminatorResponse(msg *channel.M
} else {
log.Info("received additional terminator created notification")
}

if terminator.notifyEstablished {
go func() {
notifyMsg := channel.NewMessage(edge.ContentTypeBindSuccess, nil)
notifyMsg.PutUint32Header(edge.ConnIdHeader, terminator.MsgChannel.Id())

if err := notifyMsg.WithTimeout(time.Second * 30).Send(terminator.MsgChannel.Channel); err != nil {
log.WithError(err).Error("failed to send bind success")
}
}()
}
}

func (self *hostedServiceRegistry) waitForTerminatorCreated(id string, timeout time.Duration) bool {
Expand Down
29 changes: 14 additions & 15 deletions router/xgress_edge/listener.go
Original file line number Diff line number Diff line change
Expand Up @@ -387,23 +387,22 @@ func (self *edgeClientConn) processBindV2(req *channel.Message, ch channel.Chann
hostData[edge.PublicKeyHeader] = pubKey
}

postValidate := false
if supportsInspect, _ := req.GetBoolHeader(edge.SupportsInspectHeader); supportsInspect {
postValidate = true
}
postValidate, _ := req.GetBoolHeader(edge.SupportsInspectHeader)
notifyEstablished, _ := req.GetBoolHeader(edge.SupportsBindSuccessHeader)

terminator := &edgeTerminator{
MsgChannel: *edge.NewEdgeMsgChannel(self.ch, connId),
edgeClientConn: self,
token: token,
cost: cost,
precedence: precedence,
instance: terminatorInstance,
instanceSecret: terminatorInstanceSecret,
hostData: hostData,
assignIds: assignIds,
v2: true,
postValidate: postValidate,
MsgChannel: *edge.NewEdgeMsgChannel(self.ch, connId),
edgeClientConn: self,
token: token,
cost: cost,
precedence: precedence,
instance: terminatorInstance,
instanceSecret: terminatorInstanceSecret,
hostData: hostData,
assignIds: assignIds,
v2: true,
postValidate: postValidate,
notifyEstablished: notifyEstablished,
}
terminator.terminatorId.Store(terminatorId)

Expand Down
7 changes: 2 additions & 5 deletions tests/addressable_terminators_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,9 +39,6 @@ func Test_AddressableTerminators(t *testing.T) {

ctx.CreateEnrollAndStartEdgeRouter()

watcher := ctx.AdminManagementSession.newTerminatorWatcher()
defer watcher.Close()

type host struct {
id *identity
context ziti.Context
Expand All @@ -59,10 +56,10 @@ func Test_AddressableTerminators(t *testing.T) {
defer host.context.Close()

host.listener, err = host.context.ListenWithOptions(service.Name, &ziti.ListenOptions{
BindUsingEdgeIdentity: true,
BindUsingEdgeIdentity: true,
WaitForNEstablishedListeners: 1,
})
ctx.Req.NoError(err)
watcher.waitForTerminators(service.Id, 1, 5*time.Second)
}

type client struct {
Expand Down
4 changes: 2 additions & 2 deletions zititest/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ require (
github.com/openziti/fablab v0.5.32
github.com/openziti/foundation/v2 v2.0.35
github.com/openziti/identity v1.0.68
github.com/openziti/sdk-golang v0.20.139
github.com/openziti/sdk-golang v0.21.2
github.com/openziti/storage v0.2.26
github.com/openziti/transport/v2 v2.0.119
github.com/openziti/ziti v0.28.3
Expand Down Expand Up @@ -129,7 +129,7 @@ require (
github.com/oliveagle/jsonpath v0.0.0-20180606110733-2e52cf6e6852 // indirect
github.com/opentracing/opentracing-go v1.2.0 // indirect
github.com/openziti/dilithium v0.3.3 // indirect
github.com/openziti/edge-api v0.26.5 // indirect
github.com/openziti/edge-api v0.26.6 // indirect
github.com/openziti/jwks v1.0.3 // indirect
github.com/openziti/metrics v1.2.40 // indirect
github.com/openziti/runzmd v1.0.36 // indirect
Expand Down
8 changes: 4 additions & 4 deletions zititest/go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -596,8 +596,8 @@ github.com/openziti/channel/v2 v2.0.111 h1:ZZDyUUFcyshitXjUqAMjdAKbaDMpgV7oX1Jp1
github.com/openziti/channel/v2 v2.0.111/go.mod h1:abw0qwT0MzWvh1eI2P6D6CD17PRHL8EEo1d3DHCyCdM=
github.com/openziti/dilithium v0.3.3 h1:PLgQ6PMNLSTzCFbX/h98cmudgz/cU6TmjdSv5NAPD8k=
github.com/openziti/dilithium v0.3.3/go.mod h1:vsCjI2AU/hon9e+dLhUFbCNGesJDj2ASgkySOcpmvjo=
github.com/openziti/edge-api v0.26.5 h1:O360x1ucLiCzibDBIVPEDlW5iZmA1pBVx/kfXKZusH8=
github.com/openziti/edge-api v0.26.5/go.mod h1:JskiZuulHR6CCCGT7P6MLupnC21Reg8viw127F4MRE8=
github.com/openziti/edge-api v0.26.6 h1:qM5XRaYYZxRIkb3xDkAU1D2EkQx8a+oHvCWbd+v0fbA=
github.com/openziti/edge-api v0.26.6/go.mod h1:DX+fKivCRgnl5oxuLLoEx044arhjlgI7peGlqxN+Iks=
github.com/openziti/fablab v0.5.32 h1:F2n3m+EZ9ulXUnnox2x6SjsuYQkuNnSao62FaLhLSUA=
github.com/openziti/fablab v0.5.32/go.mod h1:qgW8yiZ7lXuE0FZ85pL4t4ohD5JAnNU1r4EdGLs2TM4=
github.com/openziti/foundation/v2 v2.0.35 h1:4VaMwZ2kAy6jwBYeQIBN2m8rcGroTDX4A2Jp7NAKb6M=
Expand All @@ -610,8 +610,8 @@ github.com/openziti/metrics v1.2.40 h1:gySRgR8prCPqaEjmUtX0eXFs7NkI9uPAzp+z6A8+J
github.com/openziti/metrics v1.2.40/go.mod h1:HXdVryf3xpZfnY4VcaOjMxiBv+qw0wJlEJNLbooB9hY=
github.com/openziti/runzmd v1.0.36 h1:HOqTZFzTTFu52qmCAQfFvKDmCSl8ZqP1PQQ0UnJIA4E=
github.com/openziti/runzmd v1.0.36/go.mod h1:jYqummjskmFh63htJFF2SrUuvxNQifqd5REUhYVaY/A=
github.com/openziti/sdk-golang v0.20.139 h1:1TaRTd5KmSrfHR6W3ASuj651o37h4NOXTRC6K53Pf3k=
github.com/openziti/sdk-golang v0.20.139/go.mod h1:z2gUWwonLa+haq40cfsNE2P23RoD+SZhxWulG7w7aI0=
github.com/openziti/sdk-golang v0.21.2 h1:P66cslOAmQX37VFan+df+MoD2PqaFjHWDNMpuhhXHSo=
github.com/openziti/sdk-golang v0.21.2/go.mod h1:mepEUD39DsBm/v1WVLedYRoYCFdet5mmJ5Sxqm/zkFI=
github.com/openziti/secretstream v0.1.14 h1:Ta+nB5Prcct+L5LIKUA1nE56QhWS6lMPQYTlpxUltU0=
github.com/openziti/secretstream v0.1.14/go.mod h1:/hhuLfu+GIv0+cnapfsu/VOnXEvmTt3GKtCu+lQ0RIw=
github.com/openziti/storage v0.2.26 h1:15EbOC6A//dsdLSs/RYJP6Qn3Rj6Od4btXEWGezatxc=
Expand Down
Loading