From 0db6a1efbf4de382d480b4fe126e23a93372b9fe Mon Sep 17 00:00:00 2001 From: Tom Date: Sat, 18 Sep 2021 01:12:16 +0300 Subject: [PATCH 1/2] Added support for previous flag --- src/KubeClient/ResourceClients/PodClientV1.cs | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/KubeClient/ResourceClients/PodClientV1.cs b/src/KubeClient/ResourceClients/PodClientV1.cs index 7c969a3..2992aae 100644 --- a/src/KubeClient/ResourceClients/PodClientV1.cs +++ b/src/KubeClient/ResourceClients/PodClientV1.cs @@ -144,7 +144,7 @@ public IObservable> WatchAll(string labelSelector = null /// /// A string containing the logs. /// - public async Task Logs(string name, string containerName = null, string kubeNamespace = null, int? limitBytes = null, int? tailLines = null, CancellationToken cancellationToken = default) + public async Task Logs(string name, string containerName = null, string kubeNamespace = null, int? limitBytes = null, int? tailLines = null, bool? previous = false, CancellationToken cancellationToken = default) { if (String.IsNullOrWhiteSpace(name)) throw new ArgumentException("Argument cannot be null, empty, or entirely composed of whitespace: 'name'.", nameof(name)); @@ -156,7 +156,8 @@ public async Task Logs(string name, string containerName = null, string ContainerName = containerName, Namespace = kubeNamespace ?? KubeClient.DefaultNamespace, LimitBytes = limitBytes, - TailLines = tailLines + TailLines = tailLines, + Previous = previous?.ToString().ToLowerInvariant() }), cancellationToken ); @@ -288,7 +289,7 @@ public static class Requests /// /// A get-logs Pod (v1) request. /// - public static readonly HttpRequest Logs = ByName.WithRelativeUri("log?container={ContainerName?}&follow={Follow?}&limitBytes={LimitBytes?}&tailLines={TailLines?}"); + public static readonly HttpRequest Logs = ByName.WithRelativeUri("log?container={ContainerName?}&follow={Follow?}&limitBytes={LimitBytes?}&tailLines={TailLines?}&previous={Previous?}"); } } From c7102f6b95611c9ee0e41d711309131473daab2d Mon Sep 17 00:00:00 2001 From: Tom Date: Sat, 18 Sep 2021 01:13:45 +0300 Subject: [PATCH 2/2] Default previous flag to null --- src/KubeClient/ResourceClients/PodClientV1.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/KubeClient/ResourceClients/PodClientV1.cs b/src/KubeClient/ResourceClients/PodClientV1.cs index 2992aae..65ff4a0 100644 --- a/src/KubeClient/ResourceClients/PodClientV1.cs +++ b/src/KubeClient/ResourceClients/PodClientV1.cs @@ -144,7 +144,7 @@ public IObservable> WatchAll(string labelSelector = null /// /// A string containing the logs. /// - public async Task Logs(string name, string containerName = null, string kubeNamespace = null, int? limitBytes = null, int? tailLines = null, bool? previous = false, CancellationToken cancellationToken = default) + public async Task Logs(string name, string containerName = null, string kubeNamespace = null, int? limitBytes = null, int? tailLines = null, bool? previous = null, CancellationToken cancellationToken = default) { if (String.IsNullOrWhiteSpace(name)) throw new ArgumentException("Argument cannot be null, empty, or entirely composed of whitespace: 'name'.", nameof(name));