From a2f9cb9da708fd98a4f936e921d20582e3b7a9ff Mon Sep 17 00:00:00 2001 From: hlts2 Date: Wed, 22 Jan 2025 14:36:36 +0900 Subject: [PATCH] Revert "fix: this commit is for verification purposes only" This reverts commit c681e44711c4c09fad662567b9119ccdd294d183. --- main.go | 11 +---------- main_test.go | 2 +- pkg/driver/driver.go | 14 +------------- 3 files changed, 3 insertions(+), 24 deletions(-) diff --git a/main.go b/main.go index 4c2adb9..883a3c7 100644 --- a/main.go +++ b/main.go @@ -71,16 +71,7 @@ func run(ctx context.Context) error { log.Info().Interface("d", d).Msg("Created a new driver") log.Info().Msg("Running the driver") - // return d.Run(ctx) - - // TODO: The following code is for verification purposes only. - hook, err := hook.NewHook( - hook.WithNodeName(node), - ) - if err != nil { - return err - } - return d.Run(ctx, hook) + return d.Run(ctx) } func main() { diff --git a/main_test.go b/main_test.go index cd9d090..a60712f 100644 --- a/main_test.go +++ b/main_test.go @@ -35,7 +35,7 @@ func TestCivoCSI(t *testing.T) { var eg errgroup.Group eg.Go(func() error { - return d.Run(ctx, nil) + return d.Run(ctx) }) config := sanity.NewTestConfig() diff --git a/pkg/driver/driver.go b/pkg/driver/driver.go index e4a10cf..54adaf4 100644 --- a/pkg/driver/driver.go +++ b/pkg/driver/driver.go @@ -8,9 +8,7 @@ import ( "os" "path" "path/filepath" - "time" - "github.com/civo/civo-csi/pkg/driver/hook" "github.com/civo/civogo" "github.com/container-storage-interface/spec/lib/go/csi" "github.com/rs/zerolog" @@ -103,7 +101,7 @@ func NewTestDriver(fc *civogo.FakeClient) (*Driver, error) { } // Run the driver's gRPC server -func (d *Driver) Run(ctx context.Context, hook hook.Hook) error { +func (d *Driver) Run(ctx context.Context) error { log.Debug().Str("socketFilename", d.SocketFilename).Msg("Parsing the socket filename to make a gRPC server") urlParts, _ := url.Parse(d.SocketFilename) log.Debug().Msg("Parsed socket filename") @@ -157,16 +155,6 @@ func (d *Driver) Run(ctx context.Context, hook hook.Hook) error { eg.Go(func() error { go func() { <-ctx.Done() - - // TODO: The following code is for verification purposes only. - if hook != nil { - newCtx, cancel := context.WithTimeout(context.Background(), 3*time.Minute) - defer cancel() - if err := hook.PreStop(newCtx); err != nil { - log.Err(err).Msg("Failed to preStop hook") - } - } - log.Debug().Msg("Stopping gRPC because the context was cancelled") d.grpcServer.GracefulStop() }()