* Initial port of cache functions from java client * Move lock in Cache.Replace to be less disruptive * Remove IListerWatcher as it's not used at the moment * Added todo in Cache.Get as reminder * TApiType implement IKubernetesObject * TApiType implement IKubernetesObject * TApiType implement class along with IKubernetesObject * Disable failing test until it can be figured out * Ran `dotnet format --fix-whitespace --fix-style` to put formatting in compliance * Moved contents of KubernetesClient.Util into KubernetesClient project * Moved contents of KubernetesClient.Util into KubernetesClient project #2 :(
46 lines
1.2 KiB
C#
46 lines
1.2 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using k8s.Models;
|
|
|
|
namespace k8s.Tests.Util.Informer.Cache
|
|
{
|
|
internal static class Util
|
|
{
|
|
internal static IEnumerable<V1Pod> CreatePods(int cnt)
|
|
{
|
|
var pods = new List<V1Pod>();
|
|
for (var i = 0; i < cnt; i++)
|
|
{
|
|
pods.Add(new V1Pod()
|
|
{
|
|
ApiVersion = "Pod/V1",
|
|
Kind = "Pod",
|
|
Metadata = new V1ObjectMeta()
|
|
{
|
|
Name = Guid.NewGuid().ToString(),
|
|
NamespaceProperty = "the-namespace",
|
|
ResourceVersion = "1",
|
|
},
|
|
});
|
|
}
|
|
|
|
return pods;
|
|
}
|
|
|
|
internal static V1PodList CreatePostList(int cnt)
|
|
{
|
|
return new V1PodList()
|
|
{
|
|
ApiVersion = "Pod/V1",
|
|
Kind = "Pod",
|
|
Metadata = new V1ListMeta()
|
|
{
|
|
ResourceVersion = "1",
|
|
},
|
|
Items = CreatePods(cnt).ToList(),
|
|
};
|
|
}
|
|
}
|
|
}
|