馃搵 Prerequisites
馃幆 Affected Service(s)
Multiple services / System-wide issue
馃殾 Impact/Severity
Minor inconvenience
馃悰 Bug Description
The collectionReader.fetchObject() function in the controller is using krt.FilterObjectName(key) to fetch objects, but passing a NamespacedName (which contains both namespace and name). The filter only checks the name, ignoring the namespace.
Location
go/core/v2/controller/collection_reader.go - fetchObject() function
func (r collectionReader) fetchObject[T controllers.ComparableObject](collection krt.Collection[T], key types.NamespacedName, resource schema.GroupResource) (T, error) {
object := krt.FetchOne(r.ctx, collection, krt.FilterObjectName(key))
// ...
}
Problem
krt.FilterObjectName() only filters by object name, not by namespace. This means:
- If two namespaces have objects with the same name, the wrong object could be fetched
- The namespace part of the
NamespacedName is completely ignored
- This can cause incorrect configurations to be loaded at runtime
Solution
Filter by both namespace AND name:
func (r collectionReader) fetchObject[T controllers.ComparableObject](collection krt.Collection[T], key types.NamespacedName, resource schema.GroupResource) (T, error) {
object := krt.FetchOne(r.ctx, collection, krt.FilterNamespace(key.Namespace), krt.FilterName(key.Name))
if object == nil {
var zero T
return zero, apierrors.NewNotFound(resource, key.Name)
}
return *object, nil
}
Alternatively, if KRT provides a combined filter:
object := krt.FetchOne(r.ctx, collection, krt.FilterNamespacedName(key))
馃 Expected Behavior
No response
馃摫 Actual Behavior
No response
馃捇 Environment
No response
馃敡 CLI Bug Report
No response
馃攳 Additional Context
This affects resource lookups across all KRT collections:
- AgentTemplates
- ModelConfigs
- RemoteMCPServers
- ConfigMaps
- Secrets
- WorkerPools
Any code relying on collectionReader.Get() may fetch incorrect objects.
馃搵 Logs
馃摲 Screenshots
No response
馃檵 Are you willing to contribute?
馃搵 Prerequisites
馃幆 Affected Service(s)
Multiple services / System-wide issue
馃殾 Impact/Severity
Minor inconvenience
馃悰 Bug Description
The
collectionReader.fetchObject()function in the controller is usingkrt.FilterObjectName(key)to fetch objects, but passing aNamespacedName(which contains both namespace and name). The filter only checks the name, ignoring the namespace.Location
go/core/v2/controller/collection_reader.go-fetchObject()functionProblem
krt.FilterObjectName()only filters by object name, not by namespace. This means:NamespacedNameis completely ignoredSolution
Filter by both namespace AND name:
Alternatively, if KRT provides a combined filter:
馃 Expected Behavior
No response
馃摫 Actual Behavior
No response
馃捇 Environment
No response
馃敡 CLI Bug Report
No response
馃攳 Additional Context
This affects resource lookups across all KRT collections:
Any code relying on
collectionReader.Get()may fetch incorrect objects.馃搵 Logs
馃摲 Screenshots
No response
馃檵 Are you willing to contribute?