Skip to content

Commit

Permalink
Delete ovs bridge when forwarder stop
Browse files Browse the repository at this point in the history
Related issue: networkservicemesh/sdk-ovs#276

Signed-off-by: Laszlo Kiraly <laszlo.kiraly@est.tech>
  • Loading branch information
ljkiraly committed Nov 28, 2023
1 parent 5909285 commit bddec92
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
1 change: 1 addition & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ FROM go as build
WORKDIR /build
COPY go.mod go.sum ./
COPY . .
COPY ./local ./local
RUN go build -o /bin/forwarder .

FROM build as test
Expand Down
10 changes: 9 additions & 1 deletion main.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright (c) 2021-2022 Nordix Foundation.
// Copyright (c) 2021-2023 Nordix Foundation.
//
// Copyright (c) 2023 Cisco Foundation.
//
Expand Down Expand Up @@ -60,6 +60,7 @@ import (
"github.com/networkservicemesh/sdk/pkg/tools/spiffejwt"
"github.com/networkservicemesh/sdk/pkg/tools/token"
"github.com/networkservicemesh/sdk/pkg/tools/tracing"
"github.com/ovn-org/ovn-kubernetes/go-controller/pkg/util"
"github.com/pkg/errors"
"github.com/sirupsen/logrus"
"github.com/spiffe/go-spiffe/v2/spiffeid"
Expand Down Expand Up @@ -198,6 +199,13 @@ func main() {
if err != nil {
logrus.Fatalf("error configuring forwarder endpoint: %+v", err)
}
defer func() {
stdout, stderr, cmdErr := util.RunOVSVsctl("del-br", config.BridgeName)
if err != nil {
log.FromContext(ctx).Fatalf("Failed to remove bridge %s, stdout: %q, stderr: %q, error: %v", config.BridgeName, stdout, stderr, cmdErr)
}
log.FromContext(ctx).Debugf("Bridge %s removed", config.BridgeName)
}()
log.FromContext(ctx).WithField("duration", time.Since(now)).Info("completed phase 4: create ovsxconnect network service endpoint")

// ********************************************************************************
Expand Down

0 comments on commit bddec92

Please sign in to comment.