зеркало из https://github.com/docker/compose.git
Move the proxy in the server package
This commit is contained in:
Родитель
8571cf5a04
Коммит
0af5afe440
|
@ -30,15 +30,15 @@ func getter() interface{} {
|
|||
|
||||
func New(ctx context.Context) (containers.ContainerService, error) {
|
||||
cc := apicontext.CurrentContext(ctx)
|
||||
s, err := store.New()
|
||||
contextStore, err := store.New()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
m, err := s.Get(cc, getter)
|
||||
metadata, err := contextStore.Get(cc, getter)
|
||||
if err != nil {
|
||||
return nil, errors.Wrap(err, "wrong context type")
|
||||
}
|
||||
tc, _ := m.Metadata.Data.(store.AciContext)
|
||||
tc, _ := metadata.Metadata.Data.(store.AciContext)
|
||||
|
||||
auth, _ := auth.NewAuthorizerFromCLI()
|
||||
containerGroupsClient := containerinstance.NewContainerGroupsClient(tc.SubscriptionID)
|
||||
|
|
|
@ -5,10 +5,10 @@ import (
|
|||
"net"
|
||||
|
||||
cliv1 "github.com/docker/api/cli/v1"
|
||||
"github.com/docker/api/containers/proxy"
|
||||
containersv1 "github.com/docker/api/containers/v1"
|
||||
"github.com/docker/api/context/store"
|
||||
"github.com/docker/api/server"
|
||||
"github.com/docker/api/server/proxy"
|
||||
"github.com/golang/protobuf/ptypes/empty"
|
||||
"github.com/pkg/errors"
|
||||
"github.com/sirupsen/logrus"
|
||||
|
@ -38,11 +38,11 @@ func ServeCommand() *cobra.Command {
|
|||
func runServe(ctx context.Context, opts serveOpts) error {
|
||||
s := server.New()
|
||||
|
||||
l, err := net.Listen("unix", opts.address)
|
||||
listener, err := net.Listen("unix", opts.address)
|
||||
if err != nil {
|
||||
return errors.Wrap(err, "listen unix socket")
|
||||
}
|
||||
defer l.Close()
|
||||
defer listener.Close()
|
||||
|
||||
p := proxy.NewContainerApi()
|
||||
|
||||
|
@ -60,7 +60,7 @@ func runServe(ctx context.Context, opts serveOpts) error {
|
|||
logrus.WithField("address", opts.address).Info("serving daemon API")
|
||||
|
||||
// start the GRPC server to serve on the listener
|
||||
return s.Serve(l)
|
||||
return s.Serve(listener)
|
||||
}
|
||||
|
||||
type cliServer struct {
|
||||
|
|
|
@ -114,8 +114,11 @@ func (s *store) Get(name string, getter func() interface{}) (*Metadata, error) {
|
|||
meta := filepath.Join(s.root, contextsDir, metadataDir, contextdirOf(name), metaFile)
|
||||
m, err := read(meta, getter)
|
||||
if os.IsNotExist(err) {
|
||||
return nil, fmt.Errorf("unknown conetxt %q", name)
|
||||
return nil, fmt.Errorf("unknown context %q", name)
|
||||
} else if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return m, nil
|
||||
}
|
||||
|
||||
|
|
|
@ -32,9 +32,9 @@ import (
|
|||
"errors"
|
||||
|
||||
"github.com/docker/api/client"
|
||||
"github.com/docker/api/containers/proxy"
|
||||
apicontext "github.com/docker/api/context"
|
||||
"github.com/docker/api/context/store"
|
||||
"github.com/docker/api/server/proxy"
|
||||
grpc_prometheus "github.com/grpc-ecosystem/go-grpc-prometheus"
|
||||
"google.golang.org/grpc"
|
||||
"google.golang.org/grpc/health"
|
||||
|
|
Загрузка…
Ссылка в новой задаче