Unistore: Add validation for resource names (#110990)

* Unistore: Add validation for resource names

Signed-off-by: Maicon Costa <maiconscosta@gmail.com>

---------

Signed-off-by: Maicon Costa <maiconscosta@gmail.com>
This commit is contained in:
maicon
2025-09-19 09:37:17 -03:00
committed by GitHub
parent 63692fec55
commit b63e3fd3ae
7 changed files with 364 additions and 4 deletions
@@ -684,7 +684,7 @@ func RunTestClusterScopedWatch(ctx context.Context, t *testing.T, store storage.
currentObjs := map[string]*example.Pod{}
for _, watchTest := range tt.watchTests {
out := &example.Pod{}
key := "pods/" + watchTest.obj.Name
key := "pods/ns-1/" + watchTest.obj.Name
err := store.GuaranteedUpdate(ctx, key, out, true, nil, storage.SimpleUpdate(
func(runtime.Object) (runtime.Object, error) {
obj := watchTest.obj.DeepCopy()
@@ -1607,15 +1607,15 @@ func clusterScopedNodeNameAttrFunc(obj runtime.Object) (labels.Set, fields.Set,
}
func basePod(podName string) *example.Pod {
return baseNamespacedPod(podName, "")
return baseNamespacedPod(podName, "ns-1")
}
func basePodUpdated(podName string) *example.Pod {
return baseNamespacedPodUpdated(podName, "")
return baseNamespacedPodUpdated(podName, "ns-1")
}
func basePodAssigned(podName, nodeName string) *example.Pod {
return baseNamespacedPodAssigned(podName, "", nodeName)
return baseNamespacedPodAssigned(podName, "ns-1", nodeName)
}
func baseNamespacedPod(podName, namespace string) *example.Pod {