mirror of
https://github.com/psviderski/uncloud.git
synced 2026-10-06 13:18:58 +00:00
BREAKING CHANGE: move Uncloud API socket to /run/uncloud/api/uncloud.sock, activate it by systemd socket unit
This commit is contained in:
1 parent
c65f352250
commit
f68c9859d9
24 files changed
+345
-112
No files matched your search
@@ -35,7 +35,7 @@ func (cfg *SSHConnectorConfig) Destination() string {
|
||||
return dst
|
||||
}
|
||||
|
||||
// SSHConnector establishes a connection to the machine API through an SSH tunnel to the machine.
|
||||
// SSHConnector establishes a connection to the Uncloud API through an SSH tunnel to the machine.
|
||||
type SSHConnector struct {
|
||||
config SSHConnectorConfig
|
||||
client *ssh.Client
|
||||
@@ -69,7 +69,7 @@ func (c *SSHConnector) Connect(ctx context.Context) (*grpc.ClientConn, error) {
|
||||
|
||||
sockPath := c.config.SockPath
|
||||
if sockPath == "" {
|
||||
sockPath = machine.DefaultUncloudSockPath
|
||||
sockPath = machine.DefaultClusterAPISockPath
|
||||
}
|
||||
conn, err := grpc.NewClient(
|
||||
"unix://"+sockPath,
|
||||
@@ -83,7 +83,7 @@ func (c *SSHConnector) Connect(ctx context.Context) (*grpc.ClientConn, error) {
|
||||
conn, dErr := c.client.DialContext(ctx, "unix", addr)
|
||||
if dErr != nil {
|
||||
return nil, fmt.Errorf(
|
||||
"connect to machine API socket '%s' through SSH tunnel (is uncloud.service running "+
|
||||
"connect to Uncloud API socket '%s' through SSH tunnel (is uncloud.service running "+
|
||||
"on the remote machine and does the SSH user '%s' have permissions to access the socket?):"+
|
||||
" %w",
|
||||
addr, c.client.User(), dErr,
|
||||
@@ -94,7 +94,7 @@ func (c *SSHConnector) Connect(ctx context.Context) (*grpc.ClientConn, error) {
|
||||
),
|
||||
)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("create machine API client: %w", err)
|
||||
return nil, fmt.Errorf("create Uncloud API client: %w", err)
|
||||
}
|
||||
return conn, nil
|
||||
}
|
||||
|
||||
@@ -19,7 +19,7 @@ import (
|
||||
"google.golang.org/grpc/credentials/insecure"
|
||||
)
|
||||
|
||||
// SSHCLIConnector establishes a connection to the machine API by executing SSH CLI
|
||||
// SSHCLIConnector establishes a connection to the Uncloud API by executing SSH CLI
|
||||
// and running `uncloudd dial-stdio` on the remote machine.
|
||||
type SSHCLIConnector struct {
|
||||
config SSHConnectorConfig
|
||||
@@ -104,7 +104,7 @@ func (c *SSHCLIConnector) Connect(ctx context.Context) (*grpc.ClientConn, error)
|
||||
}),
|
||||
)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("create machine API client: %w", err)
|
||||
return nil, fmt.Errorf("create Uncloud API client: %w", err)
|
||||
}
|
||||
|
||||
return grpcConn, nil
|
||||
|
||||
@@ -13,7 +13,7 @@ import (
|
||||
"google.golang.org/grpc/credentials/insecure"
|
||||
)
|
||||
|
||||
// TCPConnector establishes a connection to the machine API through a direct TCP connection to an API endpoint.
|
||||
// TCPConnector establishes a connection to the Uncloud API through a direct TCP connection.
|
||||
type TCPConnector struct {
|
||||
apiAddr netip.AddrPort
|
||||
}
|
||||
@@ -40,7 +40,7 @@ func (c *TCPConnector) Connect(_ context.Context) (*grpc.ClientConn, error) {
|
||||
grpc.WithStreamInterceptor(grpcversion.ClientStreamInterceptor),
|
||||
)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("create machine API client: %w", err)
|
||||
return nil, fmt.Errorf("create Uncloud API client: %w", err)
|
||||
}
|
||||
return conn, nil
|
||||
}
|
||||
|
||||
@@ -10,7 +10,7 @@ import (
|
||||
"google.golang.org/grpc/credentials/insecure"
|
||||
)
|
||||
|
||||
// UnixConnector establishes a connection to the machine API through a unix domain socket.
|
||||
// UnixConnector establishes a connection to the Uncloud API through a Unix domain socket.
|
||||
type UnixConnector struct {
|
||||
socketPath string
|
||||
}
|
||||
@@ -31,7 +31,7 @@ func (c *UnixConnector) Connect(_ context.Context) (*grpc.ClientConn, error) {
|
||||
grpc.WithStreamInterceptor(grpcversion.ClientStreamInterceptor),
|
||||
)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("create machine API client: %w", err)
|
||||
return nil, fmt.Errorf("create Uncloud API client: %w", err)
|
||||
}
|
||||
return conn, nil
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user