(runOptions *options.FuncletOptions, stopCh <-chan struct{}, finishCh chan struct{})
| 42 | } |
| 43 | |
| 44 | func CreateUnixServerChain(runOptions *options.FuncletOptions, stopCh <-chan struct{}, finishCh chan struct{}) (*genericserver.GenericServer, error) { |
| 45 | config := genericserver.NewRecommendedConfig() |
| 46 | if err := runOptions.RecommendedOptions.ApplyTo(config); err != nil { |
| 47 | return nil, err |
| 48 | } |
| 49 | s, err := config.Complete().New("minifunclet") |
| 50 | if err != nil { |
| 51 | return nil, err |
| 52 | } |
| 53 | |
| 54 | // funclet needs to prepare the directory for user containers |
| 55 | // lift the restrictions of the new file's permissions |
| 56 | syscall.Umask(0) |
| 57 | f, err := funclet.InitFunclet(runOptions, stopCh, finishCh) |
| 58 | if err != nil { |
| 59 | return nil, err |
| 60 | } |
| 61 | socksPath := runOptions.FuncletApiSocks |
| 62 | if err := os.RemoveAll(socksPath); err != nil { |
| 63 | return nil, err |
| 64 | } |
| 65 | ln, err := net.Listen("unix", socksPath) |
| 66 | if err != nil { |
| 67 | return nil, err |
| 68 | } |
| 69 | if err := os.Chmod(socksPath, os.ModePerm); err != nil { |
| 70 | return nil, err |
| 71 | } |
| 72 | config.SecureServingInfo = &genericserver.SecureServingInfo{ |
| 73 | Listener: ln, |
| 74 | } |
| 75 | s, err = config.Complete().New("funclet_unix") |
| 76 | if err != nil { |
| 77 | return nil, err |
| 78 | } |
| 79 | f.InstallAPI(s.Handler.GoRestfulContainer) |
| 80 | return s, nil |
| 81 | } |
no test coverage detected