mirror of
https://github.com/psviderski/uncloud.git
synced 2026-08-28 03:53:33 +00:00
feat(dns): expose service as service-name.cluster-domain if cluster domain reserved
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user