rename agent environment to deployment (#4506)
* rename agent environment to deployment * deps
This commit is contained in:
+7
-7
@@ -62,8 +62,8 @@ type JobRequest struct {
|
||||
// only set for participant jobs
|
||||
Participant *livekit.ParticipantInfo
|
||||
Metadata string
|
||||
AgentName string
|
||||
Environment string
|
||||
AgentName string
|
||||
Deployment string
|
||||
}
|
||||
|
||||
type agentClient struct {
|
||||
@@ -155,7 +155,7 @@ func (c *agentClient) LaunchJob(ctx context.Context, desc *JobRequest) *serverut
|
||||
}
|
||||
|
||||
dispatcher.ForEach(func(curNs string) {
|
||||
topic := GetAgentTopic(desc.AgentName, curNs, desc.Environment)
|
||||
topic := GetAgentTopic(desc.AgentName, curNs, desc.Deployment)
|
||||
|
||||
wg.Add(1)
|
||||
c.workers.Submit(func() {
|
||||
@@ -171,7 +171,7 @@ func (c *agentClient) LaunchJob(ctx context.Context, desc *JobRequest) *serverut
|
||||
AgentName: desc.AgentName,
|
||||
Metadata: desc.Metadata,
|
||||
EnableRecording: c.config.EnableUserDataRecording,
|
||||
Environment: desc.Environment,
|
||||
Deployment: desc.Deployment,
|
||||
}
|
||||
resp, err := c.client.JobRequest(context.Background(), topic, jobTypeTopic, job)
|
||||
if err != nil {
|
||||
@@ -328,7 +328,7 @@ func (c *agentClient) Stop() error {
|
||||
return nil
|
||||
}
|
||||
|
||||
func GetAgentTopic(agentName, namespace, environment string) string {
|
||||
func GetAgentTopic(agentName, namespace, deployment string) string {
|
||||
var topic string
|
||||
if agentName == "" {
|
||||
// Backward compatibility
|
||||
@@ -339,8 +339,8 @@ func GetAgentTopic(agentName, namespace, environment string) string {
|
||||
} else {
|
||||
topic = fmt.Sprintf("%s_%s", agentName, namespace)
|
||||
}
|
||||
if environment != "" {
|
||||
topic += "_" + environment
|
||||
if deployment != "" {
|
||||
topic += "_" + deployment
|
||||
}
|
||||
return topic
|
||||
}
|
||||
|
||||
+3
-3
@@ -150,7 +150,7 @@ type WorkerRegistration struct {
|
||||
JobType livekit.JobType
|
||||
Permissions *livekit.ParticipantPermission
|
||||
ClientIP string
|
||||
Environment string
|
||||
Deployment string
|
||||
}
|
||||
|
||||
func MakeWorkerRegistration() WorkerRegistration {
|
||||
@@ -197,7 +197,7 @@ func (h *WorkerRegisterer) HandleRegister(req *livekit.RegisterWorkerRequest) er
|
||||
return ErrUnknownJobType
|
||||
}
|
||||
|
||||
if err := protoagent.ValidateEnvironment(req.GetEnvironment()); err != nil {
|
||||
if err := protoagent.ValidateDeployment(req.GetDeployment()); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
@@ -216,7 +216,7 @@ func (h *WorkerRegisterer) HandleRegister(req *livekit.RegisterWorkerRequest) er
|
||||
h.registration.Namespace = req.GetNamespace()
|
||||
h.registration.JobType = req.GetType()
|
||||
h.registration.Permissions = permissions
|
||||
h.registration.Environment = req.GetEnvironment()
|
||||
h.registration.Deployment = req.GetDeployment()
|
||||
h.registered = true
|
||||
|
||||
_, err := h.conn.WriteServerMessage(&livekit.ServerMessage{
|
||||
|
||||
Reference in New Issue
Block a user