fix(dns): update cluster domain DNS records when adding a new machine to cluster

This commit is contained in:
Pavel Sviderski
2025-03-04 20:49:41 +10:00
parent 11098ea7d1
commit 805afd0d28
2 changed files with 8 additions and 2 deletions
+8 -1
View File
@@ -12,6 +12,7 @@ import (
"google.golang.org/protobuf/types/known/emptypb" "google.golang.org/protobuf/types/known/emptypb"
"net/netip" "net/netip"
"time" "time"
"uncloud/cmd/uncloud/caddy"
"uncloud/internal/cli" "uncloud/internal/cli"
"uncloud/internal/cli/client" "uncloud/internal/cli/client"
"uncloud/internal/cli/config" "uncloud/internal/cli/config"
@@ -138,12 +139,18 @@ func add(ctx context.Context, uncli *cli.CLI, remoteMachine cli.RemoteMachine, o
return fmt.Errorf("create caddy deployment: %w", err) return fmt.Errorf("create caddy deployment: %w", err)
} }
return progress.RunWithTitle(ctx, func(ctx context.Context) error { err = progress.RunWithTitle(ctx, func(ctx context.Context) error {
if _, err = d.Run(ctx); err != nil { if _, err = d.Run(ctx); err != nil {
return fmt.Errorf("deploy caddy: %w", err) return fmt.Errorf("deploy caddy: %w", err)
} }
return nil return nil
}, uncli.ProgressOut(), fmt.Sprintf("Deploying service %s", d.Spec.Name)) }, uncli.ProgressOut(), fmt.Sprintf("Deploying service %s", d.Spec.Name))
if err != nil {
return err
}
fmt.Println()
return caddy.UpdateDomainRecords(ctx, machineClient, uncli.ProgressOut())
} }
func waitClusterInitialised(ctx context.Context, client *client.Client) error { func waitClusterInitialised(ctx context.Context, client *client.Client) error {
-1
View File
@@ -31,7 +31,6 @@ func (cli *Client) NewCaddyDeployment(image string, filter MachineFilter) (*Depl
image = reference.FamiliarString(latest) image = reference.FamiliarString(latest)
} }
// TODO: set restart policy to always. https://github.com/psviderski/uncloud/issues/26
spec := api.ServiceSpec{ spec := api.ServiceSpec{
Container: api.ContainerSpec{ Container: api.ContainerSpec{
Command: []string{"caddy", "run", "-c", "/config/caddy.json", "--watch"}, Command: []string{"caddy", "run", "-c", "/config/caddy.json", "--watch"},