stylecop fix followup, enforce SA1503 (#432)
* enforce SA1503 * fix spacing * fix SA1413 * fix spacing * fix SA1013
This commit is contained in:
@@ -23,7 +23,9 @@ namespace attach
|
||||
|
||||
private async static Task AttachToPod(IKubernetes client, V1Pod pod)
|
||||
{
|
||||
var webSocket = await client.WebSocketNamespacedPodAttachAsync(pod.Metadata.Name, "default", pod.Spec.Containers[0].Name);
|
||||
var webSocket =
|
||||
await client.WebSocketNamespacedPodAttachAsync(pod.Metadata.Name, "default",
|
||||
pod.Spec.Containers[0].Name);
|
||||
|
||||
var demux = new StreamDemuxer(webSocket);
|
||||
demux.Start();
|
||||
|
||||
@@ -20,7 +20,9 @@ namespace exec
|
||||
|
||||
private async static Task ExecInPod(IKubernetes client, V1Pod pod)
|
||||
{
|
||||
var webSocket = await client.WebSocketNamespacedPodExecAsync(pod.Metadata.Name, "default", "ls", pod.Spec.Containers[0].Name);
|
||||
var webSocket =
|
||||
await client.WebSocketNamespacedPodExecAsync(pod.Metadata.Name, "default", "ls",
|
||||
pod.Spec.Containers[0].Name);
|
||||
|
||||
var demux = new StreamDemuxer(webSocket);
|
||||
demux.Start();
|
||||
|
||||
@@ -28,6 +28,7 @@ namespace httpClientFactory
|
||||
{
|
||||
_logger.LogInformation(item.Metadata.Name);
|
||||
}
|
||||
|
||||
if (list.Items.Count == 0)
|
||||
{
|
||||
_logger.LogInformation("Empty!");
|
||||
|
||||
@@ -12,10 +12,7 @@ namespace httpClientFactory
|
||||
{
|
||||
// Learn more about generic hosts at https://docs.microsoft.com/en-us/aspnet/core/fundamentals/host/generic-host
|
||||
using (var host = new HostBuilder()
|
||||
.ConfigureLogging((logging) =>
|
||||
{
|
||||
logging.AddConsole();
|
||||
})
|
||||
.ConfigureLogging((logging) => { logging.AddConsole(); })
|
||||
.ConfigureServices((hostBuilderContext, services) =>
|
||||
{
|
||||
// Ideally this config would be read from the .net core config constructs,
|
||||
|
||||
@@ -21,11 +21,13 @@ namespace simple
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
var labels = new List<string>();
|
||||
foreach (var key in item.Spec.Selector)
|
||||
{
|
||||
labels.Add(key.Key + "=" + key.Value);
|
||||
}
|
||||
|
||||
var labelStr = string.Join(",", labels.ToArray());
|
||||
Console.WriteLine(labelStr);
|
||||
var podList = client.ListNamespacedPod("default", labelSelector: labelStr);
|
||||
@@ -33,10 +35,12 @@ namespace simple
|
||||
{
|
||||
Console.WriteLine(pod.Metadata.Name);
|
||||
}
|
||||
|
||||
if (podList.Items.Count == 0)
|
||||
{
|
||||
Console.WriteLine("Empty!");
|
||||
}
|
||||
|
||||
Console.WriteLine();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -19,9 +19,11 @@ namespace logs
|
||||
Console.WriteLine("No pods!");
|
||||
return;
|
||||
}
|
||||
|
||||
var pod = list.Items[0];
|
||||
|
||||
var response = await client.ReadNamespacedPodLogWithHttpMessagesAsync(pod.Metadata.Name, pod.Metadata.NamespaceProperty, follow: true);
|
||||
var response = await client.ReadNamespacedPodLogWithHttpMessagesAsync(pod.Metadata.Name,
|
||||
pod.Metadata.NamespaceProperty, follow: true);
|
||||
var stream = response.Body;
|
||||
stream.CopyTo(Console.OpenStandardOutput());
|
||||
}
|
||||
|
||||
@@ -15,6 +15,7 @@ namespace @namespace
|
||||
{
|
||||
Console.WriteLine(item.Metadata.Name);
|
||||
}
|
||||
|
||||
if (list.Items.Count == 0)
|
||||
{
|
||||
Console.WriteLine("Empty!");
|
||||
@@ -41,6 +42,7 @@ namespace @namespace
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
throw ex;
|
||||
}
|
||||
}
|
||||
@@ -51,6 +53,7 @@ namespace @namespace
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
throw ex;
|
||||
}
|
||||
}
|
||||
@@ -68,13 +71,7 @@ namespace @namespace
|
||||
|
||||
ListNamespaces(client);
|
||||
|
||||
var ns = new V1Namespace
|
||||
{
|
||||
Metadata = new V1ObjectMeta
|
||||
{
|
||||
Name = "test"
|
||||
}
|
||||
};
|
||||
var ns = new V1Namespace { Metadata = new V1ObjectMeta { Name = "test" } };
|
||||
|
||||
var result = client.CreateNamespace(ns);
|
||||
Console.WriteLine(result);
|
||||
|
||||
@@ -20,10 +20,7 @@ namespace patch
|
||||
var name = pod.Metadata.Name;
|
||||
PrintLabels(pod);
|
||||
|
||||
var newlabels = new Dictionary<string, string>(pod.Metadata.Labels)
|
||||
{
|
||||
["test"] = "test"
|
||||
};
|
||||
var newlabels = new Dictionary<string, string>(pod.Metadata.Labels) { ["test"] = "test" };
|
||||
var patch = new JsonPatchDocument<V1Pod>();
|
||||
patch.Replace(e => e.Metadata.Labels, newlabels);
|
||||
client.PatchNamespacedPod(new V1Patch(patch), name, "default");
|
||||
@@ -38,6 +35,7 @@ namespace patch
|
||||
{
|
||||
Console.WriteLine($"{k} : {v}");
|
||||
}
|
||||
|
||||
Console.WriteLine("=-=-=-=-=-=-=-=-=-=-=");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -16,6 +16,7 @@ namespace simple
|
||||
{
|
||||
Console.WriteLine(item.Metadata.Name);
|
||||
}
|
||||
|
||||
if (list.Items.Count == 0)
|
||||
{
|
||||
Console.WriteLine("Empty!");
|
||||
|
||||
Reference in New Issue
Block a user