Skip to content
Open
19 changes: 8 additions & 11 deletions packages/orchestrator/pkg/factories/run.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ import (
"github.com/e2b-dev/infra/packages/orchestrator/pkg/metrics"
"github.com/e2b-dev/infra/packages/orchestrator/pkg/nfsproxy"
nfscfg "github.com/e2b-dev/infra/packages/orchestrator/pkg/nfsproxy/cfg"
"github.com/e2b-dev/infra/packages/orchestrator/pkg/nfsproxy/middleware"
"github.com/e2b-dev/infra/packages/orchestrator/pkg/portmap"
"github.com/e2b-dev/infra/packages/orchestrator/pkg/proxy"
"github.com/e2b-dev/infra/packages/orchestrator/pkg/sandbox"
Expand Down Expand Up @@ -99,9 +100,10 @@ type EgressFactory func(ctx context.Context, deps *Deps) (*EgressSetup, error)

// Options configures the orchestrator with edition-specific behavior.
type Options struct {
Version string
CommitSHA string
EgressFactory EgressFactory
Version string
CommitSHA string
EgressFactory EgressFactory
NFSInterceptors []middleware.Interceptor
}

type closer struct {
Expand Down Expand Up @@ -588,7 +590,7 @@ func run(config cfg.Config, opts Options) (success bool) {

// nfs proxy server
if len(config.PersistentVolumeMounts) > 0 {
nfsClosers, err := startNFSProxy(ctx, config, builder, startService, sandboxes)
nfsClosers, err := startNFSProxy(ctx, config, builder, startService, sandboxes, opts)
if err != nil {
logger.L().Fatal(ctx, "failed to start nfs proxy", zap.Error(err))
}
Expand Down Expand Up @@ -787,13 +789,7 @@ func run(config cfg.Config, opts Options) (success bool) {
return success
}

func startNFSProxy(
ctx context.Context,
config cfg.Config,
builder *chrooted.Builder,
startService func(name string, f func() error),
sandboxes *sandbox.Map,
) ([]closer, error) {
func startNFSProxy(ctx context.Context, config cfg.Config, builder *chrooted.Builder, startService func(name string, f func() error), sandboxes *sandbox.Map, opts Options) ([]closer, error) {
var closers []closer

// portmapper listener
Expand Down Expand Up @@ -826,6 +822,7 @@ func startNFSProxy(
RecordHandleCalls: config.NFSProxyRecordHandleCalls,
RecordStatCalls: config.NFSProxyRecordStatCalls,
NFSLogLevel: config.NFSProxyLogLevel,
Interceptors: opts.NFSInterceptors,
})
if err != nil {
return nil, fmt.Errorf("failed to create nfs proxy: %w", err)
Expand Down
7 changes: 6 additions & 1 deletion packages/orchestrator/pkg/nfsproxy/cfg/model.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
package cfg

import "github.com/willscott/go-nfs"
import (
"github.com/willscott/go-nfs"

"github.com/e2b-dev/infra/packages/orchestrator/pkg/nfsproxy/middleware"
)

type Config struct {
Logging bool
Expand All @@ -9,4 +13,5 @@ type Config struct {
RecordStatCalls bool
RecordHandleCalls bool
NFSLogLevel nfs.LogLevel
Interceptors []middleware.Interceptor
}
6 changes: 5 additions & 1 deletion packages/orchestrator/pkg/nfsproxy/e2e_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ import (
"github.com/testcontainers/testcontainers-go"
"github.com/testcontainers/testcontainers-go/exec"
"github.com/testcontainers/testcontainers-go/log"
"github.com/willscott/go-nfs"
"go.uber.org/zap"

"github.com/e2b-dev/infra/packages/orchestrator/pkg/cfg"
Expand Down Expand Up @@ -140,7 +141,10 @@ func TestIntegrationTest(t *testing.T) {

createVolumeDir(t, builder, volumeType, teamID, volumeID)

s, err := NewProxy(t.Context(), builder, sandboxes, nfscfg.Config{})
s, err := NewProxy(t.Context(), builder, sandboxes, nfscfg.Config{
Logging: true,
NFSLogLevel: nfs.DebugLevel,
})
require.NoError(t, err)
go func() {
err := s.Serve(nfsListener)
Expand Down
48 changes: 0 additions & 48 deletions packages/orchestrator/pkg/nfsproxy/logged/change.go

This file was deleted.

78 changes: 0 additions & 78 deletions packages/orchestrator/pkg/nfsproxy/logged/file.go

This file was deleted.

153 changes: 0 additions & 153 deletions packages/orchestrator/pkg/nfsproxy/logged/fs.go

This file was deleted.

Loading
Loading