refactor: rename main module to github.com/psviderski/uncloud

This commit is contained in:
Pavel Sviderski
2025-03-22 18:25:08 +10:00
parent f1a150821c
commit 3757813b20
74 changed files with 176 additions and 172 deletions
+1 -1
View File
@@ -6,8 +6,8 @@ import (
"github.com/distribution/reference"
"github.com/google/go-containerregistry/pkg/name"
"github.com/google/go-containerregistry/pkg/v1/remote"
"github.com/psviderski/uncloud/internal/api"
"regexp"
"uncloud/internal/api"
)
const (
+1 -1
View File
@@ -4,7 +4,7 @@ import (
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
"testing"
"uncloud/internal/api"
"github.com/psviderski/uncloud/internal/api"
)
func TestClient_NewCaddyDeployment(t *testing.T) {
+2 -2
View File
@@ -5,11 +5,11 @@ import (
"errors"
"fmt"
"github.com/docker/cli/cli/streams"
"github.com/psviderski/uncloud/internal/machine/api/pb"
"github.com/psviderski/uncloud/internal/machine/docker"
"google.golang.org/grpc"
"google.golang.org/grpc/metadata"
"os"
"uncloud/internal/machine/api/pb"
"uncloud/internal/machine/docker"
)
var ErrNotFound = errors.New("not found")
+1 -1
View File
@@ -3,7 +3,7 @@ package client
import (
"context"
"google.golang.org/protobuf/types/known/emptypb"
"uncloud/internal/machine/api/pb"
"github.com/psviderski/uncloud/internal/machine/api/pb"
)
func (cli *Client) InspectMachine(ctx context.Context, id string) (*pb.MachineMember, error) {
+7 -3
View File
@@ -6,8 +6,8 @@ import (
"fmt"
"github.com/compose-spec/compose-go/v2/graph"
"github.com/compose-spec/compose-go/v2/types"
"uncloud/internal/api"
"uncloud/internal/compose"
"github.com/psviderski/uncloud/internal/api"
"github.com/psviderski/uncloud/internal/compose"
)
func (cli *Client) NewComposeDeployment(ctx context.Context, project *types.Project) (*ComposeDeployment, error) {
@@ -87,12 +87,16 @@ func (d *ComposeDeployment) ServiceSpec(name string) (api.ServiceSpec, error) {
}
// TODO: resolve the image to a digest and supported platforms using an image resolver that broadcasts requests
// to all machines in the cluster.
// to all machines in the cluster. If service.PullPolicy is "missing":
// - Broadcast request if any machine contains a particular image and resolve it to image@digest.
// - If not found, broadcast request to resolve an image using a registry, and resolve it to image@digest.
// TODO: configure placement filter based on the supported platforms of the image.
if err = d.SpecResolver.Resolve(&spec); err != nil {
return spec, fmt.Errorf("resolve service spec '%s': %w", name, err)
}
// TODO: maybe instantiate ImageResolver here based on PullPolicy of each service?
return spec, nil
}
+2 -2
View File
@@ -3,13 +3,13 @@ package connector
import (
"context"
"fmt"
"github.com/psviderski/uncloud/internal/machine"
"github.com/psviderski/uncloud/internal/sshexec"
"golang.org/x/crypto/ssh"
"google.golang.org/grpc"
"google.golang.org/grpc/credentials/insecure"
"net"
"strings"
"uncloud/internal/machine"
"uncloud/internal/sshexec"
)
type SSHConnectorConfig struct {
+5 -5
View File
@@ -8,11 +8,11 @@ import (
"net"
"net/netip"
"strconv"
"uncloud/internal/cli/client"
"uncloud/internal/cli/config"
machine2 "uncloud/internal/machine"
"uncloud/internal/machine/network"
"uncloud/internal/machine/network/tunnel"
"github.com/psviderski/uncloud/internal/cli/client"
"github.com/psviderski/uncloud/internal/cli/config"
machine2 "github.com/psviderski/uncloud/internal/machine"
"github.com/psviderski/uncloud/internal/machine/network"
"github.com/psviderski/uncloud/internal/machine/network/tunnel"
)
// WireGuardConnector establishes a connection to the cluster API through a WireGuard tunnel
+3 -3
View File
@@ -13,9 +13,9 @@ import (
"google.golang.org/grpc/status"
"strconv"
"strings"
"uncloud/internal/api"
machinedocker "uncloud/internal/machine/docker"
"uncloud/internal/secret"
"github.com/psviderski/uncloud/internal/api"
machinedocker "github.com/psviderski/uncloud/internal/machine/docker"
"github.com/psviderski/uncloud/internal/secret"
)
// CreateContainer creates a new container for the given service on the specified machine.
+2 -2
View File
@@ -4,8 +4,8 @@ import (
"context"
"errors"
"fmt"
"uncloud/internal/api"
"uncloud/internal/machine/api/pb"
"github.com/psviderski/uncloud/internal/api"
"github.com/psviderski/uncloud/internal/machine/api/pb"
)
// Deployment manages the process of creating or updating a service to match a desired state.
+2 -2
View File
@@ -12,8 +12,8 @@ import (
"net/http"
"sync"
"time"
"uncloud/internal/machine/api/pb"
"uncloud/internal/machine/caddyfile"
"github.com/psviderski/uncloud/internal/machine/api/pb"
"github.com/psviderski/uncloud/internal/machine/caddyfile"
)
// GetDomain returns the cluster domain name or ErrNotFound if it hasn't been reserved yet.
+1 -1
View File
@@ -5,7 +5,7 @@ import (
"fmt"
"github.com/docker/docker/api/types/container"
"strings"
"uncloud/internal/api"
"github.com/psviderski/uncloud/internal/api"
)
// Operation represents a single atomic operation in a deployment process.
+2 -2
View File
@@ -3,9 +3,9 @@ package client
import (
"fmt"
"github.com/distribution/reference"
"github.com/psviderski/uncloud/internal/api"
"github.com/psviderski/uncloud/internal/secret"
"strings"
"uncloud/internal/api"
"uncloud/internal/secret"
)
type ImageDigestResolver interface {
+2 -2
View File
@@ -12,8 +12,8 @@ import (
"google.golang.org/grpc/status"
"slices"
"sync"
"uncloud/internal/api"
"uncloud/internal/machine/api/pb"
"github.com/psviderski/uncloud/internal/api"
"github.com/psviderski/uncloud/internal/machine/api/pb"
)
func (cli *Client) PrepareDeploymentSpec(ctx context.Context, spec api.ServiceSpec) (api.ServiceSpec, error) {
+3 -3
View File
@@ -5,9 +5,9 @@ import (
"fmt"
"math/rand/v2"
"slices"
"uncloud/internal/api"
"uncloud/internal/machine/api/pb"
"uncloud/internal/secret"
"github.com/psviderski/uncloud/internal/api"
"github.com/psviderski/uncloud/internal/machine/api/pb"
"github.com/psviderski/uncloud/internal/secret"
)
// Strategy defines how a service should be deployed or updated. Different implementations can provide various
+2 -2
View File
@@ -4,8 +4,8 @@ import (
"fmt"
"golang.zx2c4.com/wireguard/wgctrl/wgtypes"
"net/netip"
"uncloud/internal/machine/network"
"uncloud/internal/secret"
"github.com/psviderski/uncloud/internal/machine/network"
"github.com/psviderski/uncloud/internal/secret"
)
type User struct {