* generated based on 1.33 * Update version to 17.0 in version.json * Remove extra API endpoint from swagger.json * Remove ModelConverter and related AutoMapper components * Update package versions * Refactor code to use ConfigureAwait(false) for asynchronous calls and update target framework to net9.0 * Remove ConfigureAwait(false) from OidcAuthTests for consistency in async calls * Update SDK version in README to reflect support for net8.0 and net9.0 * Update dotnet SDK version to 9.0.x in build workflow * Revert Fractions package version to 7.3.0 in Directory.Packages.props * Update target framework to netstandard2.1 for improved compatibility * Update package references for Microsoft.CodeAnalysis in Directory.Packages.props and LibKubernetesGenerator.target * Refactor Worker class constructor documentation and standardize Dictionary type declaration in Program.cs
34 lines
835 B
C#
34 lines
835 B
C#
using k8s;
|
|
using k8s.Models;
|
|
|
|
var config = KubernetesClientConfiguration.BuildConfigFromConfigFile();
|
|
IKubernetes client = new Kubernetes(config);
|
|
Console.WriteLine("Starting Request!");
|
|
|
|
var pod = client.CoreV1.ListNamespacedPod("default").Items.First();
|
|
var name = pod.Metadata.Name;
|
|
PrintLabels(pod);
|
|
|
|
var patchStr = @"
|
|
{
|
|
""metadata"": {
|
|
""labels"": {
|
|
""test"": ""test""
|
|
}
|
|
}
|
|
}";
|
|
|
|
client.CoreV1.PatchNamespacedPod(new V1Patch(patchStr, V1Patch.PatchType.MergePatch), name, "default");
|
|
PrintLabels(client.CoreV1.ReadNamespacedPod(name, "default"));
|
|
|
|
static void PrintLabels(V1Pod pod)
|
|
{
|
|
Console.WriteLine($"Labels: for {pod.Metadata.Name}");
|
|
foreach (var (k, v) in pod.Metadata.Labels)
|
|
{
|
|
Console.WriteLine($"{k} : {v}");
|
|
}
|
|
|
|
Console.WriteLine("=-=-=-=-=-=-=-=-=-=-=");
|
|
}
|