* fix typo * Add modular API * Use x-kubernetes-action instead of operationId to generate method names * fix * Clean code style warnings * Refactor client constructors to use Kubernetes type instead of IKubernetes * Add ClientSet tests for Kubernetes pod operations * Fix order of parameters in Pod API calls for consistency * Enhance documentation for ClientSet and ResourceClient classes * Refactor ClientSet and GroupClient for Kubernetes usage * Refactor Pod API calls in tests to use singular form for consistency * Refactor Pod API calls to use 'Create' and 'Update' methods for consistency
27 lines
841 B
C#
27 lines
841 B
C#
// See https://aka.ms/new-console-template for more information
|
|
using k8s;
|
|
using k8s.ClientSets;
|
|
using System.Threading.Tasks;
|
|
|
|
namespace clientset
|
|
{
|
|
internal class Program
|
|
{
|
|
private static async Task Main(string[] args)
|
|
{
|
|
var config = KubernetesClientConfiguration.BuildConfigFromConfigFile();
|
|
var client = new Kubernetes(config);
|
|
|
|
ClientSet clientSet = new ClientSet(client);
|
|
var list = await clientSet.CoreV1.Pod.ListAsync("default").ConfigureAwait(false);
|
|
foreach (var item in list)
|
|
{
|
|
System.Console.WriteLine(item.Metadata.Name);
|
|
}
|
|
|
|
var pod = await clientSet.CoreV1.Pod.GetAsync("test","default").ConfigureAwait(false);
|
|
System.Console.WriteLine(pod?.Metadata?.Name);
|
|
}
|
|
}
|
|
}
|