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 876d6b9 commit 6c6262c
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 2 deletions.
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
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ require (
github.com/networkservicemesh/sdk-k8s v0.0.0-20231123112133-3a307c41ee71
github.com/networkservicemesh/sdk-ovs v0.0.0-20231124094718-2690a6fc11ec
github.com/networkservicemesh/sdk-sriov v0.0.0-20231124094207-86a8285ad1ef
github.com/ovn-org/ovn-kubernetes/go-controller v0.0.0-20210826171620-f06c53111a31
github.com/pkg/errors v0.9.1
github.com/sirupsen/logrus v1.9.0
github.com/spiffe/go-spiffe/v2 v2.0.0
Expand Down Expand Up @@ -70,7 +71,6 @@ require (
github.com/networkservicemesh/sdk-kernel v0.0.0-20231124093522-404b33c4a701 // indirect
github.com/open-policy-agent/opa v0.44.0 // indirect
github.com/ovn-org/libovsdb v0.6.1-0.20210824154155-9cab5b210dce // indirect
github.com/ovn-org/ovn-kubernetes/go-controller v0.0.0-20210826171620-f06c53111a31 // indirect
github.com/pmezard/go-difflib v1.0.0 // indirect
github.com/prometheus/client_golang v1.17.0 // indirect
github.com/prometheus/client_model v0.5.0 // indirect
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 6c6262c

Please sign in to comment.