feat(dns): expose service as service-name.cluster-domain if cluster domain reserved

This commit is contained in:
Pavel Sviderski
2025-02-26 21:10:21 +10:00
parent 4cc68e3133
commit a5f6ec4a68
5 changed files with 148 additions and 34 deletions
+15
View File
@@ -5,6 +5,8 @@ import (
"errors"
"fmt"
"github.com/docker/compose/v2/pkg/progress"
"google.golang.org/grpc/codes"
"google.golang.org/grpc/status"
"io"
"net/http"
"sync"
@@ -13,6 +15,19 @@ import (
"uncloud/internal/machine/caddyfile"
)
// GetDomain returns the cluster domain name or ErrNotFound if it hasn't been reserved yet.
func (cli *Client) GetDomain(ctx context.Context) (string, error) {
domain, err := cli.ClusterClient.GetDomain(ctx, nil)
if err != nil {
if status.Convert(err).Code() == codes.NotFound {
return "", ErrNotFound
}
return "", err
}
return domain.Name, nil
}
var ErrNoReachableMachines = errors.New("no internet-reachable machines running service containers")
// CreateIngressRecords verifies which machines running the specified service (typically Caddy) are reachable from