Version 17.0 + Generate 1.33 (#1626)
* 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
This commit is contained in:
@@ -1,17 +1,17 @@
|
||||
using Json.Patch;
|
||||
using Json.Patch;
|
||||
using k8s;
|
||||
using k8s.Models;
|
||||
using System.Text.Json;
|
||||
|
||||
async Task RestartDaemonSetAsync(string name, string @namespace, IKubernetes client)
|
||||
{
|
||||
var daemonSet = await client.AppsV1.ReadNamespacedDaemonSetAsync(name, @namespace);
|
||||
var daemonSet = await client.AppsV1.ReadNamespacedDaemonSetAsync(name, @namespace).ConfigureAwait(false);
|
||||
var options = new JsonSerializerOptions { PropertyNamingPolicy = JsonNamingPolicy.CamelCase, WriteIndented = true };
|
||||
var old = JsonSerializer.SerializeToDocument(daemonSet, options);
|
||||
var now = DateTimeOffset.Now.ToUnixTimeSeconds();
|
||||
var restart = new Dictionary<string, string>
|
||||
{
|
||||
["date"] = now.ToString()
|
||||
["date"] = now.ToString(),
|
||||
};
|
||||
|
||||
daemonSet.Spec.Template.Metadata.Annotations = restart;
|
||||
@@ -19,18 +19,18 @@ async Task RestartDaemonSetAsync(string name, string @namespace, IKubernetes cli
|
||||
var expected = JsonSerializer.SerializeToDocument(daemonSet);
|
||||
|
||||
var patch = old.CreatePatch(expected);
|
||||
await client.AppsV1.PatchNamespacedDaemonSetAsync(new V1Patch(patch, V1Patch.PatchType.JsonPatch), name, @namespace);
|
||||
await client.AppsV1.PatchNamespacedDaemonSetAsync(new V1Patch(patch, V1Patch.PatchType.JsonPatch), name, @namespace).ConfigureAwait(false);
|
||||
}
|
||||
|
||||
async Task RestartDeploymentAsync(string name, string @namespace, IKubernetes client)
|
||||
{
|
||||
var deployment = await client.AppsV1.ReadNamespacedDeploymentAsync(name, @namespace);
|
||||
var deployment = await client.AppsV1.ReadNamespacedDeploymentAsync(name, @namespace).ConfigureAwait(false);
|
||||
var options = new JsonSerializerOptions { PropertyNamingPolicy = JsonNamingPolicy.CamelCase, WriteIndented = true };
|
||||
var old = JsonSerializer.SerializeToDocument(deployment, options);
|
||||
var now = DateTimeOffset.Now.ToUnixTimeSeconds();
|
||||
var restart = new Dictionary<string, string>
|
||||
{
|
||||
["date"] = now.ToString()
|
||||
["date"] = now.ToString(),
|
||||
};
|
||||
|
||||
deployment.Spec.Template.Metadata.Annotations = restart;
|
||||
@@ -38,18 +38,18 @@ async Task RestartDeploymentAsync(string name, string @namespace, IKubernetes cl
|
||||
var expected = JsonSerializer.SerializeToDocument(deployment);
|
||||
|
||||
var patch = old.CreatePatch(expected);
|
||||
await client.AppsV1.PatchNamespacedDeploymentAsync(new V1Patch(patch, V1Patch.PatchType.JsonPatch), name, @namespace);
|
||||
await client.AppsV1.PatchNamespacedDeploymentAsync(new V1Patch(patch, V1Patch.PatchType.JsonPatch), name, @namespace).ConfigureAwait(false);
|
||||
}
|
||||
|
||||
async Task RestartStatefulSetAsync(string name, string @namespace, IKubernetes client)
|
||||
{
|
||||
var deployment = await client.AppsV1.ReadNamespacedStatefulSetAsync(name, @namespace);
|
||||
var deployment = await client.AppsV1.ReadNamespacedStatefulSetAsync(name, @namespace).ConfigureAwait(false);
|
||||
var options = new JsonSerializerOptions { PropertyNamingPolicy = JsonNamingPolicy.CamelCase, WriteIndented = true };
|
||||
var old = JsonSerializer.SerializeToDocument(deployment, options);
|
||||
var now = DateTimeOffset.Now.ToUnixTimeSeconds();
|
||||
var restart = new Dictionary<string, string>
|
||||
{
|
||||
["date"] = now.ToString()
|
||||
["date"] = now.ToString(),
|
||||
};
|
||||
|
||||
deployment.Spec.Template.Metadata.Annotations = restart;
|
||||
@@ -57,12 +57,12 @@ async Task RestartStatefulSetAsync(string name, string @namespace, IKubernetes c
|
||||
var expected = JsonSerializer.SerializeToDocument(deployment);
|
||||
|
||||
var patch = old.CreatePatch(expected);
|
||||
await client.AppsV1.PatchNamespacedStatefulSetAsync(new V1Patch(patch, V1Patch.PatchType.JsonPatch), name, @namespace);
|
||||
await client.AppsV1.PatchNamespacedStatefulSetAsync(new V1Patch(patch, V1Patch.PatchType.JsonPatch), name, @namespace).ConfigureAwait(false);
|
||||
}
|
||||
|
||||
var config = KubernetesClientConfiguration.BuildConfigFromConfigFile();
|
||||
IKubernetes client = new Kubernetes(config);
|
||||
|
||||
await RestartDeploymentAsync("event-exporter", "monitoring", client);
|
||||
await RestartDaemonSetAsync("prometheus-exporter", "monitoring", client);
|
||||
await RestartStatefulSetAsync("argocd-application-controlle", "argocd", client);
|
||||
await RestartDeploymentAsync("event-exporter", "monitoring", client).ConfigureAwait(false);
|
||||
await RestartDaemonSetAsync("prometheus-exporter", "monitoring", client).ConfigureAwait(false);
|
||||
await RestartStatefulSetAsync("argocd-application-controlle", "argocd", client).ConfigureAwait(false);
|
||||
|
||||
Reference in New Issue
Block a user