Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 13 additions & 6 deletions go/api/gen/kagent/api/v1/system.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

46 changes: 19 additions & 27 deletions go/core/internal/service/system/service.go
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ func NewService(
) *Service {
return &Service{
kubeClient: kubeClient,
observedNamespaces: slices.Clone(observedNamespaces),
observedNamespaces: slices.Compact(slices.Sorted(slices.Values(observedNamespaces))),
authorizer: authorizer,
ateClient: ateClient,
}
Expand Down Expand Up @@ -148,16 +148,6 @@ func namespacesFromNames(names []string) []Namespace {
return result
}

func (s *Service) substrateNamespaces(requested string) []string {
if requested != "" {
return []string{requested}
}
if len(s.observedNamespaces) > 0 {
return slices.Clone(s.observedNamespaces)
}
return []string{""}
}

func (s *Service) listWorkerPools(ctx context.Context, namespace string) ([]atev1alpha1.WorkerPool, error) {
var options []client.ListOption
if namespace != "" {
Expand All @@ -173,23 +163,25 @@ func (s *Service) listWorkerPools(ctx context.Context, namespace string) ([]atev
}

// substrateActorTemplates drains upstream pagination for the configuration-sized list.
func (s *Service) substrateActorTemplates(ctx context.Context, atespace string) ([]*ateapipb.ActorTemplate, error) {
templatesFromAPI, err := s.ateClient.ListActorTemplates(ctx, atespace)
if err != nil {
return nil, err
}
templates := make([]*ateapipb.ActorTemplate, 0, len(templatesFromAPI))
for _, template := range templatesFromAPI {
if template == nil {
continue
func (s *Service) substrateActorTemplates(ctx context.Context, scope substrateScope) ([]*ateapipb.ActorTemplate, error) {
templates := []*ateapipb.ActorTemplate{}
for _, atespace := range scope.listNamespaces() {
templatesFromAPI, err := s.ateClient.ListActorTemplates(ctx, atespace)
if err != nil {
return nil, err
}
for _, template := range templatesFromAPI {
if template == nil {
continue
}
// Only expose inventory fields: containers can contain resolved credentials.
templates = append(templates, &ateapipb.ActorTemplate{
Metadata: template.GetMetadata(),
Status: template.GetStatus(),
SandboxConfig: template.GetSandboxConfig(),
WorkerSelector: template.GetWorkerSelector(),
})
}
// Only expose inventory fields: containers can contain resolved credentials.
templates = append(templates, &ateapipb.ActorTemplate{
Metadata: template.GetMetadata(),
Status: template.GetStatus(),
SandboxConfig: template.GetSandboxConfig(),
WorkerSelector: template.GetWorkerSelector(),
})
}

slices.SortStableFunc(templates, func(left, right *ateapipb.ActorTemplate) int {
Expand Down
Loading
Loading