Skip to content

Replace actor template namespace/name pair with ActorTemplate atespace and name pair in internal APIs - #1304

Merged
Julian Gutierrez Oschmann (juli4n) merged 1 commit into
agent-substrate:mainfrom
zoez7:actor-template-objectref
Aug 31, 2026
Merged

Replace actor template namespace/name pair with ActorTemplate atespace and name pair in internal APIs#1304
Julian Gutierrez Oschmann (juli4n) merged 1 commit into
agent-substrate:mainfrom
zoez7:actor-template-objectref

Conversation

@zoez7

Copy link
Copy Markdown
Collaborator

Both Atelet and Ateom internal APIs consume actor template namespace/name pair to telemetry. Updated them to use the new Substrate ActorTemplate proto instead of the legacy CRD one.

Comment thread internal/proto/ateompb/ateom.proto Outdated

message TerminateWorkloadRequest {
reserved 4, 5;
reserved "actor_template_namespace", "actor_template_name";

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Don't reserve fields. Just drop them and reuse the IDs. We are breaking the API anyways.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done. I renamed "actor_template_namespace" to "actor_template_atespace" instead.

Comment thread internal/proto/ateletpb/atelet.proto Outdated

// ObjectRef references a Substrate resource by its (atespace, name) identity.
// Mirrors ateapipb.ObjectRef, which internal protos do not import.
message ObjectRef {

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ObjectRef is a concept of the control plane API (mgmt plane) where we need a way for resources to reference another resources. We could introduce the same concept in the atelet API (control plane), although I'm not sure how useful that is.

If we adopt it, we should use it consistently, for example, we have atespace, actor_name , which could be an ObjectRef too, but for actors we also have an actor_uid which isn't in the ObjectRef (I guess that could be a separate top level field alongside actor ?

ObjectRef actor;
string actor_uid;
ObjectReg  actor_template;

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Dropped ObjectRef concept in internal API for now, since the internal APIs only need the ActorTemplate's name and atepsace for telemetry for now.

return nil
}
return &ateletpb.ObjectRef{Atespace: ref.GetAtespace(), Name: ref.GetName()}
}

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This drops the CRD fallback, so actors now might send nil and ate.template.* becomes empty on all the atelet/ateom metrics and actor logs.

Here:

if ref := actorTemplateObjectRef(actor); ref != nil {
assignment.ActorTemplateRef = ref
} else {
assignment.ActorTemplate = &ateapipb.KubeNamespacedObjectRef{
Namespace: actor.GetActorTemplateNamespace(),
Name: actor.GetActorTemplateName(),
}
}

we already do the if/else against actorTemplateObjectRef, can we do the same until the legacy one is gone?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I restricted the scope of this PR to just renaming the actor template "Namespace" to "Atespace" in internal APIs. Will fix this in a follow up PR.
The legacy one will be gone in the next 2 days. I'll have a PR to do the cutover so we won't have to maintain 2 branches.

Comment thread cmd/atelet/main.go Outdated
op := snapshotOp{
templateNamespace: req.GetActorTemplateNamespace(),
templateName: req.GetActorTemplateName(),
templateNamespace: req.GetActorTemplate().GetAtespace(),

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ActorMetricAttributes coerces an empty template to TemplateUnknown, this, and at a few other places below emit "". Can we pick one to make it consistent?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The TemplateUnknown was a temporary hack to fix e2e test during the transition period. Will have a separate PR to use the new substrate atespace everywhere.

Comment thread cmd/atelet/main.go Outdated
Comment on lines +563 to +566
snapshotSizeBytes.Record(ctx, fi.Size(), metric.WithAttributes(
semconv.FileNameKey.String(file),
ateattr.TemplateNamespaceKey.String(atNamespace),
ateattr.TemplateNameKey.String(atName),
ateattr.TemplateNamespaceKey.String(templateRef.GetAtespace()),
ateattr.TemplateNameKey.String(templateRef.GetName()),

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note that ate.template.namespace is documented like this:

attributes:
- id: ate.template.namespace
stability: development
type: string
brief: The Kubernetes namespace of the ActorTemplate of the actor.

but it's an atespace now. Weaver only checks spellings so verify/metrics.sh stays green either way, we should fix the brief in this PR.

Comment thread cmd/atelet/sandbox_assets.go Outdated
Comment on lines +94 to +99
// Actor identity makes a flat snapshot self-identifying if control-plane
// persistence is unavailable.
Atespace string `json:"atespace,omitempty"`
ActorName string `json:"actorName,omitempty"`
ActorUID string `json:"actorUid,omitempty"`
ActorTemplateNamespace string `json:"actorTemplateNamespace,omitempty"`
ActorTemplateName string `json:"actorTemplateName,omitempty"`
Atespace string `json:"atespace,omitempty"`
ActorName string `json:"actorName,omitempty"`
ActorUID string `json:"actorUid,omitempty"`
ActorTemplate *actorTemplateRecord `json:"actorTemplate,omitempty"`

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we lose template identity before/after this PR? Probably fine at this point though.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, during the switch there are some places where the template might log empty. I'll fix it as part of the full cutover.

Comment thread cmd/atelet/statspoller.go Outdated
Comment on lines +290 to +291
templateNamespace: sample.GetActorTemplate().GetAtespace(),
templateName: sample.GetActorTemplate().GetName(),

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If the ref is nil every actor collapses into one ("", "") bucket here, so the per-template memory/cpu gauges merge instead of just going unlabeled. Similar issue to #761

The actor template identity carried on atelet/ateom requests, snapshot
manifests, and stats samples now names the substrate ActorTemplate
(atespace + name), sourced from the resolved ActorTemplate's metadata,
instead of the legacy CRD-backed template's kube namespace/name pair.
@zoez7
Zoe Zhao (zoez7) force-pushed the actor-template-objectref branch from dfe7e8c to 9e173b3 Compare August 31, 2026 17:38
@zoez7 Zoe Zhao (zoez7) changed the title Replace actor template namespace/name pair with ActorTemplate substrate ObjectRef in internal protos Replace actor template namespace/name pair with ActorTemplate atespace and name pair in internal APIs Aug 31, 2026
@juli4n
Julian Gutierrez Oschmann (juli4n) merged commit 9bddf66 into agent-substrate:main Aug 31, 2026
9 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants