MCPcopy Index your code
hub / github.com/devspace-sh/devspace / StartProxyCommands

Function StartProxyCommands

pkg/devspace/services/proxycommands/commands.go:24–51  ·  view source on GitHub ↗

StartProxyCommands starts the reverse commands functionality

(ctx devspacecontext.Context, devPod *latest.DevPod, selector targetselector.TargetSelector, parent *tomb.Tomb)

Source from the content-addressed store, hash-verified

22
23// StartProxyCommands starts the reverse commands functionality
24func StartProxyCommands(ctx devspacecontext.Context, devPod *latest.DevPod, selector targetselector.TargetSelector, parent *tomb.Tomb) error {
25 if ctx == nil || ctx.Config() == nil || ctx.Config().Config() == nil {
26 return fmt.Errorf("DevSpace config is nil")
27 }
28
29 // init done array is used to track when sync was initialized
30 initDoneArray := []chan struct{}{}
31 remotePort := DefaultRemotePort
32 loader.EachDevContainer(devPod, func(devContainer *latest.DevContainer) bool {
33 if len(devContainer.ProxyCommands) == 0 {
34 return true
35 }
36
37 oldRemotePort := remotePort
38 initDone := parent.NotifyGo(func() error {
39 return startProxyCommands(ctx, devPod.Name, string(devContainer.Arch), oldRemotePort, devContainer.ProxyCommands, selector.WithContainer(devContainer.Container), parent)
40 })
41 initDoneArray = append(initDoneArray, initDone)
42 remotePort++
43 return true
44 })
45
46 // wait for init chans to be finished
47 for _, initDone := range initDoneArray {
48 <-initDone
49 }
50 return nil
51}
52
53func startProxyCommands(ctx devspacecontext.Context, name, arch string, remotePort int, reverseCommands []*latest.ProxyCommand, selector targetselector.TargetSelector, parent *tomb.Tomb) error {
54 if ctx.IsDone() {

Callers 1

startServicesMethod · 0.92

Calls 6

EachDevContainerFunction · 0.92
startProxyCommandsFunction · 0.85
NotifyGoMethod · 0.80
ConfigMethod · 0.65
WithContainerMethod · 0.65
ErrorfMethod · 0.45

Tested by

no test coverage detected