diff --git a/cmd/lk/agent.go b/cmd/lk/agent.go index e5ebe426..2d4b821d 100644 --- a/cmd/lk/agent.go +++ b/cmd/lk/agent.go @@ -379,11 +379,6 @@ func createAgent(ctx context.Context, cmd *cli.Command) error { fmt.Printf("Creating new agent\n") } - regions := cmd.StringSlice("regions") - if len(regions) != 0 { - lkConfig.Agent.Regions = regions - } - secrets, err := requireSecrets(ctx, cmd, false, false) if err != nil { return err @@ -412,9 +407,11 @@ func createAgent(ctx context.Context, cmd *cli.Command) error { } } + regions := cmd.StringSlice("regions") + req := &lkproto.CreateAgentRequest{ Secrets: secrets, - Regions: lkConfig.Agent.Regions, + Regions: regions, } resp, err := agentsClient.CreateAgent(ctx, req) @@ -524,16 +521,10 @@ func createAgentConfig(ctx context.Context, cmd *cli.Command) error { return fmt.Errorf("invalid project URL: %s", project.URL) } - var regions []string - for _, regionalAgent := range response.Agents[0].AgentDeployments { - regions = append(regions, regionalAgent.Region) - } - agent := response.Agents[0] lkConfig := config.NewLiveKitTOML(matches[1]) lkConfig.Agent = &config.LiveKitTOMLAgentConfig{ - ID: agent.AgentId, - Regions: regions, + ID: agent.AgentId, } if err := lkConfig.SaveTOMLFile(workingDir, tomlFilename); err != nil { @@ -703,14 +694,8 @@ func updateAgent(ctx context.Context, cmd *cli.Command) error { return fmt.Errorf("no agent config found in [%s]", tomlFilename) } - regions := cmd.StringSlice("regions") - if len(regions) != 0 { - lkConfig.Agent.Regions = regions - } - req := &lkproto.UpdateAgentRequest{ AgentId: lkConfig.Agent.ID, - Regions: lkConfig.Agent.Regions, } secrets, err := requireSecrets(ctx, cmd, false, true) diff --git a/pkg/config/livekit.go b/pkg/config/livekit.go index 0416840c..b4da9ec9 100644 --- a/pkg/config/livekit.go +++ b/pkg/config/livekit.go @@ -38,8 +38,7 @@ var ( // Deprecated: use LiveKitTOML instead type AgentTOML struct { - ProjectSubdomain string `toml:"project_subdomain"` - Regions []string `toml:"regions"` + ProjectSubdomain string `toml:"project_subdomain"` } type LiveKitTOML struct { @@ -52,8 +51,7 @@ type LiveKitTOMLProjectConfig struct { } type LiveKitTOMLAgentConfig struct { - ID string `toml:"id"` - Regions []string `toml:"regions"` + ID string `toml:"id"` } func NewLiveKitTOML(forSubdomain string) *LiveKitTOML {