Style fix final (#523)
* all net5 * var * SA1310 * SA1310 * allow 1031 * SA1805 * fix SA1642 * remove unused code * allow sa1405 * isempty * fix CA1714 * fix CA1806 * remove always false if * fix format * fix CA1062 * allow SA0001 * fix CA1062 * allow ca1034 and temp allow ca1835 * fix 16XX doc related warnings * elm SA16XX * elm SA16XX * fix CA2213 * revert to pass all test * move unclear rule to ruleset * follow up of moving ruleset * remove this * fix test flaky
This commit is contained in:
@@ -1,13 +1,12 @@
|
|||||||
<Project Sdk="Microsoft.NET.Sdk">
|
<Project Sdk="Microsoft.NET.Sdk">
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<ProjectReference Include="..\..\src\KubernetesClient\KubernetesClient.csproj" />
|
<ProjectReference Include="..\..\src\KubernetesClient\KubernetesClient.csproj" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<OutputType>Exe</OutputType>
|
<OutputType>Exe</OutputType>
|
||||||
<TargetFramework>netcoreapp2.1</TargetFramework>
|
<TargetFramework>net5</TargetFramework>
|
||||||
<LangVersion>7.1</LangVersion>
|
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
</Project>
|
</Project>
|
||||||
|
|||||||
@@ -6,8 +6,7 @@
|
|||||||
|
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<OutputType>Exe</OutputType>
|
<OutputType>Exe</OutputType>
|
||||||
<TargetFramework>netcoreapp2.1</TargetFramework>
|
<TargetFramework>net5</TargetFramework>
|
||||||
<LangVersion>7.1</LangVersion>
|
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
</Project>
|
</Project>
|
||||||
|
|||||||
@@ -2,8 +2,7 @@
|
|||||||
|
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<OutputType>Exe</OutputType>
|
<OutputType>Exe</OutputType>
|
||||||
<TargetFramework>netcoreapp2.2</TargetFramework>
|
<TargetFramework>net5</TargetFramework>
|
||||||
<LangVersion>latest</LangVersion>
|
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
<Project Sdk="Microsoft.NET.Sdk">
|
<Project Sdk="Microsoft.NET.Sdk">
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<ProjectReference Include="..\..\src\KubernetesClient\KubernetesClient.csproj" />
|
<ProjectReference Include="..\..\src\KubernetesClient\KubernetesClient.csproj" />
|
||||||
@@ -6,7 +6,7 @@
|
|||||||
|
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<OutputType>Exe</OutputType>
|
<OutputType>Exe</OutputType>
|
||||||
<TargetFramework>netcoreapp2.0</TargetFramework>
|
<TargetFramework>net5</TargetFramework>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
</Project>
|
</Project>
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
<Project Sdk="Microsoft.NET.Sdk">
|
<Project Sdk="Microsoft.NET.Sdk">
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<ProjectReference Include="..\..\src\KubernetesClient\KubernetesClient.csproj" />
|
<ProjectReference Include="..\..\src\KubernetesClient\KubernetesClient.csproj" />
|
||||||
@@ -6,8 +6,7 @@
|
|||||||
|
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<OutputType>Exe</OutputType>
|
<OutputType>Exe</OutputType>
|
||||||
<TargetFramework>netcoreapp2.0</TargetFramework>
|
<TargetFramework>net5</TargetFramework>
|
||||||
<LangVersion>7.1</LangVersion>
|
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
</Project>
|
</Project>
|
||||||
|
|||||||
@@ -1,8 +1,8 @@
|
|||||||
<Project Sdk="Microsoft.NET.Sdk">
|
<Project Sdk="Microsoft.NET.Sdk">
|
||||||
|
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<OutputType>Exe</OutputType>
|
<OutputType>Exe</OutputType>
|
||||||
<TargetFramework>netcoreapp3.1</TargetFramework>
|
<TargetFramework>net5</TargetFramework>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
<Project Sdk="Microsoft.NET.Sdk">
|
<Project Sdk="Microsoft.NET.Sdk">
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<ProjectReference Include="..\..\src\KubernetesClient\KubernetesClient.csproj" />
|
<ProjectReference Include="..\..\src\KubernetesClient\KubernetesClient.csproj" />
|
||||||
@@ -6,7 +6,7 @@
|
|||||||
|
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<OutputType>Exe</OutputType>
|
<OutputType>Exe</OutputType>
|
||||||
<TargetFramework>netcoreapp2.0</TargetFramework>
|
<TargetFramework>net5</TargetFramework>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
</Project>
|
</Project>
|
||||||
|
|||||||
@@ -1,8 +1,8 @@
|
|||||||
<Project Sdk="Microsoft.NET.Sdk">
|
<Project Sdk="Microsoft.NET.Sdk">
|
||||||
|
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<OutputType>Exe</OutputType>
|
<OutputType>Exe</OutputType>
|
||||||
<TargetFramework>netcoreapp2.1</TargetFramework>
|
<TargetFramework>net5</TargetFramework>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
<Project Sdk="Microsoft.NET.Sdk">
|
<Project Sdk="Microsoft.NET.Sdk">
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<ProjectReference Include="..\..\src\KubernetesClient\KubernetesClient.csproj" />
|
<ProjectReference Include="..\..\src\KubernetesClient\KubernetesClient.csproj" />
|
||||||
@@ -6,7 +6,7 @@
|
|||||||
|
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<OutputType>Exe</OutputType>
|
<OutputType>Exe</OutputType>
|
||||||
<TargetFramework>netcoreapp2.0</TargetFramework>
|
<TargetFramework>net5</TargetFramework>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
</Project>
|
</Project>
|
||||||
|
|||||||
@@ -1,8 +1,8 @@
|
|||||||
<Project Sdk="Microsoft.NET.Sdk">
|
<Project Sdk="Microsoft.NET.Sdk">
|
||||||
|
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<OutputType>Exe</OutputType>
|
<OutputType>Exe</OutputType>
|
||||||
<TargetFramework>netcoreapp2.0</TargetFramework>
|
<TargetFramework>net5</TargetFramework>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
|||||||
@@ -14,7 +14,7 @@ namespace k8s
|
|||||||
public partial class Kubernetes
|
public partial class Kubernetes
|
||||||
{
|
{
|
||||||
{{#.}}
|
{{#.}}
|
||||||
/// <inheritdoc>
|
/// <inheritdoc/>
|
||||||
public Task<Watcher<{{GetClassName operation}}>> {{GetMethodName operation}}(
|
public Task<Watcher<{{GetClassName operation}}>> {{GetMethodName operation}}(
|
||||||
{{#operation.actualParameters}}
|
{{#operation.actualParameters}}
|
||||||
{{#isRequired}}
|
{{#isRequired}}
|
||||||
|
|||||||
@@ -2,8 +2,7 @@
|
|||||||
|
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<OutputType>Exe</OutputType>
|
<OutputType>Exe</OutputType>
|
||||||
<TargetFramework>netcoreapp2.0</TargetFramework>
|
<TargetFramework>net5</TargetFramework>
|
||||||
<LangVersion>latest</LangVersion>
|
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
|||||||
@@ -67,7 +67,7 @@ namespace KubernetesWatchGenerator
|
|||||||
.ToHashSet();
|
.ToHashSet();
|
||||||
|
|
||||||
_classNameToPluralMap = swagger.Operations
|
_classNameToPluralMap = swagger.Operations
|
||||||
.Where(x => x.Operation.OperationId.StartsWith("list"))
|
.Where(x => x.Operation.OperationId.StartsWith("list", StringComparison.InvariantCulture))
|
||||||
.Select(x =>
|
.Select(x =>
|
||||||
{
|
{
|
||||||
return new
|
return new
|
||||||
@@ -82,7 +82,7 @@ namespace KubernetesWatchGenerator
|
|||||||
|
|
||||||
// dictionary only contains "list" plural maps. assign the same plural names to entities those lists support
|
// dictionary only contains "list" plural maps. assign the same plural names to entities those lists support
|
||||||
_classNameToPluralMap = _classNameToPluralMap
|
_classNameToPluralMap = _classNameToPluralMap
|
||||||
.Where(x => x.Key.EndsWith("List"))
|
.Where(x => x.Key.EndsWith("List", StringComparison.InvariantCulture))
|
||||||
.Select(x =>
|
.Select(x =>
|
||||||
new { ClassName = x.Key.Remove(x.Key.Length - 4), PluralName = x.Value })
|
new { ClassName = x.Key.Remove(x.Key.Length - 4), PluralName = x.Value })
|
||||||
.ToDictionary(x => x.ClassName, x => x.PluralName)
|
.ToDictionary(x => x.ClassName, x => x.PluralName)
|
||||||
@@ -171,9 +171,9 @@ namespace KubernetesWatchGenerator
|
|||||||
{
|
{
|
||||||
if (arguments != null && arguments.Count > 0 && arguments[0] != null && arguments[0] is string)
|
if (arguments != null && arguments.Count > 0 && arguments[0] != null && arguments[0] is string)
|
||||||
{
|
{
|
||||||
bool first = true;
|
var first = true;
|
||||||
|
|
||||||
using (StringReader reader = new StringReader(arguments[0] as string))
|
using (var reader = new StringReader(arguments[0] as string))
|
||||||
{
|
{
|
||||||
string line = null;
|
string line = null;
|
||||||
while ((line = reader.ReadLine()) != null)
|
while ((line = reader.ReadLine()) != null)
|
||||||
@@ -496,9 +496,9 @@ namespace KubernetesWatchGenerator
|
|||||||
|
|
||||||
private static string GetPathExpression(SwaggerOperationDescription operation)
|
private static string GetPathExpression(SwaggerOperationDescription operation)
|
||||||
{
|
{
|
||||||
string pathExpression = operation.Path;
|
var pathExpression = operation.Path;
|
||||||
|
|
||||||
if (pathExpression.StartsWith("/"))
|
if (pathExpression.StartsWith("/", StringComparison.InvariantCulture))
|
||||||
{
|
{
|
||||||
pathExpression = pathExpression.Substring(1);
|
pathExpression = pathExpression.Substring(1);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -85,7 +85,7 @@
|
|||||||
<Rule Id="SA1402" Action="Error" />
|
<Rule Id="SA1402" Action="Error" />
|
||||||
|
|
||||||
<!-- A call to Debug.Assert in C# code does not include a descriptive message. https://github.com/DotNetAnalyzers/StyleCopAnalyzers/blob/master/documentation/SA1405.md -->
|
<!-- A call to Debug.Assert in C# code does not include a descriptive message. https://github.com/DotNetAnalyzers/StyleCopAnalyzers/blob/master/documentation/SA1405.md -->
|
||||||
<Rule Id="SA1405" Action="Warning" />
|
<Rule Id="SA1405" Action="None" />
|
||||||
|
|
||||||
<!-- The last statement in a multi-line C# initializer or list is missing a trailing comma. https://github.com/DotNetAnalyzers/StyleCopAnalyzers/blob/master/documentation/SA1413.md -->
|
<!-- The last statement in a multi-line C# initializer or list is missing a trailing comma. https://github.com/DotNetAnalyzers/StyleCopAnalyzers/blob/master/documentation/SA1413.md -->
|
||||||
<Rule Id="SA1413" Action="Error" />
|
<Rule Id="SA1413" Action="Error" />
|
||||||
@@ -187,7 +187,7 @@
|
|||||||
<Rule Id="SA1028" Action="Warning" />
|
<Rule Id="SA1028" Action="Warning" />
|
||||||
|
|
||||||
<!-- All diagnostics of XML documentation comments has been disabled due to the current project configuration. https://github.com/DotNetAnalyzers/StyleCopAnalyzers/blob/master/documentation/SA0001.md -->
|
<!-- All diagnostics of XML documentation comments has been disabled due to the current project configuration. https://github.com/DotNetAnalyzers/StyleCopAnalyzers/blob/master/documentation/SA0001.md -->
|
||||||
<Rule Id="SA0001" Action="Warning" />
|
<Rule Id="SA0001" Action="None" />
|
||||||
|
|
||||||
<!-- Call GC.SuppressFinalize correctly https://docs.microsoft.com/en-us/visualstudio/code-quality/CA1816 -->
|
<!-- Call GC.SuppressFinalize correctly https://docs.microsoft.com/en-us/visualstudio/code-quality/CA1816 -->
|
||||||
<Rule Id="CA1816" Action="Error" />
|
<Rule Id="CA1816" Action="Error" />
|
||||||
@@ -220,10 +220,10 @@
|
|||||||
<Rule Id="CA1028" Action="Warning" />
|
<Rule Id="CA1028" Action="Warning" />
|
||||||
|
|
||||||
<!-- Do not catch general exception types https://docs.microsoft.com/en-us/visualstudio/code-quality/CA1031 -->
|
<!-- Do not catch general exception types https://docs.microsoft.com/en-us/visualstudio/code-quality/CA1031 -->
|
||||||
<Rule Id="CA1031" Action="Warning" />
|
<Rule Id="CA1031" Action="None" />
|
||||||
|
|
||||||
<!-- Nested types should not be visible https://docs.microsoft.com/en-us/visualstudio/code-quality/CA1034 -->
|
<!-- Nested types should not be visible https://docs.microsoft.com/en-us/visualstudio/code-quality/CA1034 -->
|
||||||
<Rule Id="CA1034" Action="Warning" />
|
<Rule Id="CA1034" Action="None" />
|
||||||
|
|
||||||
<!-- Do not declare visible instance fields https://docs.microsoft.com/en-us/visualstudio/code-quality/CA1051 -->
|
<!-- Do not declare visible instance fields https://docs.microsoft.com/en-us/visualstudio/code-quality/CA1051 -->
|
||||||
<Rule Id="CA1051" Action="Warning" />
|
<Rule Id="CA1051" Action="Warning" />
|
||||||
@@ -293,5 +293,13 @@
|
|||||||
<!-- TODO -->
|
<!-- TODO -->
|
||||||
<Rule Id="CA2008" Action="None" />
|
<Rule Id="CA2008" Action="None" />
|
||||||
|
|
||||||
|
<!-- TODO only in netcore2.1+-->
|
||||||
|
<Rule Id="CA1835" Action="Info" />
|
||||||
|
|
||||||
|
<!-- TODO missing doc-->
|
||||||
|
<Rule Id="CS1591" Action="None" />
|
||||||
|
<Rule Id="CS1573" Action="None" />
|
||||||
|
<Rule Id="CS1574" Action="None" />
|
||||||
|
|
||||||
</Rules>
|
</Rules>
|
||||||
</RuleSet>
|
</RuleSet>
|
||||||
|
|||||||
@@ -22,12 +22,12 @@ namespace k8s
|
|||||||
private const int DefaultMaximumSize = 40 * 1024 * 1024; // 40 MB
|
private const int DefaultMaximumSize = 40 * 1024 * 1024; // 40 MB
|
||||||
|
|
||||||
private readonly int maximumSize;
|
private readonly int maximumSize;
|
||||||
private readonly AutoResetEvent dataAvailable = new AutoResetEvent(initialState: false);
|
private readonly AutoResetEvent dataAvailable = new AutoResetEvent(false);
|
||||||
private readonly object lockObject = new object();
|
private readonly object lockObject = new object();
|
||||||
|
|
||||||
private byte[] buffer;
|
private byte[] buffer;
|
||||||
private int bytesWritten = 0;
|
private int bytesWritten;
|
||||||
private int bytesRead = 0;
|
private int bytesRead;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Used by a writer to indicate the end of the file. When set, the reader will be notified that no
|
/// Used by a writer to indicate the end of the file. When set, the reader will be notified that no
|
||||||
@@ -56,8 +56,8 @@ namespace k8s
|
|||||||
public ByteBuffer(int bufferSize, int maximumSize)
|
public ByteBuffer(int bufferSize, int maximumSize)
|
||||||
{
|
{
|
||||||
this.maximumSize = maximumSize;
|
this.maximumSize = maximumSize;
|
||||||
this.buffer = ArrayPool<byte>.Shared.Rent(bufferSize);
|
buffer = ArrayPool<byte>.Shared.Rent(bufferSize);
|
||||||
this.endOfFile = false;
|
endOfFile = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -65,7 +65,7 @@ namespace k8s
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public int Size
|
public int Size
|
||||||
{
|
{
|
||||||
get { return this.buffer.Length; }
|
get { return buffer.Length; }
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -73,7 +73,7 @@ namespace k8s
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public int MaximumSize
|
public int MaximumSize
|
||||||
{
|
{
|
||||||
get { return this.maximumSize; }
|
get { return maximumSize; }
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -93,25 +93,25 @@ namespace k8s
|
|||||||
{
|
{
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
lock (this.lockObject)
|
lock (lockObject)
|
||||||
{
|
{
|
||||||
if (this.ReadWaterMark == this.WriteWaterMark)
|
if (ReadWaterMark == WriteWaterMark)
|
||||||
{
|
{
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
else if (this.ReadWaterMark < this.WriteWaterMark)
|
else if (ReadWaterMark < WriteWaterMark)
|
||||||
{
|
{
|
||||||
return this.WriteWaterMark - this.ReadWaterMark;
|
return WriteWaterMark - ReadWaterMark;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
return
|
return
|
||||||
|
|
||||||
// Bytes available at the end of the array
|
// Bytes available at the end of the array
|
||||||
this.buffer.Length - this.ReadWaterMark
|
buffer.Length - ReadWaterMark
|
||||||
|
|
||||||
// Bytes available at the start of the array
|
// Bytes available at the start of the array
|
||||||
+ this.WriteWaterMark;
|
+ WriteWaterMark;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -124,23 +124,23 @@ namespace k8s
|
|||||||
{
|
{
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
lock (this.lockObject)
|
lock (lockObject)
|
||||||
{
|
{
|
||||||
if (this.WriteWaterMark > this.ReadWaterMark)
|
if (WriteWaterMark > ReadWaterMark)
|
||||||
{
|
{
|
||||||
return
|
return
|
||||||
/* Available bytes at the end of the buffer */
|
/* Available bytes at the end of the buffer */
|
||||||
this.buffer.Length - this.WriteWaterMark
|
buffer.Length - WriteWaterMark
|
||||||
/* Available bytes at the start of the buffer */
|
/* Available bytes at the start of the buffer */
|
||||||
+ this.ReadWaterMark;
|
+ ReadWaterMark;
|
||||||
}
|
}
|
||||||
else if (this.WriteWaterMark == this.ReadWaterMark)
|
else if (WriteWaterMark == ReadWaterMark)
|
||||||
{
|
{
|
||||||
return this.buffer.Length;
|
return buffer.Length;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
return this.ReadWaterMark - this.WriteWaterMark;
|
return ReadWaterMark - WriteWaterMark;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -160,35 +160,35 @@ namespace k8s
|
|||||||
/// </param>
|
/// </param>
|
||||||
public void Write(byte[] data, int offset, int length)
|
public void Write(byte[] data, int offset, int length)
|
||||||
{
|
{
|
||||||
lock (this.lockObject)
|
lock (lockObject)
|
||||||
{
|
{
|
||||||
// Does the data fit?
|
// Does the data fit?
|
||||||
// We must make sure that ReadWaterMark != WriteWaterMark; that would indicate 'all data has been read' instead
|
// We must make sure that ReadWaterMark != WriteWaterMark; that would indicate 'all data has been read' instead
|
||||||
// instead of 'all data must be read'
|
// instead of 'all data must be read'
|
||||||
if (this.AvailableWritableBytes <= length)
|
if (AvailableWritableBytes <= length)
|
||||||
{
|
{
|
||||||
// Grow the buffer
|
// Grow the buffer
|
||||||
this.Grow(this.buffer.Length + length - this.AvailableWritableBytes + 1);
|
Grow(buffer.Length + length - AvailableWritableBytes + 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Write the data; first the data that fits between the write watermark and the end of the buffer
|
// Write the data; first the data that fits between the write watermark and the end of the buffer
|
||||||
int availableBeforeWrapping = this.buffer.Length - this.WriteWaterMark;
|
var availableBeforeWrapping = buffer.Length - WriteWaterMark;
|
||||||
|
|
||||||
Array.Copy(data, offset, this.buffer, this.WriteWaterMark, Math.Min(availableBeforeWrapping, length));
|
Array.Copy(data, offset, buffer, WriteWaterMark, Math.Min(availableBeforeWrapping, length));
|
||||||
this.WriteWaterMark += Math.Min(availableBeforeWrapping, length);
|
WriteWaterMark += Math.Min(availableBeforeWrapping, length);
|
||||||
|
|
||||||
if (length > availableBeforeWrapping)
|
if (length > availableBeforeWrapping)
|
||||||
{
|
{
|
||||||
Array.Copy(data, offset + availableBeforeWrapping, this.buffer, 0,
|
Array.Copy(data, offset + availableBeforeWrapping, buffer, 0,
|
||||||
length - availableBeforeWrapping);
|
length - availableBeforeWrapping);
|
||||||
this.WriteWaterMark = length - availableBeforeWrapping;
|
WriteWaterMark = length - availableBeforeWrapping;
|
||||||
}
|
}
|
||||||
|
|
||||||
this.bytesWritten += length;
|
bytesWritten += length;
|
||||||
Debug.Assert(this.bytesRead + this.AvailableReadableBytes == this.bytesWritten);
|
Debug.Assert(bytesRead + AvailableReadableBytes == bytesWritten);
|
||||||
}
|
}
|
||||||
|
|
||||||
this.dataAvailable.Set();
|
dataAvailable.Set();
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -196,10 +196,10 @@ namespace k8s
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public void WriteEnd()
|
public void WriteEnd()
|
||||||
{
|
{
|
||||||
lock (this.lockObject)
|
lock (lockObject)
|
||||||
{
|
{
|
||||||
this.endOfFile = true;
|
endOfFile = true;
|
||||||
this.dataAvailable.Set();
|
dataAvailable.Set();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -220,37 +220,37 @@ namespace k8s
|
|||||||
/// </returns>
|
/// </returns>
|
||||||
public int Read(byte[] data, int offset, int count)
|
public int Read(byte[] data, int offset, int count)
|
||||||
{
|
{
|
||||||
while (this.AvailableReadableBytes == 0 && !this.endOfFile)
|
while (AvailableReadableBytes == 0 && !endOfFile)
|
||||||
{
|
{
|
||||||
this.dataAvailable.WaitOne();
|
dataAvailable.WaitOne();
|
||||||
}
|
}
|
||||||
|
|
||||||
int toRead = 0;
|
var toRead = 0;
|
||||||
|
|
||||||
lock (this.lockObject)
|
lock (lockObject)
|
||||||
{
|
{
|
||||||
// Signal the end of file to the caller.
|
// Signal the end of file to the caller.
|
||||||
if (this.AvailableReadableBytes == 0 && this.endOfFile)
|
if (AvailableReadableBytes == 0 && endOfFile)
|
||||||
{
|
{
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
toRead = Math.Min(this.AvailableReadableBytes, count);
|
toRead = Math.Min(AvailableReadableBytes, count);
|
||||||
|
|
||||||
int availableBeforeWrapping = this.buffer.Length - this.ReadWaterMark;
|
var availableBeforeWrapping = buffer.Length - ReadWaterMark;
|
||||||
|
|
||||||
Array.Copy(this.buffer, this.ReadWaterMark, data, offset, Math.Min(availableBeforeWrapping, toRead));
|
Array.Copy(buffer, ReadWaterMark, data, offset, Math.Min(availableBeforeWrapping, toRead));
|
||||||
this.ReadWaterMark += Math.Min(availableBeforeWrapping, toRead);
|
ReadWaterMark += Math.Min(availableBeforeWrapping, toRead);
|
||||||
|
|
||||||
if (toRead > availableBeforeWrapping)
|
if (toRead > availableBeforeWrapping)
|
||||||
{
|
{
|
||||||
Array.Copy(this.buffer, 0, data, offset + availableBeforeWrapping,
|
Array.Copy(buffer, 0, data, offset + availableBeforeWrapping,
|
||||||
toRead - availableBeforeWrapping);
|
toRead - availableBeforeWrapping);
|
||||||
this.ReadWaterMark = toRead - availableBeforeWrapping;
|
ReadWaterMark = toRead - availableBeforeWrapping;
|
||||||
}
|
}
|
||||||
|
|
||||||
this.bytesRead += toRead;
|
bytesRead += toRead;
|
||||||
Debug.Assert(this.bytesRead + this.AvailableReadableBytes == this.bytesWritten);
|
Debug.Assert(bytesRead + AvailableReadableBytes == bytesWritten);
|
||||||
}
|
}
|
||||||
|
|
||||||
return toRead;
|
return toRead;
|
||||||
@@ -269,39 +269,39 @@ namespace k8s
|
|||||||
/// </param>
|
/// </param>
|
||||||
private void Grow(int size)
|
private void Grow(int size)
|
||||||
{
|
{
|
||||||
if (size > this.maximumSize)
|
if (size > maximumSize)
|
||||||
{
|
{
|
||||||
throw new OutOfMemoryException();
|
throw new OutOfMemoryException();
|
||||||
}
|
}
|
||||||
|
|
||||||
var newBuffer = ArrayPool<byte>.Shared.Rent(size);
|
var newBuffer = ArrayPool<byte>.Shared.Rent(size);
|
||||||
|
|
||||||
if (this.WriteWaterMark < this.ReadWaterMark)
|
if (WriteWaterMark < ReadWaterMark)
|
||||||
{
|
{
|
||||||
// Copy the data at the start
|
// Copy the data at the start
|
||||||
Array.Copy(this.buffer, 0, newBuffer, 0, this.WriteWaterMark);
|
Array.Copy(buffer, 0, newBuffer, 0, WriteWaterMark);
|
||||||
|
|
||||||
int trailingDataLength = this.buffer.Length - this.ReadWaterMark;
|
var trailingDataLength = buffer.Length - ReadWaterMark;
|
||||||
Array.Copy(
|
Array.Copy(
|
||||||
this.buffer,
|
buffer,
|
||||||
sourceIndex: this.ReadWaterMark,
|
ReadWaterMark,
|
||||||
destinationArray: newBuffer,
|
newBuffer,
|
||||||
destinationIndex: newBuffer.Length - trailingDataLength,
|
newBuffer.Length - trailingDataLength,
|
||||||
length: trailingDataLength);
|
trailingDataLength);
|
||||||
|
|
||||||
this.ReadWaterMark += newBuffer.Length - this.buffer.Length;
|
ReadWaterMark += newBuffer.Length - buffer.Length;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// ... [Read WM] ... [Write WM] ... [newly available space]
|
// ... [Read WM] ... [Write WM] ... [newly available space]
|
||||||
Array.Copy(this.buffer, 0, newBuffer, 0, this.buffer.Length);
|
Array.Copy(buffer, 0, newBuffer, 0, buffer.Length);
|
||||||
}
|
}
|
||||||
|
|
||||||
ArrayPool<byte>.Shared.Return(this.buffer);
|
ArrayPool<byte>.Shared.Return(buffer);
|
||||||
this.buffer = newBuffer;
|
buffer = newBuffer;
|
||||||
|
|
||||||
Debug.Assert(this.bytesRead + this.AvailableReadableBytes == this.bytesWritten);
|
Debug.Assert(bytesRead + AvailableReadableBytes == bytesWritten);
|
||||||
this.OnResize?.Invoke(this, EventArgs.Empty);
|
OnResize?.Invoke(this, EventArgs.Empty);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected virtual void Dispose(bool disposing)
|
protected virtual void Dispose(bool disposing)
|
||||||
@@ -310,7 +310,8 @@ namespace k8s
|
|||||||
{
|
{
|
||||||
if (disposing)
|
if (disposing)
|
||||||
{
|
{
|
||||||
ArrayPool<byte>.Shared.Return(this.buffer);
|
ArrayPool<byte>.Shared.Return(buffer);
|
||||||
|
dataAvailable.Dispose();
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: free unmanaged resources (unmanaged objects) and override finalizer
|
// TODO: free unmanaged resources (unmanaged objects) and override finalizer
|
||||||
@@ -329,7 +330,7 @@ namespace k8s
|
|||||||
public void Dispose()
|
public void Dispose()
|
||||||
{
|
{
|
||||||
// Do not change this code. Put cleanup code in 'Dispose(bool disposing)' method
|
// Do not change this code. Put cleanup code in 'Dispose(bool disposing)' method
|
||||||
Dispose(disposing: true);
|
Dispose(true);
|
||||||
GC.SuppressFinalize(this);
|
GC.SuppressFinalize(this);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -40,6 +40,11 @@ namespace k8s
|
|||||||
/// <returns>Generated Pfx Path</returns>
|
/// <returns>Generated Pfx Path</returns>
|
||||||
public static X509Certificate2 GeneratePfx(KubernetesClientConfiguration config)
|
public static X509Certificate2 GeneratePfx(KubernetesClientConfiguration config)
|
||||||
{
|
{
|
||||||
|
if (config == null)
|
||||||
|
{
|
||||||
|
throw new ArgumentNullException(nameof(config));
|
||||||
|
}
|
||||||
|
|
||||||
byte[] keyData = null;
|
byte[] keyData = null;
|
||||||
byte[] certData = null;
|
byte[] certData = null;
|
||||||
|
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ namespace k8s
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// Kubernetes object that exposes list of objects
|
/// Kubernetes object that exposes list of objects
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <typeparam name="T"></typeparam>
|
/// <typeparam name="T">type of the objects</typeparam>
|
||||||
public interface IItems<T>
|
public interface IItems<T>
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|||||||
@@ -10,7 +10,7 @@ namespace k8s
|
|||||||
/// Executes a command in a container in a pod.
|
/// Executes a command in a container in a pod.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="name">
|
/// <param name="name">
|
||||||
/// The name of the pod which contains the container in which to execute the ocmmand.
|
/// The name of the pod which contains the container in which to execute the command.
|
||||||
/// </param>
|
/// </param>
|
||||||
/// <param name="namespace">
|
/// <param name="namespace">
|
||||||
/// The namespace of the container.
|
/// The namespace of the container.
|
||||||
@@ -21,6 +21,9 @@ namespace k8s
|
|||||||
/// <param name="command">
|
/// <param name="command">
|
||||||
/// The command to execute.
|
/// The command to execute.
|
||||||
/// </param>
|
/// </param>
|
||||||
|
/// <param name="tty">
|
||||||
|
/// if allocate a pseudo-TTY
|
||||||
|
/// </param>
|
||||||
/// <param name="action">
|
/// <param name="action">
|
||||||
/// A callback which processes the standard input, standard output and standard error.
|
/// A callback which processes the standard input, standard output and standard error.
|
||||||
/// </param>
|
/// </param>
|
||||||
|
|||||||
@@ -10,6 +10,12 @@ namespace k8s
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// Watches for changes of an object.
|
/// Watches for changes of an object.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
/// <typeparam name="T">
|
||||||
|
/// type of the object of Watcher{T}
|
||||||
|
/// </typeparam>
|
||||||
|
/// <param name="path">
|
||||||
|
/// The uri to the resource being watched
|
||||||
|
/// </param>
|
||||||
/// <param name="continue">
|
/// <param name="continue">
|
||||||
/// The continue option should be set when retrieving more results from the server. Since this value is server defined, clients may only use the continue value from a previous query result with identical query parameters (except for the value of continue) and the server may reject a continue value it does not recognize. If the specified continue value is no longer valid whether due to expiration (generally five to fifteen minutes) or a configuration change on the server the server will respond with a 410 ResourceExpired error indicating the client must restart their list without the continue field. This field is not supported when watch is true. Clients may start a watch from the last resourceVersion value returned by the server and not miss any modifications.
|
/// The continue option should be set when retrieving more results from the server. Since this value is server defined, clients may only use the continue value from a previous query result with identical query parameters (except for the value of continue) and the server may reject a continue value it does not recognize. If the specified continue value is no longer valid whether due to expiration (generally five to fifteen minutes) or a configuration change on the server the server will respond with a 410 ResourceExpired error indicating the client must restart their list without the continue field. This field is not supported when watch is true. Clients may start a watch from the last resourceVersion value returned by the server and not miss any modifications.
|
||||||
/// </param>
|
/// </param>
|
||||||
@@ -30,12 +36,12 @@ namespace k8s
|
|||||||
/// <param name="pretty">
|
/// <param name="pretty">
|
||||||
/// If 'true', then the output is pretty printed.
|
/// If 'true', then the output is pretty printed.
|
||||||
/// </param>
|
/// </param>
|
||||||
/// <param name="resourceVersion">
|
|
||||||
/// When specified with a watch call, shows changes that occur after that particular version of a resource. Defaults to changes from the beginning of history. When specified for list: - if unset, then the result is returned from remote storage based on quorum-read flag; - if it's 0, then we simply return what we currently have in cache, no guarantee; - if set to non zero, then the result is at least as fresh as given rv.
|
|
||||||
/// </param>
|
|
||||||
/// <param name="timeoutSeconds">
|
/// <param name="timeoutSeconds">
|
||||||
/// Timeout for the list/watch call. This limits the duration of the call, regardless of any activity or inactivity.
|
/// Timeout for the list/watch call. This limits the duration of the call, regardless of any activity or inactivity.
|
||||||
/// </param>
|
/// </param>
|
||||||
|
/// <param name="resourceVersion">
|
||||||
|
/// When specified with a watch call, shows changes that occur after that particular version of a resource. Defaults to changes from the beginning of history. When specified for list: - if unset, then the result is returned from remote storage based on quorum-read flag; - if it's 0, then we simply return what we currently have in cache, no guarantee; - if set to non zero, then the result is at least as fresh as given rv.
|
||||||
|
/// </param>
|
||||||
/// <param name="customHeaders">
|
/// <param name="customHeaders">
|
||||||
/// The headers that will be added to request.
|
/// The headers that will be added to request.
|
||||||
/// </param>
|
/// </param>
|
||||||
@@ -55,10 +61,10 @@ namespace k8s
|
|||||||
/// A <see cref="Task"/> which represents the asynchronous operation, and returns a new watcher.
|
/// A <see cref="Task"/> which represents the asynchronous operation, and returns a new watcher.
|
||||||
/// </returns>
|
/// </returns>
|
||||||
Task<Watcher<T>> WatchObjectAsync<T>(string path, string @continue = null, string fieldSelector = null,
|
Task<Watcher<T>> WatchObjectAsync<T>(string path, string @continue = null, string fieldSelector = null,
|
||||||
bool? includeUninitialized = null, string labelSelector = null, int? limit = null, bool? pretty = null,
|
bool? includeUninitialized = null, string labelSelector = null, int? limit = null, bool? pretty = null,
|
||||||
int? timeoutSeconds = null, string resourceVersion = null,
|
int? timeoutSeconds = null, string resourceVersion = null,
|
||||||
Dictionary<string, List<string>> customHeaders = null, Action<WatchEventType, T> onEvent = null,
|
Dictionary<string, List<string>> customHeaders = null, Action<WatchEventType, T> onEvent = null,
|
||||||
Action<Exception> onError = null, Action onClosed = null,
|
Action<Exception> onError = null, Action onClosed = null,
|
||||||
CancellationToken cancellationToken = default(CancellationToken));
|
CancellationToken cancellationToken = default);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -53,13 +53,13 @@ namespace k8s
|
|||||||
/// <exception cref="ArgumentNullException">
|
/// <exception cref="ArgumentNullException">
|
||||||
/// Thrown when a required parameter is null
|
/// Thrown when a required parameter is null
|
||||||
/// </exception>
|
/// </exception>
|
||||||
/// <return>
|
/// <returns>
|
||||||
/// A <see cref="ClientWebSocket"/> which can be used to communicate with the process running in the pod.
|
/// A <see cref="ClientWebSocket"/> which can be used to communicate with the process running in the pod.
|
||||||
/// </return>
|
/// </returns>
|
||||||
Task<WebSocket> WebSocketNamespacedPodExecAsync(string name, string @namespace = "default",
|
Task<WebSocket> WebSocketNamespacedPodExecAsync(string name, string @namespace = "default",
|
||||||
string command = null, string container = null, bool stderr = true, bool stdin = true, bool stdout = true,
|
string command = null, string container = null, bool stderr = true, bool stdin = true, bool stdout = true,
|
||||||
bool tty = true, string webSocketSubProtol = null, Dictionary<string, List<string>> customHeaders = null,
|
bool tty = true, string webSocketSubProtocol = null, Dictionary<string, List<string>> customHeaders = null,
|
||||||
CancellationToken cancellationToken = default(CancellationToken));
|
CancellationToken cancellationToken = default);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Executes a command in a pod.
|
/// Executes a command in a pod.
|
||||||
@@ -107,14 +107,14 @@ namespace k8s
|
|||||||
/// <exception cref="ArgumentNullException">
|
/// <exception cref="ArgumentNullException">
|
||||||
/// Thrown when a required parameter is null
|
/// Thrown when a required parameter is null
|
||||||
/// </exception>
|
/// </exception>
|
||||||
/// <return>
|
/// <returns>
|
||||||
/// A <see cref="ClientWebSocket"/> which can be used to communicate with the process running in the pod.
|
/// A <see cref="ClientWebSocket"/> which can be used to communicate with the process running in the pod.
|
||||||
/// </return>
|
/// </returns>
|
||||||
Task<WebSocket> WebSocketNamespacedPodExecAsync(string name, string @namespace = "default",
|
Task<WebSocket> WebSocketNamespacedPodExecAsync(string name, string @namespace = "default",
|
||||||
IEnumerable<string> command = null, string container = null, bool stderr = true, bool stdin = true,
|
IEnumerable<string> command = null, string container = null, bool stderr = true, bool stdin = true,
|
||||||
bool stdout = true, bool tty = true, string webSocketSubProtol = null,
|
bool stdout = true, bool tty = true, string webSocketSubProtocol = null,
|
||||||
Dictionary<string, List<string>> customHeaders = null,
|
Dictionary<string, List<string>> customHeaders = null,
|
||||||
CancellationToken cancellationToken = default(CancellationToken));
|
CancellationToken cancellationToken = default);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Executes a command in a pod.
|
/// Executes a command in a pod.
|
||||||
@@ -162,15 +162,15 @@ namespace k8s
|
|||||||
/// <exception cref="ArgumentNullException">
|
/// <exception cref="ArgumentNullException">
|
||||||
/// Thrown when a required parameter is null
|
/// Thrown when a required parameter is null
|
||||||
/// </exception>
|
/// </exception>
|
||||||
/// <return>
|
/// <returns>
|
||||||
/// A <see cref="IStreamDemuxer"/> which can be used to communicate with the process running in the pod.
|
/// A <see cref="IStreamDemuxer"/> which can be used to communicate with the process running in the pod.
|
||||||
/// </return>
|
/// </returns>
|
||||||
Task<IStreamDemuxer> MuxedStreamNamespacedPodExecAsync(string name, string @namespace = "default",
|
Task<IStreamDemuxer> MuxedStreamNamespacedPodExecAsync(string name, string @namespace = "default",
|
||||||
IEnumerable<string> command = null, string container = null, bool stderr = true, bool stdin = true,
|
IEnumerable<string> command = null, string container = null, bool stderr = true, bool stdin = true,
|
||||||
bool stdout = true, bool tty = true,
|
bool stdout = true, bool tty = true,
|
||||||
string webSocketSubProtol = WebSocketProtocol.V4BinaryWebsocketProtocol,
|
string webSocketSubProtocol = WebSocketProtocol.V4BinaryWebsocketProtocol,
|
||||||
Dictionary<string, List<string>> customHeaders = null,
|
Dictionary<string, List<string>> customHeaders = null,
|
||||||
CancellationToken cancellationToken = default(CancellationToken));
|
CancellationToken cancellationToken = default);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Start port forwarding one or more ports of a pod.
|
/// Start port forwarding one or more ports of a pod.
|
||||||
@@ -194,9 +194,13 @@ namespace k8s
|
|||||||
/// <param name='cancellationToken'>
|
/// <param name='cancellationToken'>
|
||||||
/// The cancellation token.
|
/// The cancellation token.
|
||||||
/// </param>
|
/// </param>
|
||||||
|
/// <returns>
|
||||||
|
/// A <see cref="ClientWebSocket"/> which can be used to communicate with the process running in the pod.
|
||||||
|
/// </returns>
|
||||||
Task<WebSocket> WebSocketNamespacedPodPortForwardAsync(string name, string @namespace, IEnumerable<int> ports,
|
Task<WebSocket> WebSocketNamespacedPodPortForwardAsync(string name, string @namespace, IEnumerable<int> ports,
|
||||||
string webSocketSubProtocol = null, Dictionary<string, List<string>> customHeaders = null,
|
string webSocketSubProtocol = null, Dictionary<string, List<string>> customHeaders = null,
|
||||||
CancellationToken cancellationToken = default(CancellationToken));
|
CancellationToken cancellationToken = default);
|
||||||
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// connect GET requests to attach of Pod
|
/// connect GET requests to attach of Pod
|
||||||
@@ -216,7 +220,7 @@ namespace k8s
|
|||||||
/// call. Defaults to true.
|
/// call. Defaults to true.
|
||||||
/// </param>
|
/// </param>
|
||||||
/// <param name='stdin'>
|
/// <param name='stdin'>
|
||||||
/// Stdin if true, redirects the standard input stream of the pod for this
|
/// stdin if true, redirects the standard input stream of the pod for this
|
||||||
/// call. Defaults to false.
|
/// call. Defaults to false.
|
||||||
/// </param>
|
/// </param>
|
||||||
/// <param name='stdout'>
|
/// <param name='stdout'>
|
||||||
@@ -238,24 +242,10 @@ namespace k8s
|
|||||||
/// <param name='cancellationToken'>
|
/// <param name='cancellationToken'>
|
||||||
/// The cancellation token.
|
/// The cancellation token.
|
||||||
/// </param>
|
/// </param>
|
||||||
/// <exception cref="HttpOperationException">
|
/// <returns>A response object containing the response body and response headers.</returns>
|
||||||
/// Thrown when the operation returned an invalid status code
|
|
||||||
/// </exception>
|
|
||||||
/// <exception cref="SerializationException">
|
|
||||||
/// Thrown when unable to deserialize the response
|
|
||||||
/// </exception>
|
|
||||||
/// <exception cref="ValidationException">
|
|
||||||
/// Thrown when a required parameter is null
|
|
||||||
/// </exception>
|
|
||||||
/// <exception cref="System.ArgumentNullException">
|
|
||||||
/// Thrown when a required parameter is null
|
|
||||||
/// </exception>
|
|
||||||
/// <return>
|
|
||||||
/// A response object containing the response body and response headers.
|
|
||||||
/// </return>
|
|
||||||
Task<WebSocket> WebSocketNamespacedPodAttachAsync(string name, string @namespace,
|
Task<WebSocket> WebSocketNamespacedPodAttachAsync(string name, string @namespace,
|
||||||
string container = default(string), bool stderr = true, bool stdin = false, bool stdout = true,
|
string container = default, bool stderr = true, bool stdin = false, bool stdout = true,
|
||||||
bool tty = false, string webSocketSubProtol = null, Dictionary<string, List<string>> customHeaders = null,
|
bool tty = false, string webSocketSubProtocol = null, Dictionary<string, List<string>> customHeaders = null,
|
||||||
CancellationToken cancellationToken = default(CancellationToken));
|
CancellationToken cancellationToken = default);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -35,7 +35,7 @@ namespace k8s
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>Represents a generic Kubernetes object that has an API version, a kind, and metadata.</summary>
|
/// <summary>Represents a generic Kubernetes object that has an API version, a kind, and metadata.</summary>
|
||||||
/// <typeparam name="TMetadata"></typeparam>
|
/// <typeparam name="TMetadata">type of metedata</typeparam>
|
||||||
public interface IKubernetesObject<TMetadata> : IKubernetesObject, IMetadata<TMetadata>
|
public interface IKubernetesObject<TMetadata> : IKubernetesObject, IMetadata<TMetadata>
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ namespace k8s
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// Represents a Kubernetes object that has a spec
|
/// Represents a Kubernetes object that has a spec
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <typeparam name="T"></typeparam>
|
/// <typeparam name="T">type of Kubernetes object</typeparam>
|
||||||
public interface ISpec<T>
|
public interface ISpec<T>
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -11,7 +11,6 @@ namespace k8s
|
|||||||
/// info:
|
/// info:
|
||||||
/// https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#spec-and-status
|
/// https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#spec-and-status
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// </summary>
|
|
||||||
T Spec { get; set; }
|
T Spec { get; set; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -75,7 +75,7 @@ namespace k8s
|
|||||||
/// A <see cref="Task"/> which represents the asynchronous operation.
|
/// A <see cref="Task"/> which represents the asynchronous operation.
|
||||||
/// </returns>
|
/// </returns>
|
||||||
Task Write(ChannelIndex index, byte[] buffer, int offset, int count,
|
Task Write(ChannelIndex index, byte[] buffer, int offset, int count,
|
||||||
CancellationToken cancellationToken = default(CancellationToken));
|
CancellationToken cancellationToken = default);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Directly writes data to a channel.
|
/// Directly writes data to a channel.
|
||||||
@@ -99,6 +99,6 @@ namespace k8s
|
|||||||
/// A <see cref="Task"/> which represents the asynchronous operation.
|
/// A <see cref="Task"/> which represents the asynchronous operation.
|
||||||
/// </returns>
|
/// </returns>
|
||||||
Task Write(byte index, byte[] buffer, int offset, int count,
|
Task Write(byte index, byte[] buffer, int offset, int count,
|
||||||
CancellationToken cancellationToken = default(CancellationToken));
|
CancellationToken cancellationToken = default);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -13,30 +13,30 @@ namespace k8s.Models
|
|||||||
|
|
||||||
public object ReadYaml(IParser parser, Type type)
|
public object ReadYaml(IParser parser, Type type)
|
||||||
{
|
{
|
||||||
if (parser.Current is YamlDotNet.Core.Events.Scalar scalar)
|
if (parser?.Current is YamlDotNet.Core.Events.Scalar scalar)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
if (string.IsNullOrEmpty(scalar.Value))
|
if (string.IsNullOrEmpty(scalar?.Value))
|
||||||
{
|
{
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
return new IntstrIntOrString(scalar.Value);
|
return new IntstrIntOrString(scalar?.Value);
|
||||||
}
|
}
|
||||||
finally
|
finally
|
||||||
{
|
{
|
||||||
parser.MoveNext();
|
parser?.MoveNext();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
throw new InvalidOperationException(parser.Current?.ToString());
|
throw new InvalidOperationException(parser?.Current?.ToString());
|
||||||
}
|
}
|
||||||
|
|
||||||
public void WriteYaml(IEmitter emitter, object value, Type type)
|
public void WriteYaml(IEmitter emitter, object value, Type type)
|
||||||
{
|
{
|
||||||
var obj = (IntstrIntOrString)value;
|
var obj = (IntstrIntOrString)value;
|
||||||
emitter.Emit(new YamlDotNet.Core.Events.Scalar(obj.Value));
|
emitter?.Emit(new YamlDotNet.Core.Events.Scalar(obj?.Value));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -6,11 +6,6 @@ namespace k8s.Models
|
|||||||
[JsonConverter(typeof(IntOrStringConverter))]
|
[JsonConverter(typeof(IntOrStringConverter))]
|
||||||
public partial class IntstrIntOrString
|
public partial class IntstrIntOrString
|
||||||
{
|
{
|
||||||
public static implicit operator int(IntstrIntOrString v)
|
|
||||||
{
|
|
||||||
return int.Parse(v.Value);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static implicit operator IntstrIntOrString(int v)
|
public static implicit operator IntstrIntOrString(int v)
|
||||||
{
|
{
|
||||||
return new IntstrIntOrString(Convert.ToString(v));
|
return new IntstrIntOrString(Convert.ToString(v));
|
||||||
@@ -18,7 +13,7 @@ namespace k8s.Models
|
|||||||
|
|
||||||
public static implicit operator string(IntstrIntOrString v)
|
public static implicit operator string(IntstrIntOrString v)
|
||||||
{
|
{
|
||||||
return v.Value;
|
return v?.Value;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static implicit operator IntstrIntOrString(string v)
|
public static implicit operator IntstrIntOrString(string v)
|
||||||
@@ -28,7 +23,7 @@ namespace k8s.Models
|
|||||||
|
|
||||||
protected bool Equals(IntstrIntOrString other)
|
protected bool Equals(IntstrIntOrString other)
|
||||||
{
|
{
|
||||||
return string.Equals(Value, other.Value);
|
return string.Equals(Value, other?.Value);
|
||||||
}
|
}
|
||||||
|
|
||||||
public override bool Equals(object obj)
|
public override bool Equals(object obj)
|
||||||
@@ -43,7 +38,7 @@ namespace k8s.Models
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (obj.GetType() != this.GetType())
|
if (obj.GetType() != GetType())
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -154,7 +154,7 @@ namespace k8s
|
|||||||
HttpClientHandler.ServerCertificateCustomValidationCallback =
|
HttpClientHandler.ServerCertificateCustomValidationCallback =
|
||||||
(sender, certificate, chain, sslPolicyErrors) =>
|
(sender, certificate, chain, sslPolicyErrors) =>
|
||||||
{
|
{
|
||||||
return Kubernetes.CertificateValidationCallBack(sender, CaCerts, certificate, chain,
|
return CertificateValidationCallBack(sender, CaCerts, certificate, chain,
|
||||||
sslPolicyErrors);
|
sslPolicyErrors);
|
||||||
};
|
};
|
||||||
#endif
|
#endif
|
||||||
@@ -249,11 +249,11 @@ namespace k8s
|
|||||||
/// SSl Cert Validation Callback
|
/// SSl Cert Validation Callback
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="sender">sender</param>
|
/// <param name="sender">sender</param>
|
||||||
|
/// <param name="caCerts">client ca</param>
|
||||||
/// <param name="certificate">client certificate</param>
|
/// <param name="certificate">client certificate</param>
|
||||||
/// <param name="chain">chain</param>
|
/// <param name="chain">chain</param>
|
||||||
/// <param name="sslPolicyErrors">ssl policy errors</param>
|
/// <param name="sslPolicyErrors">ssl policy errors</param>
|
||||||
/// <returns>true if valid cert</returns>
|
/// <returns>true if valid cert</returns>
|
||||||
[SuppressMessage("Microsoft.Usage", "CA1801:ReviewUnusedParameters", Justification = "Unused by design")]
|
|
||||||
public static bool CertificateValidationCallBack(
|
public static bool CertificateValidationCallBack(
|
||||||
object sender,
|
object sender,
|
||||||
X509Certificate2Collection caCerts,
|
X509Certificate2Collection caCerts,
|
||||||
@@ -261,6 +261,16 @@ namespace k8s
|
|||||||
X509Chain chain,
|
X509Chain chain,
|
||||||
SslPolicyErrors sslPolicyErrors)
|
SslPolicyErrors sslPolicyErrors)
|
||||||
{
|
{
|
||||||
|
if (caCerts == null)
|
||||||
|
{
|
||||||
|
throw new ArgumentNullException(nameof(caCerts));
|
||||||
|
}
|
||||||
|
|
||||||
|
if (chain == null)
|
||||||
|
{
|
||||||
|
throw new ArgumentNullException(nameof(chain));
|
||||||
|
}
|
||||||
|
|
||||||
// If the certificate is a valid, signed certificate, return true.
|
// If the certificate is a valid, signed certificate, return true.
|
||||||
if (sslPolicyErrors == SslPolicyErrors.None)
|
if (sslPolicyErrors == SslPolicyErrors.None)
|
||||||
{
|
{
|
||||||
@@ -301,9 +311,11 @@ namespace k8s
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>Creates <see cref="ServiceClientCredentials"/> based on the given config, or returns null if no such credentials are
|
/// <summary>
|
||||||
/// needed.
|
/// Creates <see cref="ServiceClientCredentials"/> based on the given config, or returns null if no such credentials are needed.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
/// <param name="config">kubenetes config object</param>
|
||||||
|
/// <returns>instance of <see cref="ServiceClientCredentials"/></returns>
|
||||||
public static ServiceClientCredentials CreateCredentials(KubernetesClientConfiguration config)
|
public static ServiceClientCredentials CreateCredentials(KubernetesClientConfiguration config)
|
||||||
{
|
{
|
||||||
if (config == null)
|
if (config == null)
|
||||||
|
|||||||
@@ -23,15 +23,15 @@ namespace k8s
|
|||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
using (var muxedStream = await this.MuxedStreamNamespacedPodExecAsync(
|
using (var muxedStream = await MuxedStreamNamespacedPodExecAsync(
|
||||||
name: name,
|
name,
|
||||||
@namespace: @namespace, command: command, container: container, tty: tty,
|
@namespace, command, container, tty: tty,
|
||||||
cancellationToken: cancellationToken).ConfigureAwait(false))
|
cancellationToken: cancellationToken).ConfigureAwait(false))
|
||||||
using (Stream stdIn = muxedStream.GetStream(null, ChannelIndex.StdIn))
|
using (var stdIn = muxedStream.GetStream(null, ChannelIndex.StdIn))
|
||||||
using (Stream stdOut = muxedStream.GetStream(ChannelIndex.StdOut, null))
|
using (var stdOut = muxedStream.GetStream(ChannelIndex.StdOut, null))
|
||||||
using (Stream stdErr = muxedStream.GetStream(ChannelIndex.StdErr, null))
|
using (var stdErr = muxedStream.GetStream(ChannelIndex.StdErr, null))
|
||||||
using (Stream error = muxedStream.GetStream(ChannelIndex.Error, null))
|
using (var error = muxedStream.GetStream(ChannelIndex.Error, null))
|
||||||
using (StreamReader errorReader = new StreamReader(error))
|
using (var errorReader = new StreamReader(error))
|
||||||
{
|
{
|
||||||
muxedStream.Start();
|
muxedStream.Start();
|
||||||
|
|
||||||
@@ -80,7 +80,7 @@ namespace k8s
|
|||||||
{
|
{
|
||||||
var exitCodeString = status.Details.Causes.FirstOrDefault(c => c.Reason == "ExitCode")?.Message;
|
var exitCodeString = status.Details.Causes.FirstOrDefault(c => c.Reason == "ExitCode")?.Message;
|
||||||
|
|
||||||
if (int.TryParse(exitCodeString, out int exitCode))
|
if (int.TryParse(exitCodeString, out var exitCode))
|
||||||
{
|
{
|
||||||
return exitCode;
|
return exitCode;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -18,15 +18,15 @@ namespace k8s
|
|||||||
int? limit = null, bool? pretty = null, int? timeoutSeconds = null, string resourceVersion = null,
|
int? limit = null, bool? pretty = null, int? timeoutSeconds = null, string resourceVersion = null,
|
||||||
Dictionary<string, List<string>> customHeaders = null, Action<WatchEventType, T> onEvent = null,
|
Dictionary<string, List<string>> customHeaders = null, Action<WatchEventType, T> onEvent = null,
|
||||||
Action<Exception> onError = null, Action onClosed = null,
|
Action<Exception> onError = null, Action onClosed = null,
|
||||||
CancellationToken cancellationToken = default(CancellationToken))
|
CancellationToken cancellationToken = default)
|
||||||
{
|
{
|
||||||
// Tracing
|
// Tracing
|
||||||
bool shouldTrace = ServiceClientTracing.IsEnabled;
|
var shouldTrace = ServiceClientTracing.IsEnabled;
|
||||||
string invocationId = null;
|
string invocationId = null;
|
||||||
if (shouldTrace)
|
if (shouldTrace)
|
||||||
{
|
{
|
||||||
invocationId = ServiceClientTracing.NextInvocationId.ToString();
|
invocationId = ServiceClientTracing.NextInvocationId.ToString();
|
||||||
Dictionary<string, object> tracingParameters = new Dictionary<string, object>();
|
var tracingParameters = new Dictionary<string, object>();
|
||||||
tracingParameters.Add("path", path);
|
tracingParameters.Add("path", path);
|
||||||
tracingParameters.Add("continue", @continue);
|
tracingParameters.Add("continue", @continue);
|
||||||
tracingParameters.Add("fieldSelector", fieldSelector);
|
tracingParameters.Add("fieldSelector", fieldSelector);
|
||||||
@@ -40,8 +40,8 @@ namespace k8s
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Construct URL
|
// Construct URL
|
||||||
var uriBuilder = new UriBuilder(this.BaseUri);
|
var uriBuilder = new UriBuilder(BaseUri);
|
||||||
if (!uriBuilder.Path.EndsWith("/"))
|
if (!uriBuilder.Path.EndsWith("/", StringComparison.InvariantCulture))
|
||||||
{
|
{
|
||||||
uriBuilder.Path += "/";
|
uriBuilder.Path += "/";
|
||||||
}
|
}
|
||||||
@@ -104,10 +104,10 @@ namespace k8s
|
|||||||
var httpRequest = new HttpRequestMessage(HttpMethod.Get, uriBuilder.ToString());
|
var httpRequest = new HttpRequestMessage(HttpMethod.Get, uriBuilder.ToString());
|
||||||
|
|
||||||
// Set Credentials
|
// Set Credentials
|
||||||
if (this.Credentials != null)
|
if (Credentials != null)
|
||||||
{
|
{
|
||||||
cancellationToken.ThrowIfCancellationRequested();
|
cancellationToken.ThrowIfCancellationRequested();
|
||||||
await this.Credentials.ProcessHttpRequestAsync(httpRequest, cancellationToken).ConfigureAwait(false);
|
await Credentials.ProcessHttpRequestAsync(httpRequest, cancellationToken).ConfigureAwait(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Set Headers
|
// Set Headers
|
||||||
@@ -144,7 +144,7 @@ namespace k8s
|
|||||||
|
|
||||||
if (httpResponse.StatusCode != HttpStatusCode.OK)
|
if (httpResponse.StatusCode != HttpStatusCode.OK)
|
||||||
{
|
{
|
||||||
string responseContent = string.Empty;
|
var responseContent = string.Empty;
|
||||||
|
|
||||||
var ex = new HttpOperationException(string.Format(
|
var ex = new HttpOperationException(string.Format(
|
||||||
"Operation returned an invalid status code '{0}'",
|
"Operation returned an invalid status code '{0}'",
|
||||||
@@ -166,7 +166,7 @@ namespace k8s
|
|||||||
async () =>
|
async () =>
|
||||||
{
|
{
|
||||||
var stream = await httpResponse.Content.ReadAsStreamAsync().ConfigureAwait(false);
|
var stream = await httpResponse.Content.ReadAsStreamAsync().ConfigureAwait(false);
|
||||||
StreamReader reader = new StreamReader(stream);
|
var reader = new StreamReader(stream);
|
||||||
|
|
||||||
return reader;
|
return reader;
|
||||||
}, onEvent, onError, onClosed);
|
}, onEvent, onError, onClosed);
|
||||||
|
|||||||
@@ -30,7 +30,7 @@ namespace k8s
|
|||||||
public Task<WebSocket> WebSocketNamespacedPodExecAsync(string name, string @namespace = "default",
|
public Task<WebSocket> WebSocketNamespacedPodExecAsync(string name, string @namespace = "default",
|
||||||
string command = null, string container = null, bool stderr = true, bool stdin = true, bool stdout = true,
|
string command = null, string container = null, bool stderr = true, bool stdin = true, bool stdout = true,
|
||||||
bool tty = true, string webSocketSubProtol = null, Dictionary<string, List<string>> customHeaders = null,
|
bool tty = true, string webSocketSubProtol = null, Dictionary<string, List<string>> customHeaders = null,
|
||||||
CancellationToken cancellationToken = default(CancellationToken))
|
CancellationToken cancellationToken = default)
|
||||||
{
|
{
|
||||||
return WebSocketNamespacedPodExecAsync(name, @namespace, new string[] { command }, container, stderr, stdin,
|
return WebSocketNamespacedPodExecAsync(name, @namespace, new string[] { command }, container, stderr, stdin,
|
||||||
stdout, tty, webSocketSubProtol, customHeaders, cancellationToken);
|
stdout, tty, webSocketSubProtol, customHeaders, cancellationToken);
|
||||||
@@ -43,12 +43,12 @@ namespace k8s
|
|||||||
bool stderr = true, bool stdin = true, bool stdout = true, bool tty = true,
|
bool stderr = true, bool stdin = true, bool stdout = true, bool tty = true,
|
||||||
string webSocketSubProtol = WebSocketProtocol.V4BinaryWebsocketProtocol,
|
string webSocketSubProtol = WebSocketProtocol.V4BinaryWebsocketProtocol,
|
||||||
Dictionary<string, List<string>> customHeaders = null,
|
Dictionary<string, List<string>> customHeaders = null,
|
||||||
CancellationToken cancellationToken = default(CancellationToken))
|
CancellationToken cancellationToken = default)
|
||||||
{
|
{
|
||||||
WebSocket webSocket = await this.WebSocketNamespacedPodExecAsync(name: name, @namespace: @namespace,
|
var webSocket = await WebSocketNamespacedPodExecAsync(name, @namespace,
|
||||||
command: command, container: container, tty: tty, cancellationToken: cancellationToken)
|
command, container, tty: tty, cancellationToken: cancellationToken)
|
||||||
.ConfigureAwait(false);
|
.ConfigureAwait(false);
|
||||||
StreamDemuxer muxer = new StreamDemuxer(webSocket);
|
var muxer = new StreamDemuxer(webSocket);
|
||||||
return muxer;
|
return muxer;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -58,7 +58,7 @@ namespace k8s
|
|||||||
bool stdout = true, bool tty = true,
|
bool stdout = true, bool tty = true,
|
||||||
string webSocketSubProtol = WebSocketProtocol.V4BinaryWebsocketProtocol,
|
string webSocketSubProtol = WebSocketProtocol.V4BinaryWebsocketProtocol,
|
||||||
Dictionary<string, List<string>> customHeaders = null,
|
Dictionary<string, List<string>> customHeaders = null,
|
||||||
CancellationToken cancellationToken = default(CancellationToken))
|
CancellationToken cancellationToken = default)
|
||||||
{
|
{
|
||||||
if (name == null)
|
if (name == null)
|
||||||
{
|
{
|
||||||
@@ -91,12 +91,12 @@ namespace k8s
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Tracing
|
// Tracing
|
||||||
bool shouldTrace = ServiceClientTracing.IsEnabled;
|
var shouldTrace = ServiceClientTracing.IsEnabled;
|
||||||
string invocationId = null;
|
string invocationId = null;
|
||||||
if (shouldTrace)
|
if (shouldTrace)
|
||||||
{
|
{
|
||||||
invocationId = ServiceClientTracing.NextInvocationId.ToString();
|
invocationId = ServiceClientTracing.NextInvocationId.ToString();
|
||||||
Dictionary<string, object> tracingParameters = new Dictionary<string, object>();
|
var tracingParameters = new Dictionary<string, object>();
|
||||||
tracingParameters.Add("command", command);
|
tracingParameters.Add("command", command);
|
||||||
tracingParameters.Add("container", container);
|
tracingParameters.Add("container", container);
|
||||||
tracingParameters.Add("name", name);
|
tracingParameters.Add("name", name);
|
||||||
@@ -115,7 +115,7 @@ namespace k8s
|
|||||||
var uriBuilder = new UriBuilder(BaseUri);
|
var uriBuilder = new UriBuilder(BaseUri);
|
||||||
uriBuilder.Scheme = BaseUri.Scheme == "https" ? "wss" : "ws";
|
uriBuilder.Scheme = BaseUri.Scheme == "https" ? "wss" : "ws";
|
||||||
|
|
||||||
if (!uriBuilder.Path.EndsWith("/"))
|
if (!uriBuilder.Path.EndsWith("/", StringComparison.InvariantCulture))
|
||||||
{
|
{
|
||||||
uriBuilder.Path += "/";
|
uriBuilder.Path += "/";
|
||||||
}
|
}
|
||||||
@@ -144,7 +144,7 @@ namespace k8s
|
|||||||
uriBuilder.Query =
|
uriBuilder.Query =
|
||||||
query.ToString(1, query.Length - 1); // UriBuilder.Query doesn't like leading '?' chars, so trim it
|
query.ToString(1, query.Length - 1); // UriBuilder.Query doesn't like leading '?' chars, so trim it
|
||||||
|
|
||||||
return this.StreamConnectAsync(uriBuilder.Uri, invocationId, webSocketSubProtol, customHeaders,
|
return StreamConnectAsync(uriBuilder.Uri, invocationId, webSocketSubProtol, customHeaders,
|
||||||
cancellationToken);
|
cancellationToken);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -152,7 +152,7 @@ namespace k8s
|
|||||||
public Task<WebSocket> WebSocketNamespacedPodPortForwardAsync(string name, string @namespace,
|
public Task<WebSocket> WebSocketNamespacedPodPortForwardAsync(string name, string @namespace,
|
||||||
IEnumerable<int> ports, string webSocketSubProtocol = null,
|
IEnumerable<int> ports, string webSocketSubProtocol = null,
|
||||||
Dictionary<string, List<string>> customHeaders = null,
|
Dictionary<string, List<string>> customHeaders = null,
|
||||||
CancellationToken cancellationToken = default(CancellationToken))
|
CancellationToken cancellationToken = default)
|
||||||
{
|
{
|
||||||
if (name == null)
|
if (name == null)
|
||||||
{
|
{
|
||||||
@@ -170,12 +170,12 @@ namespace k8s
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Tracing
|
// Tracing
|
||||||
bool shouldTrace = ServiceClientTracing.IsEnabled;
|
var shouldTrace = ServiceClientTracing.IsEnabled;
|
||||||
string invocationId = null;
|
string invocationId = null;
|
||||||
if (shouldTrace)
|
if (shouldTrace)
|
||||||
{
|
{
|
||||||
invocationId = ServiceClientTracing.NextInvocationId.ToString();
|
invocationId = ServiceClientTracing.NextInvocationId.ToString();
|
||||||
Dictionary<string, object> tracingParameters = new Dictionary<string, object>();
|
var tracingParameters = new Dictionary<string, object>();
|
||||||
tracingParameters.Add("name", name);
|
tracingParameters.Add("name", name);
|
||||||
tracingParameters.Add("@namespace", @namespace);
|
tracingParameters.Add("@namespace", @namespace);
|
||||||
tracingParameters.Add("ports", ports);
|
tracingParameters.Add("ports", ports);
|
||||||
@@ -186,10 +186,10 @@ namespace k8s
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Construct URL
|
// Construct URL
|
||||||
var uriBuilder = new UriBuilder(this.BaseUri);
|
var uriBuilder = new UriBuilder(BaseUri);
|
||||||
uriBuilder.Scheme = this.BaseUri.Scheme == "https" ? "wss" : "ws";
|
uriBuilder.Scheme = BaseUri.Scheme == "https" ? "wss" : "ws";
|
||||||
|
|
||||||
if (!uriBuilder.Path.EndsWith("/"))
|
if (!uriBuilder.Path.EndsWith("/", StringComparison.InvariantCulture))
|
||||||
{
|
{
|
||||||
uriBuilder.Path += "/";
|
uriBuilder.Path += "/";
|
||||||
}
|
}
|
||||||
@@ -215,9 +215,9 @@ namespace k8s
|
|||||||
|
|
||||||
/// <inheritdoc/>
|
/// <inheritdoc/>
|
||||||
public Task<WebSocket> WebSocketNamespacedPodAttachAsync(string name, string @namespace,
|
public Task<WebSocket> WebSocketNamespacedPodAttachAsync(string name, string @namespace,
|
||||||
string container = default(string), bool stderr = true, bool stdin = false, bool stdout = true,
|
string container = default, bool stderr = true, bool stdin = false, bool stdout = true,
|
||||||
bool tty = false, string webSocketSubProtol = null, Dictionary<string, List<string>> customHeaders = null,
|
bool tty = false, string webSocketSubProtol = null, Dictionary<string, List<string>> customHeaders = null,
|
||||||
CancellationToken cancellationToken = default(CancellationToken))
|
CancellationToken cancellationToken = default)
|
||||||
{
|
{
|
||||||
if (name == null)
|
if (name == null)
|
||||||
{
|
{
|
||||||
@@ -230,12 +230,12 @@ namespace k8s
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Tracing
|
// Tracing
|
||||||
bool shouldTrace = ServiceClientTracing.IsEnabled;
|
var shouldTrace = ServiceClientTracing.IsEnabled;
|
||||||
string invocationId = null;
|
string invocationId = null;
|
||||||
if (shouldTrace)
|
if (shouldTrace)
|
||||||
{
|
{
|
||||||
invocationId = ServiceClientTracing.NextInvocationId.ToString();
|
invocationId = ServiceClientTracing.NextInvocationId.ToString();
|
||||||
Dictionary<string, object> tracingParameters = new Dictionary<string, object>();
|
var tracingParameters = new Dictionary<string, object>();
|
||||||
tracingParameters.Add("container", container);
|
tracingParameters.Add("container", container);
|
||||||
tracingParameters.Add("name", name);
|
tracingParameters.Add("name", name);
|
||||||
tracingParameters.Add("namespace", @namespace);
|
tracingParameters.Add("namespace", @namespace);
|
||||||
@@ -250,10 +250,10 @@ namespace k8s
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Construct URL
|
// Construct URL
|
||||||
var uriBuilder = new UriBuilder(this.BaseUri);
|
var uriBuilder = new UriBuilder(BaseUri);
|
||||||
uriBuilder.Scheme = this.BaseUri.Scheme == "https" ? "wss" : "ws";
|
uriBuilder.Scheme = BaseUri.Scheme == "https" ? "wss" : "ws";
|
||||||
|
|
||||||
if (!uriBuilder.Path.EndsWith("/"))
|
if (!uriBuilder.Path.EndsWith("/", StringComparison.InvariantCulture))
|
||||||
{
|
{
|
||||||
uriBuilder.Path += "/";
|
uriBuilder.Path += "/";
|
||||||
}
|
}
|
||||||
@@ -275,12 +275,17 @@ namespace k8s
|
|||||||
|
|
||||||
protected async Task<WebSocket> StreamConnectAsync(Uri uri, string invocationId = null,
|
protected async Task<WebSocket> StreamConnectAsync(Uri uri, string invocationId = null,
|
||||||
string webSocketSubProtocol = null, Dictionary<string, List<string>> customHeaders = null,
|
string webSocketSubProtocol = null, Dictionary<string, List<string>> customHeaders = null,
|
||||||
CancellationToken cancellationToken = default(CancellationToken))
|
CancellationToken cancellationToken = default)
|
||||||
{
|
{
|
||||||
bool shouldTrace = ServiceClientTracing.IsEnabled;
|
if (uri == null)
|
||||||
|
{
|
||||||
|
throw new ArgumentNullException(nameof(uri));
|
||||||
|
}
|
||||||
|
|
||||||
|
var shouldTrace = ServiceClientTracing.IsEnabled;
|
||||||
|
|
||||||
// Create WebSocket transport objects
|
// Create WebSocket transport objects
|
||||||
WebSocketBuilder webSocketBuilder = this.CreateWebSocketBuilder();
|
var webSocketBuilder = CreateWebSocketBuilder();
|
||||||
|
|
||||||
// Set Headers
|
// Set Headers
|
||||||
if (customHeaders != null)
|
if (customHeaders != null)
|
||||||
@@ -295,17 +300,17 @@ namespace k8s
|
|||||||
#if NET452
|
#if NET452
|
||||||
foreach (var cert in ((WebRequestHandler)this.HttpClientHandler).ClientCertificates.OfType<X509Certificate2>())
|
foreach (var cert in ((WebRequestHandler)this.HttpClientHandler).ClientCertificates.OfType<X509Certificate2>())
|
||||||
#else
|
#else
|
||||||
foreach (var cert in this.HttpClientHandler.ClientCertificates.OfType<X509Certificate2>())
|
foreach (var cert in HttpClientHandler.ClientCertificates.OfType<X509Certificate2>())
|
||||||
#endif
|
#endif
|
||||||
{
|
{
|
||||||
webSocketBuilder.AddClientCertificate(cert);
|
webSocketBuilder.AddClientCertificate(cert);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (this.Credentials != null)
|
if (Credentials != null)
|
||||||
{
|
{
|
||||||
// Copy the default (credential-related) request headers from the HttpClient to the WebSocket
|
// Copy the default (credential-related) request headers from the HttpClient to the WebSocket
|
||||||
HttpRequestMessage message = new HttpRequestMessage();
|
var message = new HttpRequestMessage();
|
||||||
await this.Credentials.ProcessHttpRequestAsync(message, cancellationToken).ConfigureAwait(false);
|
await Credentials.ProcessHttpRequestAsync(message, cancellationToken).ConfigureAwait(false);
|
||||||
|
|
||||||
foreach (var header in message.Headers)
|
foreach (var header in message.Headers)
|
||||||
{
|
{
|
||||||
@@ -314,9 +319,9 @@ namespace k8s
|
|||||||
}
|
}
|
||||||
|
|
||||||
#if (NET452 || NETSTANDARD2_0)
|
#if (NET452 || NETSTANDARD2_0)
|
||||||
if (this.CaCerts != null)
|
if (CaCerts != null)
|
||||||
{
|
{
|
||||||
webSocketBuilder.SetServerCertificateValidationCallback(this.ServerCertificateValidationCallback);
|
webSocketBuilder.SetServerCertificateValidationCallback(ServerCertificateValidationCallback);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@@ -356,7 +361,7 @@ namespace k8s
|
|||||||
var uriBuilder = new UriBuilder(uri);
|
var uriBuilder = new UriBuilder(uri);
|
||||||
uriBuilder.Scheme = uri.Scheme == "wss" ? "https" : "http";
|
uriBuilder.Scheme = uri.Scheme == "wss" ? "https" : "http";
|
||||||
|
|
||||||
var response = await this.HttpClient.GetAsync(uriBuilder.Uri, cancellationToken).ConfigureAwait(false);
|
var response = await HttpClient.GetAsync(uriBuilder.Uri, cancellationToken).ConfigureAwait(false);
|
||||||
|
|
||||||
if (response.StatusCode == HttpStatusCode.SwitchingProtocols)
|
if (response.StatusCode == HttpStatusCode.SwitchingProtocols)
|
||||||
{
|
{
|
||||||
@@ -408,10 +413,10 @@ namespace k8s
|
|||||||
}
|
}
|
||||||
|
|
||||||
#if (NET452 || NETSTANDARD2_0)
|
#if (NET452 || NETSTANDARD2_0)
|
||||||
if (this.CaCerts != null)
|
if (CaCerts != null)
|
||||||
{
|
{
|
||||||
webSocketBuilder.CleanupServerCertificateValidationCallback(
|
webSocketBuilder.CleanupServerCertificateValidationCallback(
|
||||||
this.ServerCertificateValidationCallback);
|
ServerCertificateValidationCallback);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
@@ -423,7 +428,7 @@ namespace k8s
|
|||||||
internal bool ServerCertificateValidationCallback(object sender, X509Certificate certificate, X509Chain chain,
|
internal bool ServerCertificateValidationCallback(object sender, X509Certificate certificate, X509Chain chain,
|
||||||
SslPolicyErrors sslPolicyErrors)
|
SslPolicyErrors sslPolicyErrors)
|
||||||
{
|
{
|
||||||
return Kubernetes.CertificateValidationCallBack(sender, this.CaCerts, certificate, chain, sslPolicyErrors);
|
return CertificateValidationCallBack(sender, CaCerts, certificate, chain, sslPolicyErrors);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
<Project Sdk="Microsoft.NET.Sdk">
|
<Project Sdk="Microsoft.NET.Sdk">
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<Authors>The Kubernetes Project Authors</Authors>
|
<Authors>The Kubernetes Project Authors</Authors>
|
||||||
<Copyright>2017 The Kubernetes Project Authors</Copyright>
|
<Copyright>2017 The Kubernetes Project Authors</Copyright>
|
||||||
@@ -16,7 +16,6 @@
|
|||||||
<SignAssembly>true</SignAssembly>
|
<SignAssembly>true</SignAssembly>
|
||||||
<AssemblyOriginatorKeyFile>kubernetes-client.snk</AssemblyOriginatorKeyFile>
|
<AssemblyOriginatorKeyFile>kubernetes-client.snk</AssemblyOriginatorKeyFile>
|
||||||
<GenerateDocumentationFile>true</GenerateDocumentationFile>
|
<GenerateDocumentationFile>true</GenerateDocumentationFile>
|
||||||
<NoWarn>1701;1702;1591;1570;1572;1573;1574</NoWarn>
|
|
||||||
|
|
||||||
<!-- Publish the repository URL in the built .nupkg (in the NuSpec <Repository> element) -->
|
<!-- Publish the repository URL in the built .nupkg (in the NuSpec <Repository> element) -->
|
||||||
<PublishRepositoryUrl>true</PublishRepositoryUrl>
|
<PublishRepositoryUrl>true</PublishRepositoryUrl>
|
||||||
@@ -33,9 +32,6 @@
|
|||||||
<PackageReference Include="Nerdbank.GitVersioning" Version="3.3.37" PrivateAssets="all" />
|
<PackageReference Include="Nerdbank.GitVersioning" Version="3.3.37" PrivateAssets="all" />
|
||||||
<PackageReference Include="Portable.BouncyCastle" Version="1.8.1.3" />
|
<PackageReference Include="Portable.BouncyCastle" Version="1.8.1.3" />
|
||||||
<PackageReference Include="Microsoft.Rest.ClientRuntime" Version="2.3.10" />
|
<PackageReference Include="Microsoft.Rest.ClientRuntime" Version="2.3.10" />
|
||||||
<PackageReference Include="Newtonsoft.Json" Version="9.0.1" Condition="'$(TargetFramework)' != 'netstandard2.0' and '$(TargetFramework)' != 'netcoreapp2.1'" />
|
|
||||||
<PackageReference Include="Newtonsoft.Json" Version="12.0.2" Condition="'$(TargetFramework)' == 'netstandard2.0' or '$(TargetFramework)' == 'netcoreapp2.1'" />
|
|
||||||
<PackageReference Include="System.Runtime.InteropServices.RuntimeInformation" Version="4.3.0" Condition="'$(TargetFramework)' == 'net452'" />
|
|
||||||
<PackageReference Include="YamlDotNet" Version="8.1.2" />
|
<PackageReference Include="YamlDotNet" Version="8.1.2" />
|
||||||
<PackageReference Include="System.Buffers" Version="4.5.1" Condition="'$(TargetFramework)' != 'netcoreapp2.1'" />
|
<PackageReference Include="System.Buffers" Version="4.5.1" Condition="'$(TargetFramework)' != 'netcoreapp2.1'" />
|
||||||
<PackageReference Include="Microsoft.SourceLink.GitHub" Version="1.0.0" PrivateAssets="All" />
|
<PackageReference Include="Microsoft.SourceLink.GitHub" Version="1.0.0" PrivateAssets="All" />
|
||||||
@@ -45,6 +41,7 @@
|
|||||||
<Reference Include="System.Net.Http" />
|
<Reference Include="System.Net.Http" />
|
||||||
<Reference Include="System.Net.Http.WebRequest" />
|
<Reference Include="System.Net.Http.WebRequest" />
|
||||||
<PackageReference Include="System.ValueTuple" Version="4.5.0" />
|
<PackageReference Include="System.ValueTuple" Version="4.5.0" />
|
||||||
|
<PackageReference Include="System.Runtime.InteropServices.RuntimeInformation" Version="4.3.0"/>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
</Project>
|
</Project>
|
||||||
|
|||||||
@@ -42,6 +42,7 @@ namespace k8s
|
|||||||
/// If multiple kubeconfig files are specified in the KUBECONFIG environment variable,
|
/// If multiple kubeconfig files are specified in the KUBECONFIG environment variable,
|
||||||
/// merges the files, where first occurence wins. See https://kubernetes.io/docs/concepts/configuration/organize-cluster-access-kubeconfig/#merging-kubeconfig-files.
|
/// merges the files, where first occurence wins. See https://kubernetes.io/docs/concepts/configuration/organize-cluster-access-kubeconfig/#merging-kubeconfig-files.
|
||||||
/// </remarks>
|
/// </remarks>
|
||||||
|
/// <returns>Instance of the<see cref="KubernetesClientConfiguration"/> class</returns>
|
||||||
public static KubernetesClientConfiguration BuildDefaultConfig()
|
public static KubernetesClientConfiguration BuildDefaultConfig()
|
||||||
{
|
{
|
||||||
var kubeconfig = Environment.GetEnvironmentVariable(KubeConfigEnvironmentVariable);
|
var kubeconfig = Environment.GetEnvironmentVariable(KubeConfigEnvironmentVariable);
|
||||||
@@ -55,7 +56,7 @@ namespace k8s
|
|||||||
|
|
||||||
if (File.Exists(KubeConfigDefaultLocation))
|
if (File.Exists(KubeConfigDefaultLocation))
|
||||||
{
|
{
|
||||||
return BuildConfigFromConfigFile(kubeconfigPath: KubeConfigDefaultLocation);
|
return BuildConfigFromConfigFile(KubeConfigDefaultLocation);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (IsInCluster())
|
if (IsInCluster())
|
||||||
@@ -76,6 +77,7 @@ namespace k8s
|
|||||||
/// <param name="masterUrl">kube api server endpoint</param>
|
/// <param name="masterUrl">kube api server endpoint</param>
|
||||||
/// <param name="useRelativePaths">When <see langword="true"/>, the paths in the kubeconfig file will be considered to be relative to the directory in which the kubeconfig
|
/// <param name="useRelativePaths">When <see langword="true"/>, the paths in the kubeconfig file will be considered to be relative to the directory in which the kubeconfig
|
||||||
/// file is located. When <see langword="false"/>, the paths will be considered to be relative to the current working directory.</param>
|
/// file is located. When <see langword="false"/>, the paths will be considered to be relative to the current working directory.</param>
|
||||||
|
/// <returns>Instance of the<see cref="KubernetesClientConfiguration"/> class</returns>
|
||||||
public static KubernetesClientConfiguration BuildConfigFromConfigFile(
|
public static KubernetesClientConfiguration BuildConfigFromConfigFile(
|
||||||
string kubeconfigPath = null,
|
string kubeconfigPath = null,
|
||||||
string currentContext = null, string masterUrl = null, bool useRelativePaths = true)
|
string currentContext = null, string masterUrl = null, bool useRelativePaths = true)
|
||||||
@@ -92,6 +94,7 @@ namespace k8s
|
|||||||
/// <param name="masterUrl">override the kube api server endpoint, set null if do not want to override</param>
|
/// <param name="masterUrl">override the kube api server endpoint, set null if do not want to override</param>
|
||||||
/// <param name="useRelativePaths">When <see langword="true"/>, the paths in the kubeconfig file will be considered to be relative to the directory in which the kubeconfig
|
/// <param name="useRelativePaths">When <see langword="true"/>, the paths in the kubeconfig file will be considered to be relative to the directory in which the kubeconfig
|
||||||
/// file is located. When <see langword="false"/>, the paths will be considered to be relative to the current working directory.</param>
|
/// file is located. When <see langword="false"/>, the paths will be considered to be relative to the current working directory.</param>
|
||||||
|
/// <returns>Instance of the<see cref="KubernetesClientConfiguration"/> class</returns>
|
||||||
public static KubernetesClientConfiguration BuildConfigFromConfigFile(
|
public static KubernetesClientConfiguration BuildConfigFromConfigFile(
|
||||||
FileInfo kubeconfig,
|
FileInfo kubeconfig,
|
||||||
string currentContext = null, string masterUrl = null, bool useRelativePaths = true)
|
string currentContext = null, string masterUrl = null, bool useRelativePaths = true)
|
||||||
@@ -108,6 +111,7 @@ namespace k8s
|
|||||||
/// <param name="masterUrl">override the kube api server endpoint, set null if do not want to override</param>
|
/// <param name="masterUrl">override the kube api server endpoint, set null if do not want to override</param>
|
||||||
/// <param name="useRelativePaths">When <see langword="true"/>, the paths in the kubeconfig file will be considered to be relative to the directory in which the kubeconfig
|
/// <param name="useRelativePaths">When <see langword="true"/>, the paths in the kubeconfig file will be considered to be relative to the directory in which the kubeconfig
|
||||||
/// file is located. When <see langword="false"/>, the paths will be considered to be relative to the current working directory.</param>
|
/// file is located. When <see langword="false"/>, the paths will be considered to be relative to the current working directory.</param>
|
||||||
|
/// <returns>Instance of the<see cref="KubernetesClientConfiguration"/> class</returns>
|
||||||
public static async Task<KubernetesClientConfiguration> BuildConfigFromConfigFileAsync(
|
public static async Task<KubernetesClientConfiguration> BuildConfigFromConfigFileAsync(
|
||||||
FileInfo kubeconfig,
|
FileInfo kubeconfig,
|
||||||
string currentContext = null, string masterUrl = null, bool useRelativePaths = true)
|
string currentContext = null, string masterUrl = null, bool useRelativePaths = true)
|
||||||
@@ -129,6 +133,7 @@ namespace k8s
|
|||||||
/// <param name="kubeconfig">Stream of the kubeconfig, cannot be null</param>
|
/// <param name="kubeconfig">Stream of the kubeconfig, cannot be null</param>
|
||||||
/// <param name="currentContext">Override the current context in config, set null if do not want to override</param>
|
/// <param name="currentContext">Override the current context in config, set null if do not want to override</param>
|
||||||
/// <param name="masterUrl">Override the Kubernetes API server endpoint, set null if do not want to override</param>
|
/// <param name="masterUrl">Override the Kubernetes API server endpoint, set null if do not want to override</param>
|
||||||
|
/// <returns>Instance of the<see cref="KubernetesClientConfiguration"/> class</returns>
|
||||||
public static KubernetesClientConfiguration BuildConfigFromConfigFile(
|
public static KubernetesClientConfiguration BuildConfigFromConfigFile(
|
||||||
Stream kubeconfig,
|
Stream kubeconfig,
|
||||||
string currentContext = null, string masterUrl = null)
|
string currentContext = null, string masterUrl = null)
|
||||||
@@ -142,6 +147,7 @@ namespace k8s
|
|||||||
/// <param name="kubeconfig">Stream of the kubeconfig, cannot be null</param>
|
/// <param name="kubeconfig">Stream of the kubeconfig, cannot be null</param>
|
||||||
/// <param name="currentContext">Override the current context in config, set null if do not want to override</param>
|
/// <param name="currentContext">Override the current context in config, set null if do not want to override</param>
|
||||||
/// <param name="masterUrl">Override the Kubernetes API server endpoint, set null if do not want to override</param>
|
/// <param name="masterUrl">Override the Kubernetes API server endpoint, set null if do not want to override</param>
|
||||||
|
/// <returns>Instance of the<see cref="KubernetesClientConfiguration"/> class</returns>
|
||||||
public static async Task<KubernetesClientConfiguration> BuildConfigFromConfigFileAsync(
|
public static async Task<KubernetesClientConfiguration> BuildConfigFromConfigFileAsync(
|
||||||
Stream kubeconfig,
|
Stream kubeconfig,
|
||||||
string currentContext = null, string masterUrl = null)
|
string currentContext = null, string masterUrl = null)
|
||||||
@@ -167,9 +173,10 @@ namespace k8s
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// Initializes a new instance of <see cref="KubernetesClientConfiguration"/> from pre-loaded config object.
|
/// Initializes a new instance of <see cref="KubernetesClientConfiguration"/> from pre-loaded config object.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="k8sConfig">A <see cref="K8SConfiguration"/>, for example loaded from <see cref="LoadKubeConfigAsync(string, bool)" /></param>
|
/// <param name="k8SConfig">A <see cref="K8SConfiguration"/>, for example loaded from <see cref="LoadKubeConfigAsync(string, bool)" /></param>
|
||||||
/// <param name="currentContext">Override the current context in config, set null if do not want to override</param>
|
/// <param name="currentContext">Override the current context in config, set null if do not want to override</param>
|
||||||
/// <param name="masterUrl">Override the Kubernetes API server endpoint, set null if do not want to override</param>
|
/// <param name="masterUrl">Override the Kubernetes API server endpoint, set null if do not want to override</param>
|
||||||
|
/// <returns>Instance of the<see cref="KubernetesClientConfiguration"/> class</returns>
|
||||||
public static KubernetesClientConfiguration BuildConfigFromConfigObject(
|
public static KubernetesClientConfiguration BuildConfigFromConfigObject(
|
||||||
K8SConfiguration k8SConfig,
|
K8SConfiguration k8SConfig,
|
||||||
string currentContext = null, string masterUrl = null)
|
string currentContext = null, string masterUrl = null)
|
||||||
@@ -179,6 +186,11 @@ namespace k8s
|
|||||||
string currentContext,
|
string currentContext,
|
||||||
string masterUrl, K8SConfiguration k8SConfig)
|
string masterUrl, K8SConfiguration k8SConfig)
|
||||||
{
|
{
|
||||||
|
if (k8SConfig == null)
|
||||||
|
{
|
||||||
|
throw new ArgumentNullException(nameof(k8SConfig));
|
||||||
|
}
|
||||||
|
|
||||||
var k8SConfiguration = new KubernetesClientConfiguration();
|
var k8SConfiguration = new KubernetesClientConfiguration();
|
||||||
|
|
||||||
currentContext = currentContext ?? k8SConfig.CurrentContext;
|
currentContext = currentContext ?? k8SConfig.CurrentContext;
|
||||||
@@ -256,7 +268,7 @@ namespace k8s
|
|||||||
Host = clusterDetails.ClusterEndpoint.Server;
|
Host = clusterDetails.ClusterEndpoint.Server;
|
||||||
SkipTlsVerify = clusterDetails.ClusterEndpoint.SkipTlsVerify;
|
SkipTlsVerify = clusterDetails.ClusterEndpoint.SkipTlsVerify;
|
||||||
|
|
||||||
if (!Uri.TryCreate(Host, UriKind.Absolute, out Uri uri))
|
if (!Uri.TryCreate(Host, UriKind.Absolute, out var uri))
|
||||||
{
|
{
|
||||||
throw new KubeConfigException($"Bad server host URL `{Host}` (cannot be parsed)");
|
throw new KubeConfigException($"Bad server host URL `{Host}` (cannot be parsed)");
|
||||||
}
|
}
|
||||||
@@ -426,6 +438,11 @@ namespace k8s
|
|||||||
|
|
||||||
public static Process CreateRunnableExternalProcess(ExternalExecution config)
|
public static Process CreateRunnableExternalProcess(ExternalExecution config)
|
||||||
{
|
{
|
||||||
|
if (config == null)
|
||||||
|
{
|
||||||
|
throw new ArgumentNullException(nameof(config));
|
||||||
|
}
|
||||||
|
|
||||||
var execInfo = new Dictionary<string, dynamic>
|
var execInfo = new Dictionary<string, dynamic>
|
||||||
{
|
{
|
||||||
{ "apiVersion", config.ApiVersion },
|
{ "apiVersion", config.ApiVersion },
|
||||||
@@ -479,6 +496,11 @@ namespace k8s
|
|||||||
/// </returns>
|
/// </returns>
|
||||||
public static (string, string, string) ExecuteExternalCommand(ExternalExecution config)
|
public static (string, string, string) ExecuteExternalCommand(ExternalExecution config)
|
||||||
{
|
{
|
||||||
|
if (config == null)
|
||||||
|
{
|
||||||
|
throw new ArgumentNullException(nameof(config));
|
||||||
|
}
|
||||||
|
|
||||||
var process = CreateRunnableExternalProcess(config);
|
var process = CreateRunnableExternalProcess(config);
|
||||||
|
|
||||||
try
|
try
|
||||||
@@ -576,6 +598,12 @@ namespace k8s
|
|||||||
FileInfo kubeconfig,
|
FileInfo kubeconfig,
|
||||||
bool useRelativePaths = true)
|
bool useRelativePaths = true)
|
||||||
{
|
{
|
||||||
|
if (kubeconfig == null)
|
||||||
|
{
|
||||||
|
throw new ArgumentNullException(nameof(kubeconfig));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
if (!kubeconfig.Exists)
|
if (!kubeconfig.Exists)
|
||||||
{
|
{
|
||||||
throw new KubeConfigException($"kubeconfig file not found at {kubeconfig.FullName}");
|
throw new KubeConfigException($"kubeconfig file not found at {kubeconfig.FullName}");
|
||||||
@@ -619,7 +647,7 @@ namespace k8s
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// Loads Kube Config
|
/// Loads Kube Config
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="kubeconfig">Kube config file contents stream</param>
|
/// <param name="kubeconfigStream">Kube config file contents stream</param>
|
||||||
/// <returns>Instance of the <see cref="K8SConfiguration"/> class</returns>
|
/// <returns>Instance of the <see cref="K8SConfiguration"/> class</returns>
|
||||||
public static K8SConfiguration LoadKubeConfig(Stream kubeconfigStream)
|
public static K8SConfiguration LoadKubeConfig(Stream kubeconfigStream)
|
||||||
{
|
{
|
||||||
@@ -629,7 +657,7 @@ namespace k8s
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// Loads Kube Config
|
/// Loads Kube Config
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="kubeconfigs">List of kube config file contents</param>
|
/// <param name="kubeConfigs">List of kube config file contents</param>
|
||||||
/// <param name="useRelativePaths">When <see langword="true"/>, the paths in the kubeconfig file will be considered to be relative to the directory in which the kubeconfig
|
/// <param name="useRelativePaths">When <see langword="true"/>, the paths in the kubeconfig file will be considered to be relative to the directory in which the kubeconfig
|
||||||
/// file is located. When <see langword="false"/>, the paths will be considered to be relative to the current working directory.</param>
|
/// file is located. When <see langword="false"/>, the paths will be considered to be relative to the current working directory.</param>
|
||||||
/// <returns>Instance of the <see cref="K8SConfiguration"/> class</returns>
|
/// <returns>Instance of the <see cref="K8SConfiguration"/> class</returns>
|
||||||
@@ -645,7 +673,7 @@ namespace k8s
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// Loads Kube Config
|
/// Loads Kube Config
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="kubeconfigs">List of kube config file contents</param>
|
/// <param name="kubeConfigs">List of kube config file contents</param>
|
||||||
/// <param name="useRelativePaths">When <see langword="true"/>, the paths in the kubeconfig file will be considered to be relative to the directory in which the kubeconfig
|
/// <param name="useRelativePaths">When <see langword="true"/>, the paths in the kubeconfig file will be considered to be relative to the directory in which the kubeconfig
|
||||||
/// file is located. When <see langword="false"/>, the paths will be considered to be relative to the current working directory.</param>
|
/// file is located. When <see langword="false"/>, the paths will be considered to be relative to the current working directory.</param>
|
||||||
/// <returns>Instance of the <see cref="K8SConfiguration"/> class</returns>
|
/// <returns>Instance of the <see cref="K8SConfiguration"/> class</returns>
|
||||||
|
|||||||
@@ -10,11 +10,11 @@ namespace k8s
|
|||||||
var httpClientHandler = new HttpClientHandler();
|
var httpClientHandler = new HttpClientHandler();
|
||||||
|
|
||||||
#if !NET452
|
#if !NET452
|
||||||
var uriScheme = new Uri(this.Host).Scheme;
|
var uriScheme = new Uri(Host).Scheme;
|
||||||
|
|
||||||
if (uriScheme == "https")
|
if (uriScheme == "https")
|
||||||
{
|
{
|
||||||
if (this.SkipTlsVerify)
|
if (SkipTlsVerify)
|
||||||
{
|
{
|
||||||
httpClientHandler.ServerCertificateCustomValidationCallback =
|
httpClientHandler.ServerCertificateCustomValidationCallback =
|
||||||
(sender, certificate, chain, sslPolicyErrors) => true;
|
(sender, certificate, chain, sslPolicyErrors) => true;
|
||||||
@@ -24,7 +24,7 @@ namespace k8s
|
|||||||
httpClientHandler.ServerCertificateCustomValidationCallback =
|
httpClientHandler.ServerCertificateCustomValidationCallback =
|
||||||
(sender, certificate, chain, sslPolicyErrors) =>
|
(sender, certificate, chain, sslPolicyErrors) =>
|
||||||
{
|
{
|
||||||
return Kubernetes.CertificateValidationCallBack(sender, this.SslCaCerts, certificate, chain,
|
return Kubernetes.CertificateValidationCallBack(sender, SslCaCerts, certificate, chain,
|
||||||
sslPolicyErrors);
|
sslPolicyErrors);
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
@@ -38,10 +38,15 @@ namespace k8s
|
|||||||
|
|
||||||
public void AddCertificates(HttpClientHandler handler)
|
public void AddCertificates(HttpClientHandler handler)
|
||||||
{
|
{
|
||||||
if ((!string.IsNullOrWhiteSpace(this.ClientCertificateData) ||
|
if (handler == null)
|
||||||
!string.IsNullOrWhiteSpace(this.ClientCertificateFilePath)) &&
|
{
|
||||||
(!string.IsNullOrWhiteSpace(this.ClientCertificateKeyData) ||
|
throw new ArgumentNullException(nameof(handler));
|
||||||
!string.IsNullOrWhiteSpace(this.ClientKeyFilePath)))
|
}
|
||||||
|
|
||||||
|
if ((!string.IsNullOrWhiteSpace(ClientCertificateData) ||
|
||||||
|
!string.IsNullOrWhiteSpace(ClientCertificateFilePath)) &&
|
||||||
|
(!string.IsNullOrWhiteSpace(ClientCertificateKeyData) ||
|
||||||
|
!string.IsNullOrWhiteSpace(ClientKeyFilePath)))
|
||||||
{
|
{
|
||||||
var cert = CertUtils.GeneratePfx(this);
|
var cert = CertUtils.GeneratePfx(this);
|
||||||
|
|
||||||
|
|||||||
@@ -17,6 +17,7 @@ namespace k8s
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
/// Initializes a new instance of the <see cref="KubernetesException"/> class.
|
||||||
/// Initializes a ne winstance of the <see cref="KubernetesException"/> class using
|
/// Initializes a ne winstance of the <see cref="KubernetesException"/> class using
|
||||||
/// the data from a <see cref="V1Status"/> object.
|
/// the data from a <see cref="V1Status"/> object.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@@ -26,7 +27,7 @@ namespace k8s
|
|||||||
public KubernetesException(V1Status status)
|
public KubernetesException(V1Status status)
|
||||||
: this(status?.Message)
|
: this(status?.Message)
|
||||||
{
|
{
|
||||||
this.Status = status;
|
Status = status;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|||||||
@@ -8,8 +8,8 @@ namespace k8s.Models
|
|||||||
public class KubernetesList<T> : IMetadata<V1ListMeta>, IItems<T>
|
public class KubernetesList<T> : IMetadata<V1ListMeta>, IItems<T>
|
||||||
where T : IKubernetesObject
|
where T : IKubernetesObject
|
||||||
{
|
{
|
||||||
public KubernetesList(IList<T> items, string apiVersion = default(string), string kind = default(string),
|
public KubernetesList(IList<T> items, string apiVersion = default, string kind = default,
|
||||||
V1ListMeta metadata = default(V1ListMeta))
|
V1ListMeta metadata = default)
|
||||||
{
|
{
|
||||||
ApiVersion = apiVersion;
|
ApiVersion = apiVersion;
|
||||||
Items = items;
|
Items = items;
|
||||||
|
|||||||
@@ -12,27 +12,34 @@ namespace k8s
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// Get nodes metrics pull from metrics server API.
|
/// Get nodes metrics pull from metrics server API.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public static async Task<NodeMetricsList> GetKubernetesNodesMetricsAsync(this IKubernetes operations)
|
/// <param name="kubernetes">kubernetes client object</param>
|
||||||
|
/// <returns>the metrics <see cref="PodMetricsList"/></returns>
|
||||||
|
public static async Task<NodeMetricsList> GetKubernetesNodesMetricsAsync(this IKubernetes kubernetes)
|
||||||
{
|
{
|
||||||
JObject customObject = (JObject)await operations.GetClusterCustomObjectAsync("metrics.k8s.io", "v1beta1", "nodes", string.Empty).ConfigureAwait(false);
|
var customObject = (JObject)await kubernetes.GetClusterCustomObjectAsync("metrics.k8s.io", "v1beta1", "nodes", string.Empty).ConfigureAwait(false);
|
||||||
return customObject.ToObject<NodeMetricsList>();
|
return customObject.ToObject<NodeMetricsList>();
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Get pods metrics pull from metrics server API.
|
/// Get pods metrics pull from metrics server API.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public static async Task<PodMetricsList> GetKubernetesPodsMetricsAsync(this IKubernetes operations)
|
/// <param name="kubernetes">kubernetes client object</param>
|
||||||
|
/// <returns>the metrics <see cref="PodMetricsList"/></returns>
|
||||||
|
public static async Task<PodMetricsList> GetKubernetesPodsMetricsAsync(this IKubernetes kubernetes)
|
||||||
{
|
{
|
||||||
JObject customObject = (JObject)await operations.GetClusterCustomObjectAsync("metrics.k8s.io", "v1beta1", "pods", string.Empty).ConfigureAwait(false);
|
var customObject = (JObject)await kubernetes.GetClusterCustomObjectAsync("metrics.k8s.io", "v1beta1", "pods", string.Empty).ConfigureAwait(false);
|
||||||
return customObject.ToObject<PodMetricsList>();
|
return customObject.ToObject<PodMetricsList>();
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Get pods metrics by namespace pull from metrics server API.
|
/// Get pods metrics by namespace pull from metrics server API.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public static async Task<PodMetricsList> GetKubernetesPodsMetricsByNamespaceAsync(this IKubernetes operations, string namespaceParameter)
|
/// <param name="kubernetes">kubernetes client object</param>
|
||||||
|
/// <param name="namespaceParameter">the querying namespace</param>
|
||||||
|
/// <returns>the metrics <see cref="PodMetricsList"/></returns>
|
||||||
|
public static async Task<PodMetricsList> GetKubernetesPodsMetricsByNamespaceAsync(this IKubernetes kubernetes, string namespaceParameter)
|
||||||
{
|
{
|
||||||
JObject customObject = (JObject)await operations.GetNamespacedCustomObjectAsync("metrics.k8s.io", "v1beta1", namespaceParameter, "pods", string.Empty).ConfigureAwait(false);
|
var customObject = (JObject)await kubernetes.GetNamespacedCustomObjectAsync("metrics.k8s.io", "v1beta1", namespaceParameter, "pods", string.Empty).ConfigureAwait(false);
|
||||||
return customObject.ToObject<PodMetricsList>();
|
return customObject.ToObject<PodMetricsList>();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -8,6 +8,8 @@ namespace k8s.Models
|
|||||||
public static class ModelExtensions
|
public static class ModelExtensions
|
||||||
{
|
{
|
||||||
/// <summary>Adds the given finalizer to a Kubernetes object if it doesn't already exist.</summary>
|
/// <summary>Adds the given finalizer to a Kubernetes object if it doesn't already exist.</summary>
|
||||||
|
/// <param name="obj">the object meta<see cref="V1ObjectMeta"/></param>
|
||||||
|
/// <param name="finalizer">the finalizer</param>
|
||||||
/// <returns>Returns true if the finalizer was added and false if it already existed.</returns>
|
/// <returns>Returns true if the finalizer was added and false if it already existed.</returns>
|
||||||
public static bool AddFinalizer(this IMetadata<V1ObjectMeta> obj, string finalizer)
|
public static bool AddFinalizer(this IMetadata<V1ObjectMeta> obj, string finalizer)
|
||||||
{
|
{
|
||||||
@@ -31,6 +33,8 @@ namespace k8s.Models
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>Extracts the Kubernetes API group from the <see cref="IKubernetesObject.ApiVersion"/>.</summary>
|
/// <summary>Extracts the Kubernetes API group from the <see cref="IKubernetesObject.ApiVersion"/>.</summary>
|
||||||
|
/// <param name="obj">the kubernetes client <see cref="IKubernetesObject"/></param>
|
||||||
|
/// <returns>api group from server</returns>
|
||||||
public static string ApiGroup(this IKubernetesObject obj)
|
public static string ApiGroup(this IKubernetesObject obj)
|
||||||
{
|
{
|
||||||
if (obj == null)
|
if (obj == null)
|
||||||
@@ -40,7 +44,7 @@ namespace k8s.Models
|
|||||||
|
|
||||||
if (obj.ApiVersion != null)
|
if (obj.ApiVersion != null)
|
||||||
{
|
{
|
||||||
int slash = obj.ApiVersion.IndexOf('/');
|
var slash = obj.ApiVersion.IndexOf('/');
|
||||||
return slash < 0 ? string.Empty : obj.ApiVersion.Substring(0, slash);
|
return slash < 0 ? string.Empty : obj.ApiVersion.Substring(0, slash);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -48,6 +52,8 @@ namespace k8s.Models
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>Extracts the Kubernetes API version (excluding the group) from the <see cref="IKubernetesObject.ApiVersion"/>.</summary>
|
/// <summary>Extracts the Kubernetes API version (excluding the group) from the <see cref="IKubernetesObject.ApiVersion"/>.</summary>
|
||||||
|
/// <param name="obj">the kubernetes client <see cref="IKubernetesObject"/></param>
|
||||||
|
/// <returns>api group version from server</returns>
|
||||||
public static string ApiGroupVersion(this IKubernetesObject obj)
|
public static string ApiGroupVersion(this IKubernetesObject obj)
|
||||||
{
|
{
|
||||||
if (obj == null)
|
if (obj == null)
|
||||||
@@ -57,7 +63,7 @@ namespace k8s.Models
|
|||||||
|
|
||||||
if (obj.ApiVersion != null)
|
if (obj.ApiVersion != null)
|
||||||
{
|
{
|
||||||
int slash = obj.ApiVersion.IndexOf('/');
|
var slash = obj.ApiVersion.IndexOf('/');
|
||||||
return slash < 0 ? obj.ApiVersion : obj.ApiVersion.Substring(slash + 1);
|
return slash < 0 ? obj.ApiVersion : obj.ApiVersion.Substring(slash + 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -65,6 +71,8 @@ namespace k8s.Models
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>Splits the Kubernetes API version into the group and version.</summary>
|
/// <summary>Splits the Kubernetes API version into the group and version.</summary>
|
||||||
|
/// <param name="obj">the kubernetes client <see cref="IKubernetesObject"/></param>
|
||||||
|
/// <returns>api group and version from server</returns>
|
||||||
public static (string, string) ApiGroupAndVersion(this IKubernetesObject obj)
|
public static (string, string) ApiGroupAndVersion(this IKubernetesObject obj)
|
||||||
{
|
{
|
||||||
string group, version;
|
string group, version;
|
||||||
@@ -73,6 +81,9 @@ namespace k8s.Models
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>Splits the Kubernetes API version into the group and version.</summary>
|
/// <summary>Splits the Kubernetes API version into the group and version.</summary>
|
||||||
|
/// <param name="obj">the kubernetes client <see cref="IKubernetesObject"/></param>
|
||||||
|
/// <param name="group">api group output var</param>
|
||||||
|
/// <param name="version">api group version output var</param>
|
||||||
public static void GetApiGroupAndVersion(this IKubernetesObject obj, out string group, out string version)
|
public static void GetApiGroupAndVersion(this IKubernetesObject obj, out string group, out string version)
|
||||||
{
|
{
|
||||||
if (obj == null)
|
if (obj == null)
|
||||||
@@ -86,7 +97,7 @@ namespace k8s.Models
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
int slash = obj.ApiVersion.IndexOf('/');
|
var slash = obj.ApiVersion.IndexOf('/');
|
||||||
if (slash < 0)
|
if (slash < 0)
|
||||||
{
|
{
|
||||||
(group, version) = (string.Empty, obj.ApiVersion);
|
(group, version) = (string.Empty, obj.ApiVersion);
|
||||||
@@ -98,10 +109,16 @@ namespace k8s.Models
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>Gets the continuation token version of a Kubernetes list.</summary>
|
/// <summary>
|
||||||
public static string Continue(this IMetadata<V1ListMeta> list) => list.Metadata?.ContinueProperty;
|
/// Gets the continuation token version of a Kubernetes list.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="list">Kubernetes list</param>
|
||||||
|
/// <returns>continuation token </returns>
|
||||||
|
public static string Continue(this IMetadata<V1ListMeta> list) => list?.Metadata?.ContinueProperty;
|
||||||
|
|
||||||
/// <summary>Ensures that the <see cref="V1ListMeta"/> metadata field is set, and returns it.</summary>
|
/// <summary>Ensures that the <see cref="V1ListMeta"/> metadata field is set, and returns it.</summary>
|
||||||
|
/// <param name="obj">the object meta<see cref="V1ObjectMeta"/></param>
|
||||||
|
/// <returns>the metadata <see cref="V1ListMeta"/> </returns>
|
||||||
public static V1ListMeta EnsureMetadata(this IMetadata<V1ListMeta> obj)
|
public static V1ListMeta EnsureMetadata(this IMetadata<V1ListMeta> obj)
|
||||||
{
|
{
|
||||||
if (obj == null)
|
if (obj == null)
|
||||||
@@ -118,11 +135,15 @@ namespace k8s.Models
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>Gets the resource version of a Kubernetes list.</summary>
|
/// <summary>Gets the resource version of a Kubernetes list.</summary>
|
||||||
public static string ResourceVersion(this IMetadata<V1ListMeta> list) => list.Metadata?.ResourceVersion;
|
/// <param name="list">the object meta list<see cref="V1ListMeta"/></param>
|
||||||
|
/// <returns>resource version</returns>
|
||||||
|
public static string ResourceVersion(this IMetadata<V1ListMeta> list) => list?.Metadata?.ResourceVersion;
|
||||||
|
|
||||||
/// <summary>Adds an owner reference to the object. No attempt is made to ensure the reference is correct or fits with the
|
/// <summary>Adds an owner reference to the object. No attempt is made to ensure the reference is correct or fits with the
|
||||||
/// other references.
|
/// other references.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
/// <param name="obj">the object meta<see cref="V1ObjectMeta"/></param>
|
||||||
|
/// <param name="ownerRef">the owner reference to the object</param>
|
||||||
public static void AddOwnerReference(this IMetadata<V1ObjectMeta> obj, V1OwnerReference ownerRef)
|
public static void AddOwnerReference(this IMetadata<V1ObjectMeta> obj, V1OwnerReference ownerRef)
|
||||||
{
|
{
|
||||||
if (ownerRef == null)
|
if (ownerRef == null)
|
||||||
@@ -139,16 +160,24 @@ namespace k8s.Models
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>Gets the annotations of a Kubernetes object.</summary>
|
/// <summary>Gets the annotations of a Kubernetes object.</summary>
|
||||||
|
/// <param name="obj">the object meta<see cref="V1ObjectMeta"/></param>
|
||||||
|
/// <returns>a dictionary of the annotations</returns>
|
||||||
public static IDictionary<string, string> Annotations(this IMetadata<V1ObjectMeta> obj) =>
|
public static IDictionary<string, string> Annotations(this IMetadata<V1ObjectMeta> obj) =>
|
||||||
obj.Metadata?.Annotations;
|
obj?.Metadata?.Annotations;
|
||||||
|
|
||||||
/// <summary>Gets the creation time of a Kubernetes object, or null if it hasn't been created yet.</summary>
|
/// <summary>Gets the creation time of a Kubernetes object, or null if it hasn't been created yet.</summary>
|
||||||
public static DateTime? CreationTimestamp(this IMetadata<V1ObjectMeta> obj) => obj.Metadata?.CreationTimestamp;
|
/// <param name="obj">the object meta<see cref="V1ObjectMeta"/></param>
|
||||||
|
/// <returns>creation time of a Kubernetes object, null if it hasn't been created yet.</returns>
|
||||||
|
public static DateTime? CreationTimestamp(this IMetadata<V1ObjectMeta> obj) => obj?.Metadata?.CreationTimestamp;
|
||||||
|
|
||||||
/// <summary>Gets the deletion time of a Kubernetes object, or null if it hasn't been scheduled for deletion.</summary>
|
/// <summary>Gets the deletion time of a Kubernetes object, or null if it hasn't been scheduled for deletion.</summary>
|
||||||
public static DateTime? DeletionTimestamp(this IMetadata<V1ObjectMeta> obj) => obj.Metadata?.DeletionTimestamp;
|
/// <param name="obj">the object meta<see cref="V1ObjectMeta"/></param>
|
||||||
|
/// <returns>the deletion time of a Kubernetes object, or null if it hasn't been scheduled for deletion.</returns>
|
||||||
|
public static DateTime? DeletionTimestamp(this IMetadata<V1ObjectMeta> obj) => obj?.Metadata?.DeletionTimestamp;
|
||||||
|
|
||||||
/// <summary>Ensures that the <see cref="V1ObjectMeta"/> metadata field is set, and returns it.</summary>
|
/// <summary>Ensures that the <see cref="V1ObjectMeta"/> metadata field is set, and returns it.</summary>
|
||||||
|
/// <param name="obj">the object meta<see cref="V1ObjectMeta"/></param>
|
||||||
|
/// <returns>the metadata field <see cref="V1ObjectMeta"/></returns>
|
||||||
public static V1ObjectMeta EnsureMetadata(this IMetadata<V1ObjectMeta> obj)
|
public static V1ObjectMeta EnsureMetadata(this IMetadata<V1ObjectMeta> obj)
|
||||||
{
|
{
|
||||||
if (obj == null)
|
if (obj == null)
|
||||||
@@ -165,17 +194,27 @@ namespace k8s.Models
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>Gets the <see cref="V1ObjectMeta.Finalizers"/> of a Kubernetes object.</summary>
|
/// <summary>Gets the <see cref="V1ObjectMeta.Finalizers"/> of a Kubernetes object.</summary>
|
||||||
public static IList<string> Finalizers(this IMetadata<V1ObjectMeta> obj) => obj.Metadata?.Finalizers;
|
/// <param name="obj">the object meta<see cref="V1ObjectMeta"/></param>
|
||||||
|
/// <returns>Metadata.Finalizers of <see cref="V1ObjectMeta"/></returns>
|
||||||
|
public static IList<string> Finalizers(this IMetadata<V1ObjectMeta> obj) => obj?.Metadata?.Finalizers;
|
||||||
|
|
||||||
/// <summary>Gets the index of the <see cref="V1OwnerReference"/> that matches the given object, or -1 if no such
|
/// <summary>Gets the index of the <see cref="V1OwnerReference"/> that matches the given object, or -1 if no such
|
||||||
/// reference could be found.
|
/// reference could be found.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
/// <param name="obj">the object meta<see cref="V1ObjectMeta"/></param>
|
||||||
|
/// <param name="owner">the owner of the object<see cref="V1ObjectMeta"/></param>
|
||||||
|
/// <returns>the index of the <see cref="V1OwnerReference"/> that matches the given object, or -1 if no such
|
||||||
|
/// reference could be found.</returns>
|
||||||
public static int FindOwnerReference(this IMetadata<V1ObjectMeta> obj, IKubernetesObject<V1ObjectMeta> owner) =>
|
public static int FindOwnerReference(this IMetadata<V1ObjectMeta> obj, IKubernetesObject<V1ObjectMeta> owner) =>
|
||||||
FindOwnerReference(obj, r => r.Matches(owner));
|
FindOwnerReference(obj, r => r.Matches(owner));
|
||||||
|
|
||||||
/// <summary>Gets the index of the <see cref="V1OwnerReference"/> that matches the given predicate, or -1 if no such
|
/// <summary>Gets the index of the <see cref="V1OwnerReference"/> that matches the given predicate, or -1 if no such
|
||||||
/// reference could be found.
|
/// reference could be found.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
/// <param name="obj">the object meta<see cref="V1ObjectMeta"/></param>
|
||||||
|
/// <param name="predicate">a <see cref="Predicate"/> to test owner reference</param>
|
||||||
|
/// <returns>the index of the <see cref="V1OwnerReference"/> that matches the given object, or -1 if no such
|
||||||
|
/// reference could be found.</returns>
|
||||||
public static int FindOwnerReference(this IMetadata<V1ObjectMeta> obj, Predicate<V1OwnerReference> predicate)
|
public static int FindOwnerReference(this IMetadata<V1ObjectMeta> obj, Predicate<V1OwnerReference> predicate)
|
||||||
{
|
{
|
||||||
if (obj == null)
|
if (obj == null)
|
||||||
@@ -191,7 +230,7 @@ namespace k8s.Models
|
|||||||
var ownerRefs = obj.OwnerReferences();
|
var ownerRefs = obj.OwnerReferences();
|
||||||
if (ownerRefs != null)
|
if (ownerRefs != null)
|
||||||
{
|
{
|
||||||
for (int i = 0; i < ownerRefs.Count; i++)
|
for (var i = 0; i < ownerRefs.Count; i++)
|
||||||
{
|
{
|
||||||
if (predicate(ownerRefs[i]))
|
if (predicate(ownerRefs[i]))
|
||||||
{
|
{
|
||||||
@@ -204,9 +243,14 @@ namespace k8s.Models
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>Gets the generation a Kubernetes object.</summary>
|
/// <summary>Gets the generation a Kubernetes object.</summary>
|
||||||
public static long? Generation(this IMetadata<V1ObjectMeta> obj) => obj.Metadata?.Generation;
|
/// <param name="obj">the object meta<see cref="V1ObjectMeta"/></param>
|
||||||
|
/// <returns>the Metadata.Generation of object meta<see cref="V1ObjectMeta"/></returns>
|
||||||
|
public static long? Generation(this IMetadata<V1ObjectMeta> obj) => obj?.Metadata?.Generation;
|
||||||
|
|
||||||
/// <summary>Returns the given annotation from a Kubernetes object or null if the annotation was not found.</summary>
|
/// <summary>Returns the given annotation from a Kubernetes object or null if the annotation was not found.</summary>
|
||||||
|
/// <param name="obj">the object meta<see cref="V1ObjectMeta"/></param>
|
||||||
|
/// <param name="key">the key of the annotation</param>
|
||||||
|
/// <returns>the content of the annotation</returns>
|
||||||
public static string GetAnnotation(this IMetadata<V1ObjectMeta> obj, string key)
|
public static string GetAnnotation(this IMetadata<V1ObjectMeta> obj, string key)
|
||||||
{
|
{
|
||||||
if (obj == null)
|
if (obj == null)
|
||||||
@@ -219,15 +263,20 @@ namespace k8s.Models
|
|||||||
throw new ArgumentNullException(nameof(key));
|
throw new ArgumentNullException(nameof(key));
|
||||||
}
|
}
|
||||||
|
|
||||||
IDictionary<string, string> annotations = obj.Annotations();
|
var annotations = obj.Annotations();
|
||||||
return annotations != null && annotations.TryGetValue(key, out string value) ? value : null;
|
return annotations != null && annotations.TryGetValue(key, out var value) ? value : null;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>Gets the <see cref="V1OwnerReference"/> for the controller of this object, or null if it couldn't be found.</summary>
|
/// <summary>Gets the <see cref="V1OwnerReference"/> for the controller of this object, or null if it couldn't be found.</summary>
|
||||||
|
/// <param name="obj">the object meta<see cref="V1ObjectMeta"/></param>
|
||||||
|
/// <returns>the <see cref="V1OwnerReference"/> for the controller of this object, or null if it couldn't be found.</returns>
|
||||||
public static V1OwnerReference GetController(this IMetadata<V1ObjectMeta> obj) =>
|
public static V1OwnerReference GetController(this IMetadata<V1ObjectMeta> obj) =>
|
||||||
obj.OwnerReferences()?.FirstOrDefault(r => r.Controller.GetValueOrDefault());
|
obj.OwnerReferences()?.FirstOrDefault(r => r.Controller.GetValueOrDefault());
|
||||||
|
|
||||||
/// <summary>Returns the given label from a Kubernetes object or null if the label was not found.</summary>
|
/// <summary>Returns the given label from a Kubernetes object or null if the label was not found.</summary>
|
||||||
|
/// <param name="obj">the object meta<see cref="V1ObjectMeta"/></param>
|
||||||
|
/// <param name="key">the key of the label</param>
|
||||||
|
/// <returns>content of the label</returns>
|
||||||
public static string GetLabel(this IMetadata<V1ObjectMeta> obj, string key)
|
public static string GetLabel(this IMetadata<V1ObjectMeta> obj, string key)
|
||||||
{
|
{
|
||||||
if (obj == null)
|
if (obj == null)
|
||||||
@@ -240,26 +289,35 @@ namespace k8s.Models
|
|||||||
throw new ArgumentNullException(nameof(key));
|
throw new ArgumentNullException(nameof(key));
|
||||||
}
|
}
|
||||||
|
|
||||||
IDictionary<string, string> labels = obj.Labels();
|
var labels = obj.Labels();
|
||||||
return labels != null && labels.TryGetValue(key, out string value) ? value : null;
|
return labels != null && labels.TryGetValue(key, out var value) ? value : null;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>Gets <see cref="V1OwnerReference"/> that matches the given object, or null if no matching reference exists.</summary>
|
/// <summary>Gets <see cref="V1OwnerReference"/> that matches the given object, or null if no matching reference exists.</summary>
|
||||||
|
/// <param name="obj">the object meta<see cref="V1ObjectMeta"/></param>
|
||||||
|
/// <param name="owner">the owner of the object<see cref="V1ObjectMeta"/></param>
|
||||||
|
/// <returns>the <see cref="V1OwnerReference"/> that matches the given object, or null if no matching reference exists.</returns>
|
||||||
public static V1OwnerReference GetOwnerReference(
|
public static V1OwnerReference GetOwnerReference(
|
||||||
this IMetadata<V1ObjectMeta> obj,
|
this IMetadata<V1ObjectMeta> obj,
|
||||||
IKubernetesObject<V1ObjectMeta> owner) =>
|
IKubernetesObject<V1ObjectMeta> owner) =>
|
||||||
GetOwnerReference(obj, r => r.Matches(owner));
|
GetOwnerReference(obj, r => r.Matches(owner));
|
||||||
|
|
||||||
/// <summary>Gets the <see cref="V1OwnerReference"/> that matches the given predicate, or null if no matching reference exists.</summary>
|
/// <summary>Gets the <see cref="V1OwnerReference"/> that matches the given predicate, or null if no matching reference exists.</summary>
|
||||||
|
/// <param name="obj">the object meta<see cref="V1ObjectMeta"/></param>
|
||||||
|
/// <param name="predicate">a <see cref="Predicate"/> to test owner reference</param>
|
||||||
|
/// <returns>the <see cref="V1OwnerReference"/> that matches the given object, or null if no matching reference exists.</returns>
|
||||||
public static V1OwnerReference GetOwnerReference(
|
public static V1OwnerReference GetOwnerReference(
|
||||||
this IMetadata<V1ObjectMeta> obj,
|
this IMetadata<V1ObjectMeta> obj,
|
||||||
Predicate<V1OwnerReference> predicate)
|
Predicate<V1OwnerReference> predicate)
|
||||||
{
|
{
|
||||||
int index = FindOwnerReference(obj, predicate);
|
var index = FindOwnerReference(obj, predicate);
|
||||||
return index >= 0 ? obj.Metadata.OwnerReferences[index] : null;
|
return index >= 0 ? obj.Metadata.OwnerReferences[index] : null;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>Determines whether the Kubernetes object has the given finalizer.</summary>
|
/// <summary>Determines whether the Kubernetes object has the given finalizer.</summary>
|
||||||
|
/// <param name="obj">the object meta<see cref="V1ObjectMeta"/></param>
|
||||||
|
/// <param name="finalizer">the finalizer</param>
|
||||||
|
/// <returns>true if object has the finalizer</returns>
|
||||||
public static bool HasFinalizer(this IMetadata<V1ObjectMeta> obj, string finalizer)
|
public static bool HasFinalizer(this IMetadata<V1ObjectMeta> obj, string finalizer)
|
||||||
{
|
{
|
||||||
if (obj == null)
|
if (obj == null)
|
||||||
@@ -276,23 +334,36 @@ namespace k8s.Models
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>Determines whether one object is owned by another.</summary>
|
/// <summary>Determines whether one object is owned by another.</summary>
|
||||||
|
/// <param name="obj">the object meta<see cref="V1ObjectMeta"/></param>
|
||||||
|
/// <param name="owner">the owner of the object<see cref="V1ObjectMeta"/></param>
|
||||||
|
/// <returns>true if owned by obj</returns>
|
||||||
public static bool IsOwnedBy(this IMetadata<V1ObjectMeta> obj, IKubernetesObject<V1ObjectMeta> owner) =>
|
public static bool IsOwnedBy(this IMetadata<V1ObjectMeta> obj, IKubernetesObject<V1ObjectMeta> owner) =>
|
||||||
FindOwnerReference(obj, owner) >= 0;
|
FindOwnerReference(obj, owner) >= 0;
|
||||||
|
|
||||||
/// <summary>Gets the labels of a Kubernetes object.</summary>
|
/// <summary>Gets the labels of a Kubernetes object.</summary>
|
||||||
public static IDictionary<string, string> Labels(this IMetadata<V1ObjectMeta> obj) => obj.Metadata?.Labels;
|
/// <param name="obj">the object meta<see cref="V1ObjectMeta"/></param>
|
||||||
|
/// <returns>labels of the object in a Dictionary</returns>
|
||||||
|
public static IDictionary<string, string> Labels(this IMetadata<V1ObjectMeta> obj) => obj?.Metadata?.Labels;
|
||||||
|
|
||||||
/// <summary>Gets the name of a Kubernetes object.</summary>
|
/// <summary>Gets the name of a Kubernetes object.</summary>
|
||||||
public static string Name(this IMetadata<V1ObjectMeta> obj) => obj.Metadata?.Name;
|
/// <param name="obj">the object meta<see cref="V1ObjectMeta"/></param>
|
||||||
|
/// <returns>the name of the Kubernetes object</returns>
|
||||||
|
public static string Name(this IMetadata<V1ObjectMeta> obj) => obj?.Metadata?.Name;
|
||||||
|
|
||||||
/// <summary>Gets the namespace of a Kubernetes object.</summary>
|
/// <summary>Gets the namespace of a Kubernetes object.</summary>
|
||||||
public static string Namespace(this IMetadata<V1ObjectMeta> obj) => obj.Metadata?.NamespaceProperty;
|
/// <param name="obj">the object meta<see cref="V1ObjectMeta"/></param>
|
||||||
|
/// <returns>the namespace of the Kubernetes object</returns>
|
||||||
|
public static string Namespace(this IMetadata<V1ObjectMeta> obj) => obj?.Metadata?.NamespaceProperty;
|
||||||
|
|
||||||
/// <summary>Gets the owner references of a Kubernetes object.</summary>
|
/// <summary>Gets the owner references of a Kubernetes object.</summary>
|
||||||
|
/// <param name="obj">the object meta<see cref="V1ObjectMeta"/></param>
|
||||||
|
/// <returns>all owner reference in a list of the Kubernetes object</returns>
|
||||||
public static IList<V1OwnerReference> OwnerReferences(this IMetadata<V1ObjectMeta> obj) =>
|
public static IList<V1OwnerReference> OwnerReferences(this IMetadata<V1ObjectMeta> obj) =>
|
||||||
obj.Metadata?.OwnerReferences;
|
obj?.Metadata?.OwnerReferences;
|
||||||
|
|
||||||
/// <summary>Removes the given finalizer from a Kubernetes object if it exists.</summary>
|
/// <summary>Removes the given finalizer from a Kubernetes object if it exists.</summary>
|
||||||
|
/// <param name="obj">the object meta<see cref="V1ObjectMeta"/></param>
|
||||||
|
/// <param name="finalizer">the finalizer</param>
|
||||||
/// <returns>Returns true if the finalizer was removed and false if it didn't exist.</returns>
|
/// <returns>Returns true if the finalizer was removed and false if it didn't exist.</returns>
|
||||||
public static bool RemoveFinalizer(this IMetadata<V1ObjectMeta> obj, string finalizer)
|
public static bool RemoveFinalizer(this IMetadata<V1ObjectMeta> obj, string finalizer)
|
||||||
{
|
{
|
||||||
@@ -312,15 +383,18 @@ namespace k8s.Models
|
|||||||
/// <summary>Removes the first <see cref="V1OwnerReference"/> that matches the given object and returns it, or returns null if no
|
/// <summary>Removes the first <see cref="V1OwnerReference"/> that matches the given object and returns it, or returns null if no
|
||||||
/// matching reference could be found.
|
/// matching reference could be found.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
/// <param name="obj">the object meta<see cref="V1ObjectMeta"/></param>
|
||||||
|
/// <param name="owner">the owner of the object<see cref="V1ObjectMeta"/></param>
|
||||||
|
/// <returns>the first <see cref="V1OwnerReference"/> that matches the given object</returns>
|
||||||
public static V1OwnerReference RemoveOwnerReference(
|
public static V1OwnerReference RemoveOwnerReference(
|
||||||
this IMetadata<V1ObjectMeta> obj,
|
this IMetadata<V1ObjectMeta> obj,
|
||||||
IKubernetesObject<V1ObjectMeta> owner)
|
IKubernetesObject<V1ObjectMeta> owner)
|
||||||
{
|
{
|
||||||
int index = FindOwnerReference(obj, owner);
|
var index = FindOwnerReference(obj, owner);
|
||||||
V1OwnerReference ownerRef = index >= 0 ? obj.Metadata.OwnerReferences[index] : null;
|
var ownerRef = index >= 0 ? obj?.Metadata.OwnerReferences[index] : null;
|
||||||
if (index >= 0)
|
if (index >= 0)
|
||||||
{
|
{
|
||||||
obj.Metadata.OwnerReferences.RemoveAt(index);
|
obj?.Metadata.OwnerReferences.RemoveAt(index);
|
||||||
}
|
}
|
||||||
|
|
||||||
return ownerRef;
|
return ownerRef;
|
||||||
@@ -329,6 +403,9 @@ namespace k8s.Models
|
|||||||
/// <summary>Removes all <see cref="V1OwnerReference">owner references</see> that match the given predicate, and returns true if
|
/// <summary>Removes all <see cref="V1OwnerReference">owner references</see> that match the given predicate, and returns true if
|
||||||
/// any were removed.
|
/// any were removed.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
/// <param name="obj">the object meta<see cref="V1ObjectMeta"/></param>
|
||||||
|
/// <param name="predicate">a <see cref="Predicate"/> to test owner reference</param>
|
||||||
|
/// <returns>true if any were removed</returns>
|
||||||
public static bool RemoveOwnerReferences(
|
public static bool RemoveOwnerReferences(
|
||||||
this IMetadata<V1ObjectMeta> obj,
|
this IMetadata<V1ObjectMeta> obj,
|
||||||
Predicate<V1OwnerReference> predicate)
|
Predicate<V1OwnerReference> predicate)
|
||||||
@@ -343,11 +420,11 @@ namespace k8s.Models
|
|||||||
throw new ArgumentNullException(nameof(predicate));
|
throw new ArgumentNullException(nameof(predicate));
|
||||||
}
|
}
|
||||||
|
|
||||||
bool removed = false;
|
var removed = false;
|
||||||
IList<V1OwnerReference> refs = obj.Metadata?.OwnerReferences;
|
var refs = obj.Metadata?.OwnerReferences;
|
||||||
if (refs != null)
|
if (refs != null)
|
||||||
{
|
{
|
||||||
for (int i = refs.Count - 1; i >= 0; i--)
|
for (var i = refs.Count - 1; i >= 0; i--)
|
||||||
{
|
{
|
||||||
if (predicate(refs[i]))
|
if (predicate(refs[i]))
|
||||||
{
|
{
|
||||||
@@ -363,15 +440,23 @@ namespace k8s.Models
|
|||||||
/// <summary>Removes all <see cref="V1OwnerReference">owner references</see> that match the given object, and returns true if
|
/// <summary>Removes all <see cref="V1OwnerReference">owner references</see> that match the given object, and returns true if
|
||||||
/// any were removed.
|
/// any were removed.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
/// <param name="obj">the object meta<see cref="V1ObjectMeta"/></param>
|
||||||
|
/// <param name="owner">the owner of the object<see cref="V1ObjectMeta"/></param>
|
||||||
|
/// <returns>true if any were removed</returns>
|
||||||
public static bool RemoveOwnerReferences(
|
public static bool RemoveOwnerReferences(
|
||||||
this IMetadata<V1ObjectMeta> obj,
|
this IMetadata<V1ObjectMeta> obj,
|
||||||
IKubernetesObject<V1ObjectMeta> owner) =>
|
IKubernetesObject<V1ObjectMeta> owner) =>
|
||||||
RemoveOwnerReferences(obj, r => r.Matches(owner));
|
RemoveOwnerReferences(obj, r => r.Matches(owner));
|
||||||
|
|
||||||
/// <summary>Gets the resource version of a Kubernetes object.</summary>
|
/// <summary>Gets the resource version of a Kubernetes object.</summary>
|
||||||
public static string ResourceVersion(this IMetadata<V1ObjectMeta> obj) => obj.Metadata?.ResourceVersion;
|
/// <param name="obj">the object meta<see cref="V1ObjectMeta"/></param>
|
||||||
|
/// <returns>the resource version of a Kubernetes object</returns>
|
||||||
|
public static string ResourceVersion(this IMetadata<V1ObjectMeta> obj) => obj?.Metadata?.ResourceVersion;
|
||||||
|
|
||||||
/// <summary>Sets or removes an annotation on a Kubernetes object.</summary>
|
/// <summary>Sets or removes an annotation on a Kubernetes object.</summary>
|
||||||
|
/// <param name="obj">the object meta<see cref="V1ObjectMeta"/></param>
|
||||||
|
/// <param name="key">the key of the annotation<see cref="V1ObjectMeta"/></param>
|
||||||
|
/// <param name="value">the value of the annotation, null to remove it<see cref="V1ObjectMeta"/></param>
|
||||||
public static void SetAnnotation(this IMetadata<V1ObjectMeta> obj, string key, string value)
|
public static void SetAnnotation(this IMetadata<V1ObjectMeta> obj, string key, string value)
|
||||||
{
|
{
|
||||||
if (obj == null)
|
if (obj == null)
|
||||||
@@ -395,6 +480,9 @@ namespace k8s.Models
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>Sets or removes a label on a Kubernetes object.</summary>
|
/// <summary>Sets or removes a label on a Kubernetes object.</summary>
|
||||||
|
/// <param name="obj">the object meta<see cref="V1ObjectMeta"/></param>
|
||||||
|
/// <param name="key">the key of the label<see cref="V1ObjectMeta"/></param>
|
||||||
|
/// <param name="value">the value of the label, null to remove it<see cref="V1ObjectMeta"/></param>
|
||||||
public static void SetLabel(this IMetadata<V1ObjectMeta> obj, string key, string value)
|
public static void SetLabel(this IMetadata<V1ObjectMeta> obj, string key, string value)
|
||||||
{
|
{
|
||||||
if (obj == null)
|
if (obj == null)
|
||||||
@@ -418,9 +506,13 @@ namespace k8s.Models
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>Gets the unique ID of a Kubernetes object.</summary>
|
/// <summary>Gets the unique ID of a Kubernetes object.</summary>
|
||||||
public static string Uid(this IMetadata<V1ObjectMeta> obj) => obj.Metadata?.Uid;
|
/// <param name="obj">the object meta<see cref="V1ObjectMeta"/></param>
|
||||||
|
/// <returns> the unique ID of a Kubernetes object</returns>
|
||||||
|
public static string Uid(this IMetadata<V1ObjectMeta> obj) => obj?.Metadata?.Uid;
|
||||||
|
|
||||||
/// <summary>Ensures that the <see cref="V1ObjectMeta.Annotations"/> field is not null, and returns it.</summary>
|
/// <summary>Ensures that the <see cref="V1ObjectMeta.Annotations"/> field is not null, and returns it.</summary>
|
||||||
|
/// <param name="meta">the object meta<see cref="V1ObjectMeta"/></param>
|
||||||
|
/// <returns>the annotations in a Dictionary</returns>
|
||||||
public static IDictionary<string, string> EnsureAnnotations(this V1ObjectMeta meta)
|
public static IDictionary<string, string> EnsureAnnotations(this V1ObjectMeta meta)
|
||||||
{
|
{
|
||||||
if (meta == null)
|
if (meta == null)
|
||||||
@@ -437,6 +529,8 @@ namespace k8s.Models
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>Ensures that the <see cref="V1ObjectMeta.Finalizers"/> field is not null, and returns it.</summary>
|
/// <summary>Ensures that the <see cref="V1ObjectMeta.Finalizers"/> field is not null, and returns it.</summary>
|
||||||
|
/// <param name="meta">the object meta<see cref="V1ObjectMeta"/></param>
|
||||||
|
/// <returns>the list of finalizers</returns>
|
||||||
public static IList<string> EnsureFinalizers(this V1ObjectMeta meta)
|
public static IList<string> EnsureFinalizers(this V1ObjectMeta meta)
|
||||||
{
|
{
|
||||||
if (meta == null)
|
if (meta == null)
|
||||||
@@ -453,6 +547,8 @@ namespace k8s.Models
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>Ensures that the <see cref="V1ObjectMeta.Labels"/> field is not null, and returns it.</summary>
|
/// <summary>Ensures that the <see cref="V1ObjectMeta.Labels"/> field is not null, and returns it.</summary>
|
||||||
|
/// <param name="meta">the object meta<see cref="V1ObjectMeta"/></param>
|
||||||
|
/// <returns>the dictionary of labels</returns>
|
||||||
public static IDictionary<string, string> EnsureLabels(this V1ObjectMeta meta)
|
public static IDictionary<string, string> EnsureLabels(this V1ObjectMeta meta)
|
||||||
{
|
{
|
||||||
if (meta == null)
|
if (meta == null)
|
||||||
@@ -469,12 +565,27 @@ namespace k8s.Models
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>Gets the namespace from Kubernetes metadata.</summary>
|
/// <summary>Gets the namespace from Kubernetes metadata.</summary>
|
||||||
public static string Namespace(this V1ObjectMeta meta) => meta.NamespaceProperty;
|
/// <param name="meta">the object meta<see cref="V1ObjectMeta"/></param>
|
||||||
|
/// <returns>the namespace from Kubernetes metadata</returns>
|
||||||
|
public static string Namespace(this V1ObjectMeta meta) => meta?.NamespaceProperty;
|
||||||
|
|
||||||
/// <summary>Sets the namespace from Kubernetes metadata.</summary>
|
/// <summary>Sets the namespace from Kubernetes metadata.</summary>
|
||||||
public static void SetNamespace(this V1ObjectMeta meta, string ns) => meta.NamespaceProperty = ns;
|
/// <param name="meta">the object meta<see cref="V1ObjectMeta"/></param>
|
||||||
|
/// <param name="ns">the namespace</param>
|
||||||
|
public static void SetNamespace(this V1ObjectMeta meta, string ns)
|
||||||
|
{
|
||||||
|
if (meta == null)
|
||||||
|
{
|
||||||
|
throw new ArgumentNullException(nameof(meta));
|
||||||
|
}
|
||||||
|
|
||||||
|
meta.NamespaceProperty = ns;
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>Determines whether an object reference references the given object.</summary>
|
/// <summary>Determines whether an object reference references the given object.</summary>
|
||||||
|
/// <param name="objref">the object reference<see cref="V1ObjectReference"/></param>
|
||||||
|
/// <param name="obj">the object meta<see cref="V1ObjectMeta"/></param>
|
||||||
|
/// <returns>true if the object reference references the given object.</returns>
|
||||||
public static bool Matches(this V1ObjectReference objref, IKubernetesObject<V1ObjectMeta> obj)
|
public static bool Matches(this V1ObjectReference objref, IKubernetesObject<V1ObjectMeta> obj)
|
||||||
{
|
{
|
||||||
if (objref == null)
|
if (objref == null)
|
||||||
@@ -493,6 +604,9 @@ namespace k8s.Models
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>Determines whether an owner reference references the given object.</summary>
|
/// <summary>Determines whether an owner reference references the given object.</summary>
|
||||||
|
/// <param name="owner">the object reference<see cref="V1ObjectReference"/></param>
|
||||||
|
/// <param name="obj">the object meta<see cref="V1ObjectMeta"/></param>
|
||||||
|
/// <returns>true if the owner reference references the given object</returns>
|
||||||
public static bool Matches(this V1OwnerReference owner, IKubernetesObject<V1ObjectMeta> obj)
|
public static bool Matches(this V1OwnerReference owner, IKubernetesObject<V1ObjectMeta> obj)
|
||||||
{
|
{
|
||||||
if (owner == null)
|
if (owner == null)
|
||||||
|
|||||||
@@ -41,13 +41,13 @@ namespace k8s
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// <inheritdoc/>
|
/// <inheritdoc/>
|
||||||
public override bool CanRead => this.inputBuffer != null;
|
public override bool CanRead => inputBuffer != null;
|
||||||
|
|
||||||
/// <inheritdoc/>
|
/// <inheritdoc/>
|
||||||
public override bool CanSeek => false;
|
public override bool CanSeek => false;
|
||||||
|
|
||||||
/// <inheritdoc/>
|
/// <inheritdoc/>
|
||||||
public override bool CanWrite => this.outputIndex != null;
|
public override bool CanWrite => outputIndex != null;
|
||||||
|
|
||||||
/// <inheritdoc/>
|
/// <inheritdoc/>
|
||||||
public override long Length => throw new NotSupportedException();
|
public override long Length => throw new NotSupportedException();
|
||||||
@@ -62,26 +62,26 @@ namespace k8s
|
|||||||
/// <inheritdoc/>
|
/// <inheritdoc/>
|
||||||
public override void Write(byte[] buffer, int offset, int count)
|
public override void Write(byte[] buffer, int offset, int count)
|
||||||
{
|
{
|
||||||
if (this.outputIndex == null)
|
if (outputIndex == null)
|
||||||
{
|
{
|
||||||
throw new InvalidOperationException();
|
throw new InvalidOperationException();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
this.muxer.Write(this.outputIndex.Value, buffer, offset, count).GetAwaiter().GetResult();
|
muxer.Write(outputIndex.Value, buffer, offset, count).GetAwaiter().GetResult();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <inheritdoc/>
|
/// <inheritdoc/>
|
||||||
public override int Read(byte[] buffer, int offset, int count)
|
public override int Read(byte[] buffer, int offset, int count)
|
||||||
{
|
{
|
||||||
if (this.inputBuffer == null)
|
if (inputBuffer == null)
|
||||||
{
|
{
|
||||||
throw new InvalidOperationException();
|
throw new InvalidOperationException();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
return this.inputBuffer.Read(buffer, offset, count);
|
return inputBuffer.Read(buffer, offset, count);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -65,8 +65,19 @@ namespace k8s.Models
|
|||||||
{
|
{
|
||||||
public enum SuffixFormat
|
public enum SuffixFormat
|
||||||
{
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// e.g., 12e6
|
||||||
|
/// </summary>
|
||||||
DecimalExponent,
|
DecimalExponent,
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// e.g., 12Mi (12 * 2^20)
|
||||||
|
/// </summary>
|
||||||
BinarySI,
|
BinarySI,
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// e.g., 12M (12 * 10^6)
|
||||||
|
/// </summary>
|
||||||
DecimalSI,
|
DecimalSI,
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -95,7 +106,7 @@ namespace k8s.Models
|
|||||||
|
|
||||||
protected bool Equals(ResourceQuantity other)
|
protected bool Equals(ResourceQuantity other)
|
||||||
{
|
{
|
||||||
return Format == other.Format && _unitlessValue.Equals(other._unitlessValue);
|
return Format == other?.Format && _unitlessValue.Equals(other._unitlessValue);
|
||||||
}
|
}
|
||||||
|
|
||||||
public override bool Equals(object obj)
|
public override bool Equals(object obj)
|
||||||
@@ -202,7 +213,7 @@ namespace k8s.Models
|
|||||||
throw new ArgumentOutOfRangeException(nameof(expectedType));
|
throw new ArgumentOutOfRangeException(nameof(expectedType));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (parser.Current is Scalar)
|
if (parser?.Current is Scalar)
|
||||||
{
|
{
|
||||||
Value = ((Scalar)parser.Current).Value;
|
Value = ((Scalar)parser.Current).Value;
|
||||||
parser.MoveNext();
|
parser.MoveNext();
|
||||||
@@ -213,12 +224,7 @@ namespace k8s.Models
|
|||||||
/// <inheritdoc/>
|
/// <inheritdoc/>
|
||||||
public void Write(IEmitter emitter, ObjectSerializer nestedObjectSerializer)
|
public void Write(IEmitter emitter, ObjectSerializer nestedObjectSerializer)
|
||||||
{
|
{
|
||||||
emitter.Emit(new Scalar(this.ToString()));
|
emitter?.Emit(new Scalar(ToString()));
|
||||||
}
|
|
||||||
|
|
||||||
public static implicit operator decimal(ResourceQuantity v)
|
|
||||||
{
|
|
||||||
return v._unitlessValue.ToDecimal();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static implicit operator ResourceQuantity(decimal v)
|
public static implicit operator ResourceQuantity(decimal v)
|
||||||
|
|||||||
@@ -59,7 +59,7 @@ namespace k8s
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public void Start()
|
public void Start()
|
||||||
{
|
{
|
||||||
this.runLoop = Task.Run(async () => await RunLoop(cts.Token).ConfigureAwait(false));
|
runLoop = Task.Run(async () => await RunLoop(cts.Token).ConfigureAwait(false));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -94,16 +94,16 @@ namespace k8s
|
|||||||
/// </returns>
|
/// </returns>
|
||||||
public Stream GetStream(byte? inputIndex, byte? outputIndex)
|
public Stream GetStream(byte? inputIndex, byte? outputIndex)
|
||||||
{
|
{
|
||||||
lock (this.buffers)
|
lock (buffers)
|
||||||
{
|
{
|
||||||
if (inputIndex != null && !this.buffers.ContainsKey(inputIndex.Value))
|
if (inputIndex != null && !buffers.ContainsKey(inputIndex.Value))
|
||||||
{
|
{
|
||||||
var buffer = new ByteBuffer();
|
var buffer = new ByteBuffer();
|
||||||
this.buffers.Add(inputIndex.Value, buffer);
|
buffers.Add(inputIndex.Value, buffer);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
var inputBuffer = inputIndex == null ? null : this.buffers[inputIndex.Value];
|
var inputBuffer = inputIndex == null ? null : buffers[inputIndex.Value];
|
||||||
return new MuxedStream(this, inputBuffer, outputIndex);
|
return new MuxedStream(this, inputBuffer, outputIndex);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -129,7 +129,7 @@ namespace k8s
|
|||||||
/// A <see cref="Task"/> which represents the asynchronous operation.
|
/// A <see cref="Task"/> which represents the asynchronous operation.
|
||||||
/// </returns>
|
/// </returns>
|
||||||
public Task Write(ChannelIndex index, byte[] buffer, int offset, int count,
|
public Task Write(ChannelIndex index, byte[] buffer, int offset, int count,
|
||||||
CancellationToken cancellationToken = default(CancellationToken))
|
CancellationToken cancellationToken = default)
|
||||||
{
|
{
|
||||||
return Write((byte)index, buffer, offset, count, cancellationToken);
|
return Write((byte)index, buffer, offset, count, cancellationToken);
|
||||||
}
|
}
|
||||||
@@ -156,16 +156,16 @@ namespace k8s
|
|||||||
/// A <see cref="Task"/> which represents the asynchronous operation.
|
/// A <see cref="Task"/> which represents the asynchronous operation.
|
||||||
/// </returns>
|
/// </returns>
|
||||||
public async Task Write(byte index, byte[] buffer, int offset, int count,
|
public async Task Write(byte index, byte[] buffer, int offset, int count,
|
||||||
CancellationToken cancellationToken = default(CancellationToken))
|
CancellationToken cancellationToken = default)
|
||||||
{
|
{
|
||||||
byte[] writeBuffer = ArrayPool<byte>.Shared.Rent(count + 1);
|
var writeBuffer = ArrayPool<byte>.Shared.Rent(count + 1);
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
writeBuffer[0] = (byte)index;
|
writeBuffer[0] = (byte)index;
|
||||||
Array.Copy(buffer, offset, writeBuffer, 1, count);
|
Array.Copy(buffer, offset, writeBuffer, 1, count);
|
||||||
ArraySegment<byte> segment = new ArraySegment<byte>(writeBuffer, 0, count + 1);
|
var segment = new ArraySegment<byte>(writeBuffer, 0, count + 1);
|
||||||
await this.webSocket.SendAsync(segment, WebSocketMessageType.Binary, false, cancellationToken)
|
await webSocket.SendAsync(segment, WebSocketMessageType.Binary, false, cancellationToken)
|
||||||
.ConfigureAwait(false);
|
.ConfigureAwait(false);
|
||||||
}
|
}
|
||||||
finally
|
finally
|
||||||
@@ -177,19 +177,19 @@ namespace k8s
|
|||||||
protected async Task RunLoop(CancellationToken cancellationToken)
|
protected async Task RunLoop(CancellationToken cancellationToken)
|
||||||
{
|
{
|
||||||
// Get a 1KB buffer
|
// Get a 1KB buffer
|
||||||
byte[] buffer = ArrayPool<byte>.Shared.Rent(1024 * 1024);
|
var buffer = ArrayPool<byte>.Shared.Rent(1024 * 1024);
|
||||||
// This maps remembers bytes skipped for each stream.
|
// This maps remembers bytes skipped for each stream.
|
||||||
Dictionary<byte, int> streamBytesToSkipMap = new Dictionary<byte, int>();
|
var streamBytesToSkipMap = new Dictionary<byte, int>();
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
var segment = new ArraySegment<byte>(buffer);
|
var segment = new ArraySegment<byte>(buffer);
|
||||||
|
|
||||||
while (!cancellationToken.IsCancellationRequested && this.webSocket.CloseStatus == null)
|
while (!cancellationToken.IsCancellationRequested && webSocket.CloseStatus == null)
|
||||||
{
|
{
|
||||||
// We always get data in this format:
|
// We always get data in this format:
|
||||||
// [stream index] (1 for stdout, 2 for stderr)
|
// [stream index] (1 for stdout, 2 for stderr)
|
||||||
// [payload]
|
// [payload]
|
||||||
var result = await this.webSocket.ReceiveAsync(segment, cancellationToken).ConfigureAwait(false);
|
var result = await webSocket.ReceiveAsync(segment, cancellationToken).ConfigureAwait(false);
|
||||||
|
|
||||||
// Ignore empty messages
|
// Ignore empty messages
|
||||||
if (result.Count < 2)
|
if (result.Count < 2)
|
||||||
@@ -202,15 +202,15 @@ namespace k8s
|
|||||||
|
|
||||||
while (true)
|
while (true)
|
||||||
{
|
{
|
||||||
int bytesToSkip = 0;
|
var bytesToSkip = 0;
|
||||||
if (!streamBytesToSkipMap.TryGetValue(streamIndex, out bytesToSkip))
|
if (!streamBytesToSkipMap.TryGetValue(streamIndex, out bytesToSkip))
|
||||||
{
|
{
|
||||||
// When used in port-forwarding, the first 2 bytes from the web socket is port bytes, skip.
|
// When used in port-forwarding, the first 2 bytes from the web socket is port bytes, skip.
|
||||||
// https://github.com/kubernetes/kubernetes/blob/master/pkg/kubelet/server/portforward/websocket.go
|
// https://github.com/kubernetes/kubernetes/blob/master/pkg/kubelet/server/portforward/websocket.go
|
||||||
bytesToSkip = this.streamType == StreamType.PortForward ? 2 : 0;
|
bytesToSkip = streamType == StreamType.PortForward ? 2 : 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int bytesCount = result.Count - extraByteCount;
|
var bytesCount = result.Count - extraByteCount;
|
||||||
if (bytesToSkip > 0 && bytesToSkip >= bytesCount)
|
if (bytesToSkip > 0 && bytesToSkip >= bytesCount)
|
||||||
{
|
{
|
||||||
// skip the entire data.
|
// skip the entire data.
|
||||||
@@ -224,9 +224,9 @@ namespace k8s
|
|||||||
extraByteCount += bytesToSkip;
|
extraByteCount += bytesToSkip;
|
||||||
bytesToSkip = 0;
|
bytesToSkip = 0;
|
||||||
|
|
||||||
if (this.buffers.ContainsKey(streamIndex))
|
if (buffers.ContainsKey(streamIndex))
|
||||||
{
|
{
|
||||||
this.buffers[streamIndex].Write(buffer, extraByteCount, bytesCount);
|
buffers[streamIndex].Write(buffer, extraByteCount, bytesCount);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -238,21 +238,21 @@ namespace k8s
|
|||||||
}
|
}
|
||||||
|
|
||||||
extraByteCount = 0;
|
extraByteCount = 0;
|
||||||
result = await this.webSocket.ReceiveAsync(segment, cancellationToken).ConfigureAwait(false);
|
result = await webSocket.ReceiveAsync(segment, cancellationToken).ConfigureAwait(false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
finally
|
finally
|
||||||
{
|
{
|
||||||
ArrayPool<byte>.Shared.Return(buffer);
|
ArrayPool<byte>.Shared.Return(buffer);
|
||||||
this.runLoop = null;
|
runLoop = null;
|
||||||
|
|
||||||
foreach (var b in this.buffers.Values)
|
foreach (var b in buffers.Values)
|
||||||
{
|
{
|
||||||
b.WriteEnd();
|
b.WriteEnd();
|
||||||
}
|
}
|
||||||
|
|
||||||
this.ConnectionClosed?.Invoke(this, EventArgs.Empty);
|
ConnectionClosed?.Invoke(this, EventArgs.Empty);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -264,10 +264,11 @@ namespace k8s
|
|||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
if (this.runLoop != null)
|
if (runLoop != null)
|
||||||
{
|
{
|
||||||
this.cts.Cancel();
|
cts.Cancel();
|
||||||
this.runLoop.Wait();
|
cts.Dispose();
|
||||||
|
runLoop.Wait();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
@@ -276,9 +277,9 @@ namespace k8s
|
|||||||
Debug.Write(ex);
|
Debug.Write(ex);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (this.ownsSocket)
|
if (ownsSocket)
|
||||||
{
|
{
|
||||||
this.webSocket.Dispose();
|
webSocket.Dispose();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -296,7 +297,7 @@ namespace k8s
|
|||||||
public void Dispose()
|
public void Dispose()
|
||||||
{
|
{
|
||||||
// Do not change this code. Put cleanup code in 'Dispose(bool disposing)' method
|
// Do not change this code. Put cleanup code in 'Dispose(bool disposing)' method
|
||||||
Dispose(disposing: true);
|
Dispose(true);
|
||||||
GC.SuppressFinalize(this);
|
GC.SuppressFinalize(this);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -21,7 +21,7 @@ namespace k8s
|
|||||||
/// <inheritdoc/>
|
/// <inheritdoc/>
|
||||||
public override void Emit(ScalarEventInfo eventInfo, IEmitter emitter)
|
public override void Emit(ScalarEventInfo eventInfo, IEmitter emitter)
|
||||||
{
|
{
|
||||||
var typeCode = eventInfo.Source.Value != null
|
var typeCode = eventInfo?.Source.Value != null
|
||||||
? Type.GetTypeCode(eventInfo.Source.Type)
|
? Type.GetTypeCode(eventInfo.Source.Type)
|
||||||
: TypeCode.Empty;
|
: TypeCode.Empty;
|
||||||
switch (typeCode)
|
switch (typeCode)
|
||||||
|
|||||||
@@ -5,8 +5,7 @@ namespace k8s
|
|||||||
{
|
{
|
||||||
internal static class Utilities
|
internal static class Utilities
|
||||||
{
|
{
|
||||||
/// <summary>Given a <see cref="StringBuilder"/> that is building a query string, adds a parameter to it.</summary>
|
internal static void AddQueryParameter(StringBuilder sb, string key, string value)
|
||||||
public static void AddQueryParameter(StringBuilder sb, string key, string value)
|
|
||||||
{
|
{
|
||||||
if (sb == null)
|
if (sb == null)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -8,9 +8,24 @@ namespace k8s.Models
|
|||||||
{
|
{
|
||||||
public enum PatchType
|
public enum PatchType
|
||||||
{
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// not set, this is not allowed
|
||||||
|
/// </summary>
|
||||||
Unknown,
|
Unknown,
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// content type application/json-patch+json
|
||||||
|
/// </summary>
|
||||||
JsonPatch,
|
JsonPatch,
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// content type application/merge-patch+json
|
||||||
|
/// </summary>
|
||||||
MergePatch,
|
MergePatch,
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// content type application/strategic-merge-patch+json
|
||||||
|
/// </summary>
|
||||||
StrategicMergePatch,
|
StrategicMergePatch,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -8,9 +8,9 @@ namespace k8s.Models
|
|||||||
public override void WriteJson(JsonWriter writer, object value, JsonSerializer serializer)
|
public override void WriteJson(JsonWriter writer, object value, JsonSerializer serializer)
|
||||||
{
|
{
|
||||||
var content = (value as V1Patch)?.Content;
|
var content = (value as V1Patch)?.Content;
|
||||||
if (content is String || content is string)
|
if (content is string s)
|
||||||
{
|
{
|
||||||
writer.WriteRaw((string)content);
|
writer.WriteRaw(s);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -5,9 +5,10 @@ namespace k8s.Models
|
|||||||
public partial class V1Status
|
public partial class V1Status
|
||||||
{
|
{
|
||||||
/// <summary>Converts a <see cref="V1Status"/> object into a short description of the status.</summary>
|
/// <summary>Converts a <see cref="V1Status"/> object into a short description of the status.</summary>
|
||||||
|
/// <returns>string description of the status</returns>
|
||||||
public override string ToString()
|
public override string ToString()
|
||||||
{
|
{
|
||||||
string reason = Reason;
|
var reason = Reason;
|
||||||
if (string.IsNullOrEmpty(reason) && Code.GetValueOrDefault() != 0)
|
if (string.IsNullOrEmpty(reason) && Code.GetValueOrDefault() != 0)
|
||||||
{
|
{
|
||||||
reason = ((HttpStatusCode)Code.Value).ToString();
|
reason = ((HttpStatusCode)Code.Value).ToString();
|
||||||
|
|||||||
@@ -45,7 +45,7 @@ namespace k8s.Versioning
|
|||||||
stream = Stream.Final;
|
stream = Stream.Final;
|
||||||
}
|
}
|
||||||
|
|
||||||
int.TryParse(match.Groups["minor"].Value, out var minor);
|
_ = int.TryParse(match.Groups["minor"].Value, out var minor);
|
||||||
return new Version(major, (int)stream, minor);
|
return new Version(major, (int)stream, minor);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -66,6 +66,11 @@ namespace k8s.Versioning
|
|||||||
|
|
||||||
public static object ConvertToVersion(object source, string apiVersion)
|
public static object ConvertToVersion(object source, string apiVersion)
|
||||||
{
|
{
|
||||||
|
if (source == null)
|
||||||
|
{
|
||||||
|
throw new ArgumentNullException(nameof(source));
|
||||||
|
}
|
||||||
|
|
||||||
var type = source.GetType();
|
var type = source.GetType();
|
||||||
var attr = GetKubernetesEntityAttribute(type);
|
var attr = GetKubernetesEntityAttribute(type);
|
||||||
if (attr.ApiVersion == apiVersion)
|
if (attr.ApiVersion == apiVersion)
|
||||||
|
|||||||
@@ -53,7 +53,7 @@ namespace k8s
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// Initializes a new instance of the <see cref="Watcher{T}"/> class.
|
/// Initializes a new instance of the <see cref="Watcher{T}"/> class.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="streamReader">
|
/// <param name="streamReaderCreator">
|
||||||
/// A <see cref="StreamReader"/> from which to read the events.
|
/// A <see cref="StreamReader"/> from which to read the events.
|
||||||
/// </param>
|
/// </param>
|
||||||
/// <param name="onEvent">
|
/// <param name="onEvent">
|
||||||
@@ -76,8 +76,8 @@ namespace k8s
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// Initializes a new instance of the <see cref="Watcher{T}"/> class.
|
/// Initializes a new instance of the <see cref="Watcher{T}"/> class.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="streamReader">
|
/// <param name="streamReaderCreator">
|
||||||
/// A <see cref="StreamReader"/> from which to read the events.
|
/// A <see cref="TextReader"/> from which to read the events.
|
||||||
/// </param>
|
/// </param>
|
||||||
/// <param name="onEvent">
|
/// <param name="onEvent">
|
||||||
/// The action to invoke when the server sends a new event.
|
/// The action to invoke when the server sends a new event.
|
||||||
@@ -141,18 +141,18 @@ namespace k8s
|
|||||||
try
|
try
|
||||||
{
|
{
|
||||||
var genericEvent =
|
var genericEvent =
|
||||||
SafeJsonConvert.DeserializeObject<k8s.Watcher<KubernetesObject>.WatchEvent>(line);
|
SafeJsonConvert.DeserializeObject<Watcher<KubernetesObject>.WatchEvent>(line);
|
||||||
|
|
||||||
if (genericEvent.Object.Kind == "Status")
|
if (genericEvent.Object.Kind == "Status")
|
||||||
{
|
{
|
||||||
var statusEvent = SafeJsonConvert.DeserializeObject<k8s.Watcher<V1Status>.WatchEvent>(line);
|
var statusEvent = SafeJsonConvert.DeserializeObject<Watcher<V1Status>.WatchEvent>(line);
|
||||||
var exception = new KubernetesException(statusEvent.Object);
|
var exception = new KubernetesException(statusEvent.Object);
|
||||||
this.OnError?.Invoke(exception);
|
OnError?.Invoke(exception);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
var @event = SafeJsonConvert.DeserializeObject<k8s.Watcher<T>.WatchEvent>(line);
|
var @event = SafeJsonConvert.DeserializeObject<WatchEvent>(line);
|
||||||
this.OnEvent?.Invoke(@event.Type, @event.Object);
|
OnEvent?.Invoke(@event.Type, @event.Object);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
@@ -180,7 +180,8 @@ namespace k8s
|
|||||||
{
|
{
|
||||||
if (disposing)
|
if (disposing)
|
||||||
{
|
{
|
||||||
_cts.Cancel();
|
_cts?.Cancel();
|
||||||
|
_cts?.Dispose();
|
||||||
_streamReader?.Dispose();
|
_streamReader?.Dispose();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -198,7 +199,7 @@ namespace k8s
|
|||||||
public void Dispose()
|
public void Dispose()
|
||||||
{
|
{
|
||||||
// Do not change this code. Put cleanup code in 'Dispose(bool disposing)' method
|
// Do not change this code. Put cleanup code in 'Dispose(bool disposing)' method
|
||||||
Dispose(disposing: true);
|
Dispose(true);
|
||||||
GC.SuppressFinalize(this);
|
GC.SuppressFinalize(this);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -23,8 +23,8 @@ namespace k8s
|
|||||||
// all watches are GETs, so we can ignore others
|
// all watches are GETs, so we can ignore others
|
||||||
if (originResponse.IsSuccessStatusCode && request.Method == HttpMethod.Get)
|
if (originResponse.IsSuccessStatusCode && request.Method == HttpMethod.Get)
|
||||||
{
|
{
|
||||||
string query = request.RequestUri.Query;
|
var query = request.RequestUri.Query;
|
||||||
int index = query.IndexOf("watch=true");
|
var index = query.IndexOf("watch=true", StringComparison.InvariantCulture);
|
||||||
if (index > 0 && (query[index - 1] == '&' || query[index - 1] == '?'))
|
if (index > 0 && (query[index - 1] == '&' || query[index - 1] == '?'))
|
||||||
{
|
{
|
||||||
originResponse.Content = new LineSeparatedHttpContent(originResponse.Content, cancellationToken);
|
originResponse.Content = new LineSeparatedHttpContent(originResponse.Content, cancellationToken);
|
||||||
|
|||||||
@@ -12,7 +12,7 @@ namespace k8s
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
/// <typeparam name="T">type of the event object</typeparam>
|
/// <typeparam name="T">type of the event object</typeparam>
|
||||||
/// <typeparam name="L">type of the HttpOperationResponse object</typeparam>
|
/// <typeparam name="L">type of the HttpOperationResponse object</typeparam>
|
||||||
/// <param name="response">the api response</param>
|
/// <param name="responseTask">the api response</param>
|
||||||
/// <param name="onEvent">a callback when any event raised from api server</param>
|
/// <param name="onEvent">a callback when any event raised from api server</param>
|
||||||
/// <param name="onError">a callbak when any exception was caught during watching</param>
|
/// <param name="onError">a callbak when any exception was caught during watching</param>
|
||||||
/// <param name="onClosed">
|
/// <param name="onClosed">
|
||||||
|
|||||||
@@ -28,13 +28,13 @@ namespace k8s
|
|||||||
|
|
||||||
public virtual WebSocketBuilder SetRequestHeader(string headerName, string headerValue)
|
public virtual WebSocketBuilder SetRequestHeader(string headerName, string headerValue)
|
||||||
{
|
{
|
||||||
this.WebSocket.Options.SetRequestHeader(headerName, headerValue);
|
WebSocket.Options.SetRequestHeader(headerName, headerValue);
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
public virtual WebSocketBuilder AddClientCertificate(X509Certificate2 certificate)
|
public virtual WebSocketBuilder AddClientCertificate(X509Certificate2 certificate)
|
||||||
{
|
{
|
||||||
this.WebSocket.Options.ClientCertificates.Add(certificate);
|
WebSocket.Options.ClientCertificates.Add(certificate);
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -76,8 +76,8 @@ namespace k8s
|
|||||||
|
|
||||||
public virtual async Task<WebSocket> BuildAndConnectAsync(Uri uri, CancellationToken cancellationToken)
|
public virtual async Task<WebSocket> BuildAndConnectAsync(Uri uri, CancellationToken cancellationToken)
|
||||||
{
|
{
|
||||||
await this.WebSocket.ConnectAsync(uri, cancellationToken).ConfigureAwait(false);
|
await WebSocket.ConnectAsync(uri, cancellationToken).ConfigureAwait(false);
|
||||||
return this.WebSocket;
|
return WebSocket;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -27,7 +27,7 @@ namespace k8s
|
|||||||
|
|
||||||
public object ReadYaml(IParser parser, Type type)
|
public object ReadYaml(IParser parser, Type type)
|
||||||
{
|
{
|
||||||
if (parser.Current is YamlDotNet.Core.Events.Scalar scalar)
|
if (parser?.Current is Scalar scalar)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
@@ -50,7 +50,7 @@ namespace k8s
|
|||||||
public void WriteYaml(IEmitter emitter, object value, Type type)
|
public void WriteYaml(IEmitter emitter, object value, Type type)
|
||||||
{
|
{
|
||||||
var obj = (byte[])value;
|
var obj = (byte[])value;
|
||||||
emitter.Emit(new YamlDotNet.Core.Events.Scalar(Encoding.UTF8.GetString(obj)));
|
emitter?.Emit(new Scalar(Encoding.UTF8.GetString(obj)));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -61,8 +61,9 @@ namespace k8s
|
|||||||
/// The stream to load the objects from.
|
/// The stream to load the objects from.
|
||||||
/// </param>
|
/// </param>
|
||||||
/// <param name="typeMap">
|
/// <param name="typeMap">
|
||||||
/// A map from <apiVersion>/<kind> to Type. For example "v1/Pod" -> typeof(V1Pod)
|
/// A map from apiVersion/kind to Type. For example "v1/Pod" -> typeof(V1Pod)
|
||||||
/// </param>
|
/// </param>
|
||||||
|
/// <returns>collection of objects</returns>
|
||||||
public static async Task<List<object>> LoadAllFromStreamAsync(Stream stream, Dictionary<string, Type> typeMap)
|
public static async Task<List<object>> LoadAllFromStreamAsync(Stream stream, Dictionary<string, Type> typeMap)
|
||||||
{
|
{
|
||||||
var reader = new StreamReader(stream);
|
var reader = new StreamReader(stream);
|
||||||
@@ -70,15 +71,13 @@ namespace k8s
|
|||||||
return LoadAllFromString(content, typeMap);
|
return LoadAllFromString(content, typeMap);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Load a collection of objects from a file asynchronously
|
/// Load a collection of objects from a file asynchronously
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="fileName">
|
/// <param name="fileName">The name of the file to load from.</param>
|
||||||
/// The name of the file to load from.
|
/// <param name="typeMap">A map from apiVersion/kind to Type. For example "v1/Pod" -> typeof(V1Pod)</param>
|
||||||
/// </param>
|
/// <returns>collection of objects</returns>
|
||||||
/// <param name="typeMap">
|
|
||||||
/// A map from <apiVersion>/<kind> to Type. For example "v1/Pod" -> typeof(V1Pod)
|
|
||||||
/// </param>
|
|
||||||
public static Task<List<object>> LoadAllFromFileAsync(string fileName, Dictionary<string, Type> typeMap)
|
public static Task<List<object>> LoadAllFromFileAsync(string fileName, Dictionary<string, Type> typeMap)
|
||||||
{
|
{
|
||||||
var reader = File.OpenRead(fileName);
|
var reader = File.OpenRead(fileName);
|
||||||
@@ -92,13 +91,19 @@ namespace k8s
|
|||||||
/// The string to load the objects from.
|
/// The string to load the objects from.
|
||||||
/// </param>
|
/// </param>
|
||||||
/// <param name="typeMap">
|
/// <param name="typeMap">
|
||||||
/// A map from <apiVersion>/<kind> to Type. For example "v1/Pod" -> typeof(V1Pod)
|
/// A map from apiVersion/kind to Type. For example "v1/Pod" -> typeof(V1Pod)
|
||||||
/// </param>
|
/// </param>
|
||||||
|
/// <returns>collection of objects</returns>
|
||||||
public static List<object> LoadAllFromString(string content, Dictionary<string, Type> typeMap)
|
public static List<object> LoadAllFromString(string content, Dictionary<string, Type> typeMap)
|
||||||
{
|
{
|
||||||
|
if (typeMap == null)
|
||||||
|
{
|
||||||
|
throw new ArgumentNullException(nameof(typeMap));
|
||||||
|
}
|
||||||
|
|
||||||
var deserializer =
|
var deserializer =
|
||||||
new DeserializerBuilder()
|
new DeserializerBuilder()
|
||||||
.WithNamingConvention(new CamelCaseNamingConvention())
|
.WithNamingConvention(CamelCaseNamingConvention.Instance)
|
||||||
.WithTypeInspector(ti => new AutoRestTypeInspector(ti))
|
.WithTypeInspector(ti => new AutoRestTypeInspector(ti))
|
||||||
.WithTypeConverter(new IntOrStringYamlConverter())
|
.WithTypeConverter(new IntOrStringYamlConverter())
|
||||||
.WithTypeConverter(new ByteArrayStringYamlConverter())
|
.WithTypeConverter(new ByteArrayStringYamlConverter())
|
||||||
@@ -106,8 +111,8 @@ namespace k8s
|
|||||||
.Build();
|
.Build();
|
||||||
var types = new List<Type>();
|
var types = new List<Type>();
|
||||||
var parser = new Parser(new StringReader(content));
|
var parser = new Parser(new StringReader(content));
|
||||||
parser.Expect<StreamStart>();
|
parser.Consume<StreamStart>();
|
||||||
while (parser.Accept<DocumentStart>())
|
while (parser.Accept<DocumentStart>(out _))
|
||||||
{
|
{
|
||||||
var obj = deserializer.Deserialize<KubernetesObject>(parser);
|
var obj = deserializer.Deserialize<KubernetesObject>(parser);
|
||||||
types.Add(typeMap[obj.ApiVersion + "/" + obj.Kind]);
|
types.Add(typeMap[obj.ApiVersion + "/" + obj.Kind]);
|
||||||
@@ -115,16 +120,16 @@ namespace k8s
|
|||||||
|
|
||||||
deserializer =
|
deserializer =
|
||||||
new DeserializerBuilder()
|
new DeserializerBuilder()
|
||||||
.WithNamingConvention(new CamelCaseNamingConvention())
|
.WithNamingConvention(CamelCaseNamingConvention.Instance)
|
||||||
.WithTypeInspector(ti => new AutoRestTypeInspector(ti))
|
.WithTypeInspector(ti => new AutoRestTypeInspector(ti))
|
||||||
.WithTypeConverter(new IntOrStringYamlConverter())
|
.WithTypeConverter(new IntOrStringYamlConverter())
|
||||||
.WithTypeConverter(new ByteArrayStringYamlConverter())
|
.WithTypeConverter(new ByteArrayStringYamlConverter())
|
||||||
.Build();
|
.Build();
|
||||||
parser = new Parser(new StringReader(content));
|
parser = new Parser(new StringReader(content));
|
||||||
parser.Expect<StreamStart>();
|
parser.Consume<StreamStart>();
|
||||||
var ix = 0;
|
var ix = 0;
|
||||||
var results = new List<object>();
|
var results = new List<object>();
|
||||||
while (parser.Accept<DocumentStart>())
|
while (parser.Accept<DocumentStart>(out _))
|
||||||
{
|
{
|
||||||
var objType = types[ix++];
|
var objType = types[ix++];
|
||||||
var obj = deserializer.Deserialize(parser, objType);
|
var obj = deserializer.Deserialize(parser, objType);
|
||||||
@@ -143,7 +148,7 @@ namespace k8s
|
|||||||
|
|
||||||
public static async Task<T> LoadFromFileAsync<T>(string file)
|
public static async Task<T> LoadFromFileAsync<T>(string file)
|
||||||
{
|
{
|
||||||
using (FileStream fs = File.OpenRead(file))
|
using (var fs = File.OpenRead(file))
|
||||||
{
|
{
|
||||||
return await LoadFromStreamAsync<T>(fs).ConfigureAwait(false);
|
return await LoadFromStreamAsync<T>(fs).ConfigureAwait(false);
|
||||||
}
|
}
|
||||||
@@ -153,7 +158,7 @@ namespace k8s
|
|||||||
{
|
{
|
||||||
var deserializer =
|
var deserializer =
|
||||||
new DeserializerBuilder()
|
new DeserializerBuilder()
|
||||||
.WithNamingConvention(new CamelCaseNamingConvention())
|
.WithNamingConvention(CamelCaseNamingConvention.Instance)
|
||||||
.WithTypeInspector(ti => new AutoRestTypeInspector(ti))
|
.WithTypeInspector(ti => new AutoRestTypeInspector(ti))
|
||||||
.WithTypeConverter(new IntOrStringYamlConverter())
|
.WithTypeConverter(new IntOrStringYamlConverter())
|
||||||
.WithTypeConverter(new ByteArrayStringYamlConverter())
|
.WithTypeConverter(new ByteArrayStringYamlConverter())
|
||||||
@@ -171,7 +176,7 @@ namespace k8s
|
|||||||
var serializer =
|
var serializer =
|
||||||
new SerializerBuilder()
|
new SerializerBuilder()
|
||||||
.DisableAliases()
|
.DisableAliases()
|
||||||
.WithNamingConvention(new CamelCaseNamingConvention())
|
.WithNamingConvention(CamelCaseNamingConvention.Instance)
|
||||||
.WithTypeInspector(ti => new AutoRestTypeInspector(ti))
|
.WithTypeInspector(ti => new AutoRestTypeInspector(ti))
|
||||||
.WithTypeConverter(new IntOrStringYamlConverter())
|
.WithTypeConverter(new IntOrStringYamlConverter())
|
||||||
.WithTypeConverter(new ByteArrayStringYamlConverter())
|
.WithTypeConverter(new ByteArrayStringYamlConverter())
|
||||||
@@ -214,7 +219,7 @@ namespace k8s
|
|||||||
|
|
||||||
private IPropertyDescriptor TrimPropertySuffix(IPropertyDescriptor pd, Type type)
|
private IPropertyDescriptor TrimPropertySuffix(IPropertyDescriptor pd, Type type)
|
||||||
{
|
{
|
||||||
if (!pd.Name.EndsWith("Property"))
|
if (!pd.Name.EndsWith("Property", StringComparison.InvariantCulture))
|
||||||
{
|
{
|
||||||
return pd;
|
return pd;
|
||||||
}
|
}
|
||||||
|
|||||||
156
src/KubernetesClient/generated/Kubernetes.Watch.cs
generated
156
src/KubernetesClient/generated/Kubernetes.Watch.cs
generated
@@ -13,7 +13,7 @@ namespace k8s
|
|||||||
{
|
{
|
||||||
public partial class Kubernetes
|
public partial class Kubernetes
|
||||||
{
|
{
|
||||||
/// <inheritdoc>
|
/// <inheritdoc/>
|
||||||
public Task<Watcher<V1ConfigMap>> WatchNamespacedConfigMapAsync(
|
public Task<Watcher<V1ConfigMap>> WatchNamespacedConfigMapAsync(
|
||||||
string name,
|
string name,
|
||||||
string @namespace,
|
string @namespace,
|
||||||
@@ -37,7 +37,7 @@ namespace k8s
|
|||||||
return WatchObjectAsync<V1ConfigMap>(path: path, @continue: @continue, fieldSelector: fieldSelector, labelSelector: labelSelector, limit: limit, pretty: pretty, timeoutSeconds: timeoutSeconds, resourceVersion: resourceVersion, customHeaders: customHeaders, onEvent: onEvent, onError: onError, onClosed: onClosed, cancellationToken: cancellationToken);
|
return WatchObjectAsync<V1ConfigMap>(path: path, @continue: @continue, fieldSelector: fieldSelector, labelSelector: labelSelector, limit: limit, pretty: pretty, timeoutSeconds: timeoutSeconds, resourceVersion: resourceVersion, customHeaders: customHeaders, onEvent: onEvent, onError: onError, onClosed: onClosed, cancellationToken: cancellationToken);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <inheritdoc>
|
/// <inheritdoc/>
|
||||||
public Task<Watcher<V1Endpoints>> WatchNamespacedEndpointsAsync(
|
public Task<Watcher<V1Endpoints>> WatchNamespacedEndpointsAsync(
|
||||||
string name,
|
string name,
|
||||||
string @namespace,
|
string @namespace,
|
||||||
@@ -61,7 +61,7 @@ namespace k8s
|
|||||||
return WatchObjectAsync<V1Endpoints>(path: path, @continue: @continue, fieldSelector: fieldSelector, labelSelector: labelSelector, limit: limit, pretty: pretty, timeoutSeconds: timeoutSeconds, resourceVersion: resourceVersion, customHeaders: customHeaders, onEvent: onEvent, onError: onError, onClosed: onClosed, cancellationToken: cancellationToken);
|
return WatchObjectAsync<V1Endpoints>(path: path, @continue: @continue, fieldSelector: fieldSelector, labelSelector: labelSelector, limit: limit, pretty: pretty, timeoutSeconds: timeoutSeconds, resourceVersion: resourceVersion, customHeaders: customHeaders, onEvent: onEvent, onError: onError, onClosed: onClosed, cancellationToken: cancellationToken);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <inheritdoc>
|
/// <inheritdoc/>
|
||||||
public Task<Watcher<Corev1Event>> WatchNamespacedEventAsync(
|
public Task<Watcher<Corev1Event>> WatchNamespacedEventAsync(
|
||||||
string name,
|
string name,
|
||||||
string @namespace,
|
string @namespace,
|
||||||
@@ -85,7 +85,7 @@ namespace k8s
|
|||||||
return WatchObjectAsync<Corev1Event>(path: path, @continue: @continue, fieldSelector: fieldSelector, labelSelector: labelSelector, limit: limit, pretty: pretty, timeoutSeconds: timeoutSeconds, resourceVersion: resourceVersion, customHeaders: customHeaders, onEvent: onEvent, onError: onError, onClosed: onClosed, cancellationToken: cancellationToken);
|
return WatchObjectAsync<Corev1Event>(path: path, @continue: @continue, fieldSelector: fieldSelector, labelSelector: labelSelector, limit: limit, pretty: pretty, timeoutSeconds: timeoutSeconds, resourceVersion: resourceVersion, customHeaders: customHeaders, onEvent: onEvent, onError: onError, onClosed: onClosed, cancellationToken: cancellationToken);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <inheritdoc>
|
/// <inheritdoc/>
|
||||||
public Task<Watcher<V1LimitRange>> WatchNamespacedLimitRangeAsync(
|
public Task<Watcher<V1LimitRange>> WatchNamespacedLimitRangeAsync(
|
||||||
string name,
|
string name,
|
||||||
string @namespace,
|
string @namespace,
|
||||||
@@ -109,7 +109,7 @@ namespace k8s
|
|||||||
return WatchObjectAsync<V1LimitRange>(path: path, @continue: @continue, fieldSelector: fieldSelector, labelSelector: labelSelector, limit: limit, pretty: pretty, timeoutSeconds: timeoutSeconds, resourceVersion: resourceVersion, customHeaders: customHeaders, onEvent: onEvent, onError: onError, onClosed: onClosed, cancellationToken: cancellationToken);
|
return WatchObjectAsync<V1LimitRange>(path: path, @continue: @continue, fieldSelector: fieldSelector, labelSelector: labelSelector, limit: limit, pretty: pretty, timeoutSeconds: timeoutSeconds, resourceVersion: resourceVersion, customHeaders: customHeaders, onEvent: onEvent, onError: onError, onClosed: onClosed, cancellationToken: cancellationToken);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <inheritdoc>
|
/// <inheritdoc/>
|
||||||
public Task<Watcher<V1PersistentVolumeClaim>> WatchNamespacedPersistentVolumeClaimAsync(
|
public Task<Watcher<V1PersistentVolumeClaim>> WatchNamespacedPersistentVolumeClaimAsync(
|
||||||
string name,
|
string name,
|
||||||
string @namespace,
|
string @namespace,
|
||||||
@@ -133,7 +133,7 @@ namespace k8s
|
|||||||
return WatchObjectAsync<V1PersistentVolumeClaim>(path: path, @continue: @continue, fieldSelector: fieldSelector, labelSelector: labelSelector, limit: limit, pretty: pretty, timeoutSeconds: timeoutSeconds, resourceVersion: resourceVersion, customHeaders: customHeaders, onEvent: onEvent, onError: onError, onClosed: onClosed, cancellationToken: cancellationToken);
|
return WatchObjectAsync<V1PersistentVolumeClaim>(path: path, @continue: @continue, fieldSelector: fieldSelector, labelSelector: labelSelector, limit: limit, pretty: pretty, timeoutSeconds: timeoutSeconds, resourceVersion: resourceVersion, customHeaders: customHeaders, onEvent: onEvent, onError: onError, onClosed: onClosed, cancellationToken: cancellationToken);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <inheritdoc>
|
/// <inheritdoc/>
|
||||||
public Task<Watcher<V1Pod>> WatchNamespacedPodAsync(
|
public Task<Watcher<V1Pod>> WatchNamespacedPodAsync(
|
||||||
string name,
|
string name,
|
||||||
string @namespace,
|
string @namespace,
|
||||||
@@ -157,7 +157,7 @@ namespace k8s
|
|||||||
return WatchObjectAsync<V1Pod>(path: path, @continue: @continue, fieldSelector: fieldSelector, labelSelector: labelSelector, limit: limit, pretty: pretty, timeoutSeconds: timeoutSeconds, resourceVersion: resourceVersion, customHeaders: customHeaders, onEvent: onEvent, onError: onError, onClosed: onClosed, cancellationToken: cancellationToken);
|
return WatchObjectAsync<V1Pod>(path: path, @continue: @continue, fieldSelector: fieldSelector, labelSelector: labelSelector, limit: limit, pretty: pretty, timeoutSeconds: timeoutSeconds, resourceVersion: resourceVersion, customHeaders: customHeaders, onEvent: onEvent, onError: onError, onClosed: onClosed, cancellationToken: cancellationToken);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <inheritdoc>
|
/// <inheritdoc/>
|
||||||
public Task<Watcher<V1PodTemplate>> WatchNamespacedPodTemplateAsync(
|
public Task<Watcher<V1PodTemplate>> WatchNamespacedPodTemplateAsync(
|
||||||
string name,
|
string name,
|
||||||
string @namespace,
|
string @namespace,
|
||||||
@@ -181,7 +181,7 @@ namespace k8s
|
|||||||
return WatchObjectAsync<V1PodTemplate>(path: path, @continue: @continue, fieldSelector: fieldSelector, labelSelector: labelSelector, limit: limit, pretty: pretty, timeoutSeconds: timeoutSeconds, resourceVersion: resourceVersion, customHeaders: customHeaders, onEvent: onEvent, onError: onError, onClosed: onClosed, cancellationToken: cancellationToken);
|
return WatchObjectAsync<V1PodTemplate>(path: path, @continue: @continue, fieldSelector: fieldSelector, labelSelector: labelSelector, limit: limit, pretty: pretty, timeoutSeconds: timeoutSeconds, resourceVersion: resourceVersion, customHeaders: customHeaders, onEvent: onEvent, onError: onError, onClosed: onClosed, cancellationToken: cancellationToken);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <inheritdoc>
|
/// <inheritdoc/>
|
||||||
public Task<Watcher<V1ReplicationController>> WatchNamespacedReplicationControllerAsync(
|
public Task<Watcher<V1ReplicationController>> WatchNamespacedReplicationControllerAsync(
|
||||||
string name,
|
string name,
|
||||||
string @namespace,
|
string @namespace,
|
||||||
@@ -205,7 +205,7 @@ namespace k8s
|
|||||||
return WatchObjectAsync<V1ReplicationController>(path: path, @continue: @continue, fieldSelector: fieldSelector, labelSelector: labelSelector, limit: limit, pretty: pretty, timeoutSeconds: timeoutSeconds, resourceVersion: resourceVersion, customHeaders: customHeaders, onEvent: onEvent, onError: onError, onClosed: onClosed, cancellationToken: cancellationToken);
|
return WatchObjectAsync<V1ReplicationController>(path: path, @continue: @continue, fieldSelector: fieldSelector, labelSelector: labelSelector, limit: limit, pretty: pretty, timeoutSeconds: timeoutSeconds, resourceVersion: resourceVersion, customHeaders: customHeaders, onEvent: onEvent, onError: onError, onClosed: onClosed, cancellationToken: cancellationToken);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <inheritdoc>
|
/// <inheritdoc/>
|
||||||
public Task<Watcher<V1ResourceQuota>> WatchNamespacedResourceQuotaAsync(
|
public Task<Watcher<V1ResourceQuota>> WatchNamespacedResourceQuotaAsync(
|
||||||
string name,
|
string name,
|
||||||
string @namespace,
|
string @namespace,
|
||||||
@@ -229,7 +229,7 @@ namespace k8s
|
|||||||
return WatchObjectAsync<V1ResourceQuota>(path: path, @continue: @continue, fieldSelector: fieldSelector, labelSelector: labelSelector, limit: limit, pretty: pretty, timeoutSeconds: timeoutSeconds, resourceVersion: resourceVersion, customHeaders: customHeaders, onEvent: onEvent, onError: onError, onClosed: onClosed, cancellationToken: cancellationToken);
|
return WatchObjectAsync<V1ResourceQuota>(path: path, @continue: @continue, fieldSelector: fieldSelector, labelSelector: labelSelector, limit: limit, pretty: pretty, timeoutSeconds: timeoutSeconds, resourceVersion: resourceVersion, customHeaders: customHeaders, onEvent: onEvent, onError: onError, onClosed: onClosed, cancellationToken: cancellationToken);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <inheritdoc>
|
/// <inheritdoc/>
|
||||||
public Task<Watcher<V1Secret>> WatchNamespacedSecretAsync(
|
public Task<Watcher<V1Secret>> WatchNamespacedSecretAsync(
|
||||||
string name,
|
string name,
|
||||||
string @namespace,
|
string @namespace,
|
||||||
@@ -253,7 +253,7 @@ namespace k8s
|
|||||||
return WatchObjectAsync<V1Secret>(path: path, @continue: @continue, fieldSelector: fieldSelector, labelSelector: labelSelector, limit: limit, pretty: pretty, timeoutSeconds: timeoutSeconds, resourceVersion: resourceVersion, customHeaders: customHeaders, onEvent: onEvent, onError: onError, onClosed: onClosed, cancellationToken: cancellationToken);
|
return WatchObjectAsync<V1Secret>(path: path, @continue: @continue, fieldSelector: fieldSelector, labelSelector: labelSelector, limit: limit, pretty: pretty, timeoutSeconds: timeoutSeconds, resourceVersion: resourceVersion, customHeaders: customHeaders, onEvent: onEvent, onError: onError, onClosed: onClosed, cancellationToken: cancellationToken);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <inheritdoc>
|
/// <inheritdoc/>
|
||||||
public Task<Watcher<V1ServiceAccount>> WatchNamespacedServiceAccountAsync(
|
public Task<Watcher<V1ServiceAccount>> WatchNamespacedServiceAccountAsync(
|
||||||
string name,
|
string name,
|
||||||
string @namespace,
|
string @namespace,
|
||||||
@@ -277,7 +277,7 @@ namespace k8s
|
|||||||
return WatchObjectAsync<V1ServiceAccount>(path: path, @continue: @continue, fieldSelector: fieldSelector, labelSelector: labelSelector, limit: limit, pretty: pretty, timeoutSeconds: timeoutSeconds, resourceVersion: resourceVersion, customHeaders: customHeaders, onEvent: onEvent, onError: onError, onClosed: onClosed, cancellationToken: cancellationToken);
|
return WatchObjectAsync<V1ServiceAccount>(path: path, @continue: @continue, fieldSelector: fieldSelector, labelSelector: labelSelector, limit: limit, pretty: pretty, timeoutSeconds: timeoutSeconds, resourceVersion: resourceVersion, customHeaders: customHeaders, onEvent: onEvent, onError: onError, onClosed: onClosed, cancellationToken: cancellationToken);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <inheritdoc>
|
/// <inheritdoc/>
|
||||||
public Task<Watcher<V1Service>> WatchNamespacedServiceAsync(
|
public Task<Watcher<V1Service>> WatchNamespacedServiceAsync(
|
||||||
string name,
|
string name,
|
||||||
string @namespace,
|
string @namespace,
|
||||||
@@ -301,7 +301,7 @@ namespace k8s
|
|||||||
return WatchObjectAsync<V1Service>(path: path, @continue: @continue, fieldSelector: fieldSelector, labelSelector: labelSelector, limit: limit, pretty: pretty, timeoutSeconds: timeoutSeconds, resourceVersion: resourceVersion, customHeaders: customHeaders, onEvent: onEvent, onError: onError, onClosed: onClosed, cancellationToken: cancellationToken);
|
return WatchObjectAsync<V1Service>(path: path, @continue: @continue, fieldSelector: fieldSelector, labelSelector: labelSelector, limit: limit, pretty: pretty, timeoutSeconds: timeoutSeconds, resourceVersion: resourceVersion, customHeaders: customHeaders, onEvent: onEvent, onError: onError, onClosed: onClosed, cancellationToken: cancellationToken);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <inheritdoc>
|
/// <inheritdoc/>
|
||||||
public Task<Watcher<V1Namespace>> WatchNamespaceAsync(
|
public Task<Watcher<V1Namespace>> WatchNamespaceAsync(
|
||||||
string name,
|
string name,
|
||||||
bool? allowWatchBookmarks = null,
|
bool? allowWatchBookmarks = null,
|
||||||
@@ -324,7 +324,7 @@ namespace k8s
|
|||||||
return WatchObjectAsync<V1Namespace>(path: path, @continue: @continue, fieldSelector: fieldSelector, labelSelector: labelSelector, limit: limit, pretty: pretty, timeoutSeconds: timeoutSeconds, resourceVersion: resourceVersion, customHeaders: customHeaders, onEvent: onEvent, onError: onError, onClosed: onClosed, cancellationToken: cancellationToken);
|
return WatchObjectAsync<V1Namespace>(path: path, @continue: @continue, fieldSelector: fieldSelector, labelSelector: labelSelector, limit: limit, pretty: pretty, timeoutSeconds: timeoutSeconds, resourceVersion: resourceVersion, customHeaders: customHeaders, onEvent: onEvent, onError: onError, onClosed: onClosed, cancellationToken: cancellationToken);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <inheritdoc>
|
/// <inheritdoc/>
|
||||||
public Task<Watcher<V1Node>> WatchNodeAsync(
|
public Task<Watcher<V1Node>> WatchNodeAsync(
|
||||||
string name,
|
string name,
|
||||||
bool? allowWatchBookmarks = null,
|
bool? allowWatchBookmarks = null,
|
||||||
@@ -347,7 +347,7 @@ namespace k8s
|
|||||||
return WatchObjectAsync<V1Node>(path: path, @continue: @continue, fieldSelector: fieldSelector, labelSelector: labelSelector, limit: limit, pretty: pretty, timeoutSeconds: timeoutSeconds, resourceVersion: resourceVersion, customHeaders: customHeaders, onEvent: onEvent, onError: onError, onClosed: onClosed, cancellationToken: cancellationToken);
|
return WatchObjectAsync<V1Node>(path: path, @continue: @continue, fieldSelector: fieldSelector, labelSelector: labelSelector, limit: limit, pretty: pretty, timeoutSeconds: timeoutSeconds, resourceVersion: resourceVersion, customHeaders: customHeaders, onEvent: onEvent, onError: onError, onClosed: onClosed, cancellationToken: cancellationToken);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <inheritdoc>
|
/// <inheritdoc/>
|
||||||
public Task<Watcher<V1PersistentVolume>> WatchPersistentVolumeAsync(
|
public Task<Watcher<V1PersistentVolume>> WatchPersistentVolumeAsync(
|
||||||
string name,
|
string name,
|
||||||
bool? allowWatchBookmarks = null,
|
bool? allowWatchBookmarks = null,
|
||||||
@@ -370,7 +370,7 @@ namespace k8s
|
|||||||
return WatchObjectAsync<V1PersistentVolume>(path: path, @continue: @continue, fieldSelector: fieldSelector, labelSelector: labelSelector, limit: limit, pretty: pretty, timeoutSeconds: timeoutSeconds, resourceVersion: resourceVersion, customHeaders: customHeaders, onEvent: onEvent, onError: onError, onClosed: onClosed, cancellationToken: cancellationToken);
|
return WatchObjectAsync<V1PersistentVolume>(path: path, @continue: @continue, fieldSelector: fieldSelector, labelSelector: labelSelector, limit: limit, pretty: pretty, timeoutSeconds: timeoutSeconds, resourceVersion: resourceVersion, customHeaders: customHeaders, onEvent: onEvent, onError: onError, onClosed: onClosed, cancellationToken: cancellationToken);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <inheritdoc>
|
/// <inheritdoc/>
|
||||||
public Task<Watcher<V1MutatingWebhookConfiguration>> WatchMutatingWebhookConfigurationAsync(
|
public Task<Watcher<V1MutatingWebhookConfiguration>> WatchMutatingWebhookConfigurationAsync(
|
||||||
string name,
|
string name,
|
||||||
bool? allowWatchBookmarks = null,
|
bool? allowWatchBookmarks = null,
|
||||||
@@ -393,7 +393,7 @@ namespace k8s
|
|||||||
return WatchObjectAsync<V1MutatingWebhookConfiguration>(path: path, @continue: @continue, fieldSelector: fieldSelector, labelSelector: labelSelector, limit: limit, pretty: pretty, timeoutSeconds: timeoutSeconds, resourceVersion: resourceVersion, customHeaders: customHeaders, onEvent: onEvent, onError: onError, onClosed: onClosed, cancellationToken: cancellationToken);
|
return WatchObjectAsync<V1MutatingWebhookConfiguration>(path: path, @continue: @continue, fieldSelector: fieldSelector, labelSelector: labelSelector, limit: limit, pretty: pretty, timeoutSeconds: timeoutSeconds, resourceVersion: resourceVersion, customHeaders: customHeaders, onEvent: onEvent, onError: onError, onClosed: onClosed, cancellationToken: cancellationToken);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <inheritdoc>
|
/// <inheritdoc/>
|
||||||
public Task<Watcher<V1ValidatingWebhookConfiguration>> WatchValidatingWebhookConfigurationAsync(
|
public Task<Watcher<V1ValidatingWebhookConfiguration>> WatchValidatingWebhookConfigurationAsync(
|
||||||
string name,
|
string name,
|
||||||
bool? allowWatchBookmarks = null,
|
bool? allowWatchBookmarks = null,
|
||||||
@@ -416,7 +416,7 @@ namespace k8s
|
|||||||
return WatchObjectAsync<V1ValidatingWebhookConfiguration>(path: path, @continue: @continue, fieldSelector: fieldSelector, labelSelector: labelSelector, limit: limit, pretty: pretty, timeoutSeconds: timeoutSeconds, resourceVersion: resourceVersion, customHeaders: customHeaders, onEvent: onEvent, onError: onError, onClosed: onClosed, cancellationToken: cancellationToken);
|
return WatchObjectAsync<V1ValidatingWebhookConfiguration>(path: path, @continue: @continue, fieldSelector: fieldSelector, labelSelector: labelSelector, limit: limit, pretty: pretty, timeoutSeconds: timeoutSeconds, resourceVersion: resourceVersion, customHeaders: customHeaders, onEvent: onEvent, onError: onError, onClosed: onClosed, cancellationToken: cancellationToken);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <inheritdoc>
|
/// <inheritdoc/>
|
||||||
public Task<Watcher<V1beta1MutatingWebhookConfiguration>> WatchMutatingWebhookConfigurationAsync(
|
public Task<Watcher<V1beta1MutatingWebhookConfiguration>> WatchMutatingWebhookConfigurationAsync(
|
||||||
string name,
|
string name,
|
||||||
bool? allowWatchBookmarks = null,
|
bool? allowWatchBookmarks = null,
|
||||||
@@ -439,7 +439,7 @@ namespace k8s
|
|||||||
return WatchObjectAsync<V1beta1MutatingWebhookConfiguration>(path: path, @continue: @continue, fieldSelector: fieldSelector, labelSelector: labelSelector, limit: limit, pretty: pretty, timeoutSeconds: timeoutSeconds, resourceVersion: resourceVersion, customHeaders: customHeaders, onEvent: onEvent, onError: onError, onClosed: onClosed, cancellationToken: cancellationToken);
|
return WatchObjectAsync<V1beta1MutatingWebhookConfiguration>(path: path, @continue: @continue, fieldSelector: fieldSelector, labelSelector: labelSelector, limit: limit, pretty: pretty, timeoutSeconds: timeoutSeconds, resourceVersion: resourceVersion, customHeaders: customHeaders, onEvent: onEvent, onError: onError, onClosed: onClosed, cancellationToken: cancellationToken);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <inheritdoc>
|
/// <inheritdoc/>
|
||||||
public Task<Watcher<V1beta1ValidatingWebhookConfiguration>> WatchValidatingWebhookConfigurationAsync(
|
public Task<Watcher<V1beta1ValidatingWebhookConfiguration>> WatchValidatingWebhookConfigurationAsync(
|
||||||
string name,
|
string name,
|
||||||
bool? allowWatchBookmarks = null,
|
bool? allowWatchBookmarks = null,
|
||||||
@@ -462,7 +462,7 @@ namespace k8s
|
|||||||
return WatchObjectAsync<V1beta1ValidatingWebhookConfiguration>(path: path, @continue: @continue, fieldSelector: fieldSelector, labelSelector: labelSelector, limit: limit, pretty: pretty, timeoutSeconds: timeoutSeconds, resourceVersion: resourceVersion, customHeaders: customHeaders, onEvent: onEvent, onError: onError, onClosed: onClosed, cancellationToken: cancellationToken);
|
return WatchObjectAsync<V1beta1ValidatingWebhookConfiguration>(path: path, @continue: @continue, fieldSelector: fieldSelector, labelSelector: labelSelector, limit: limit, pretty: pretty, timeoutSeconds: timeoutSeconds, resourceVersion: resourceVersion, customHeaders: customHeaders, onEvent: onEvent, onError: onError, onClosed: onClosed, cancellationToken: cancellationToken);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <inheritdoc>
|
/// <inheritdoc/>
|
||||||
public Task<Watcher<V1CustomResourceDefinition>> WatchCustomResourceDefinitionAsync(
|
public Task<Watcher<V1CustomResourceDefinition>> WatchCustomResourceDefinitionAsync(
|
||||||
string name,
|
string name,
|
||||||
bool? allowWatchBookmarks = null,
|
bool? allowWatchBookmarks = null,
|
||||||
@@ -485,7 +485,7 @@ namespace k8s
|
|||||||
return WatchObjectAsync<V1CustomResourceDefinition>(path: path, @continue: @continue, fieldSelector: fieldSelector, labelSelector: labelSelector, limit: limit, pretty: pretty, timeoutSeconds: timeoutSeconds, resourceVersion: resourceVersion, customHeaders: customHeaders, onEvent: onEvent, onError: onError, onClosed: onClosed, cancellationToken: cancellationToken);
|
return WatchObjectAsync<V1CustomResourceDefinition>(path: path, @continue: @continue, fieldSelector: fieldSelector, labelSelector: labelSelector, limit: limit, pretty: pretty, timeoutSeconds: timeoutSeconds, resourceVersion: resourceVersion, customHeaders: customHeaders, onEvent: onEvent, onError: onError, onClosed: onClosed, cancellationToken: cancellationToken);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <inheritdoc>
|
/// <inheritdoc/>
|
||||||
public Task<Watcher<V1beta1CustomResourceDefinition>> WatchCustomResourceDefinitionAsync(
|
public Task<Watcher<V1beta1CustomResourceDefinition>> WatchCustomResourceDefinitionAsync(
|
||||||
string name,
|
string name,
|
||||||
bool? allowWatchBookmarks = null,
|
bool? allowWatchBookmarks = null,
|
||||||
@@ -508,7 +508,7 @@ namespace k8s
|
|||||||
return WatchObjectAsync<V1beta1CustomResourceDefinition>(path: path, @continue: @continue, fieldSelector: fieldSelector, labelSelector: labelSelector, limit: limit, pretty: pretty, timeoutSeconds: timeoutSeconds, resourceVersion: resourceVersion, customHeaders: customHeaders, onEvent: onEvent, onError: onError, onClosed: onClosed, cancellationToken: cancellationToken);
|
return WatchObjectAsync<V1beta1CustomResourceDefinition>(path: path, @continue: @continue, fieldSelector: fieldSelector, labelSelector: labelSelector, limit: limit, pretty: pretty, timeoutSeconds: timeoutSeconds, resourceVersion: resourceVersion, customHeaders: customHeaders, onEvent: onEvent, onError: onError, onClosed: onClosed, cancellationToken: cancellationToken);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <inheritdoc>
|
/// <inheritdoc/>
|
||||||
public Task<Watcher<V1APIService>> WatchAPIServiceAsync(
|
public Task<Watcher<V1APIService>> WatchAPIServiceAsync(
|
||||||
string name,
|
string name,
|
||||||
bool? allowWatchBookmarks = null,
|
bool? allowWatchBookmarks = null,
|
||||||
@@ -531,7 +531,7 @@ namespace k8s
|
|||||||
return WatchObjectAsync<V1APIService>(path: path, @continue: @continue, fieldSelector: fieldSelector, labelSelector: labelSelector, limit: limit, pretty: pretty, timeoutSeconds: timeoutSeconds, resourceVersion: resourceVersion, customHeaders: customHeaders, onEvent: onEvent, onError: onError, onClosed: onClosed, cancellationToken: cancellationToken);
|
return WatchObjectAsync<V1APIService>(path: path, @continue: @continue, fieldSelector: fieldSelector, labelSelector: labelSelector, limit: limit, pretty: pretty, timeoutSeconds: timeoutSeconds, resourceVersion: resourceVersion, customHeaders: customHeaders, onEvent: onEvent, onError: onError, onClosed: onClosed, cancellationToken: cancellationToken);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <inheritdoc>
|
/// <inheritdoc/>
|
||||||
public Task<Watcher<V1beta1APIService>> WatchAPIServiceAsync(
|
public Task<Watcher<V1beta1APIService>> WatchAPIServiceAsync(
|
||||||
string name,
|
string name,
|
||||||
bool? allowWatchBookmarks = null,
|
bool? allowWatchBookmarks = null,
|
||||||
@@ -554,7 +554,7 @@ namespace k8s
|
|||||||
return WatchObjectAsync<V1beta1APIService>(path: path, @continue: @continue, fieldSelector: fieldSelector, labelSelector: labelSelector, limit: limit, pretty: pretty, timeoutSeconds: timeoutSeconds, resourceVersion: resourceVersion, customHeaders: customHeaders, onEvent: onEvent, onError: onError, onClosed: onClosed, cancellationToken: cancellationToken);
|
return WatchObjectAsync<V1beta1APIService>(path: path, @continue: @continue, fieldSelector: fieldSelector, labelSelector: labelSelector, limit: limit, pretty: pretty, timeoutSeconds: timeoutSeconds, resourceVersion: resourceVersion, customHeaders: customHeaders, onEvent: onEvent, onError: onError, onClosed: onClosed, cancellationToken: cancellationToken);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <inheritdoc>
|
/// <inheritdoc/>
|
||||||
public Task<Watcher<V1ControllerRevision>> WatchNamespacedControllerRevisionAsync(
|
public Task<Watcher<V1ControllerRevision>> WatchNamespacedControllerRevisionAsync(
|
||||||
string name,
|
string name,
|
||||||
string @namespace,
|
string @namespace,
|
||||||
@@ -578,7 +578,7 @@ namespace k8s
|
|||||||
return WatchObjectAsync<V1ControllerRevision>(path: path, @continue: @continue, fieldSelector: fieldSelector, labelSelector: labelSelector, limit: limit, pretty: pretty, timeoutSeconds: timeoutSeconds, resourceVersion: resourceVersion, customHeaders: customHeaders, onEvent: onEvent, onError: onError, onClosed: onClosed, cancellationToken: cancellationToken);
|
return WatchObjectAsync<V1ControllerRevision>(path: path, @continue: @continue, fieldSelector: fieldSelector, labelSelector: labelSelector, limit: limit, pretty: pretty, timeoutSeconds: timeoutSeconds, resourceVersion: resourceVersion, customHeaders: customHeaders, onEvent: onEvent, onError: onError, onClosed: onClosed, cancellationToken: cancellationToken);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <inheritdoc>
|
/// <inheritdoc/>
|
||||||
public Task<Watcher<V1DaemonSet>> WatchNamespacedDaemonSetAsync(
|
public Task<Watcher<V1DaemonSet>> WatchNamespacedDaemonSetAsync(
|
||||||
string name,
|
string name,
|
||||||
string @namespace,
|
string @namespace,
|
||||||
@@ -602,7 +602,7 @@ namespace k8s
|
|||||||
return WatchObjectAsync<V1DaemonSet>(path: path, @continue: @continue, fieldSelector: fieldSelector, labelSelector: labelSelector, limit: limit, pretty: pretty, timeoutSeconds: timeoutSeconds, resourceVersion: resourceVersion, customHeaders: customHeaders, onEvent: onEvent, onError: onError, onClosed: onClosed, cancellationToken: cancellationToken);
|
return WatchObjectAsync<V1DaemonSet>(path: path, @continue: @continue, fieldSelector: fieldSelector, labelSelector: labelSelector, limit: limit, pretty: pretty, timeoutSeconds: timeoutSeconds, resourceVersion: resourceVersion, customHeaders: customHeaders, onEvent: onEvent, onError: onError, onClosed: onClosed, cancellationToken: cancellationToken);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <inheritdoc>
|
/// <inheritdoc/>
|
||||||
public Task<Watcher<V1Deployment>> WatchNamespacedDeploymentAsync(
|
public Task<Watcher<V1Deployment>> WatchNamespacedDeploymentAsync(
|
||||||
string name,
|
string name,
|
||||||
string @namespace,
|
string @namespace,
|
||||||
@@ -626,7 +626,7 @@ namespace k8s
|
|||||||
return WatchObjectAsync<V1Deployment>(path: path, @continue: @continue, fieldSelector: fieldSelector, labelSelector: labelSelector, limit: limit, pretty: pretty, timeoutSeconds: timeoutSeconds, resourceVersion: resourceVersion, customHeaders: customHeaders, onEvent: onEvent, onError: onError, onClosed: onClosed, cancellationToken: cancellationToken);
|
return WatchObjectAsync<V1Deployment>(path: path, @continue: @continue, fieldSelector: fieldSelector, labelSelector: labelSelector, limit: limit, pretty: pretty, timeoutSeconds: timeoutSeconds, resourceVersion: resourceVersion, customHeaders: customHeaders, onEvent: onEvent, onError: onError, onClosed: onClosed, cancellationToken: cancellationToken);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <inheritdoc>
|
/// <inheritdoc/>
|
||||||
public Task<Watcher<V1ReplicaSet>> WatchNamespacedReplicaSetAsync(
|
public Task<Watcher<V1ReplicaSet>> WatchNamespacedReplicaSetAsync(
|
||||||
string name,
|
string name,
|
||||||
string @namespace,
|
string @namespace,
|
||||||
@@ -650,7 +650,7 @@ namespace k8s
|
|||||||
return WatchObjectAsync<V1ReplicaSet>(path: path, @continue: @continue, fieldSelector: fieldSelector, labelSelector: labelSelector, limit: limit, pretty: pretty, timeoutSeconds: timeoutSeconds, resourceVersion: resourceVersion, customHeaders: customHeaders, onEvent: onEvent, onError: onError, onClosed: onClosed, cancellationToken: cancellationToken);
|
return WatchObjectAsync<V1ReplicaSet>(path: path, @continue: @continue, fieldSelector: fieldSelector, labelSelector: labelSelector, limit: limit, pretty: pretty, timeoutSeconds: timeoutSeconds, resourceVersion: resourceVersion, customHeaders: customHeaders, onEvent: onEvent, onError: onError, onClosed: onClosed, cancellationToken: cancellationToken);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <inheritdoc>
|
/// <inheritdoc/>
|
||||||
public Task<Watcher<V1StatefulSet>> WatchNamespacedStatefulSetAsync(
|
public Task<Watcher<V1StatefulSet>> WatchNamespacedStatefulSetAsync(
|
||||||
string name,
|
string name,
|
||||||
string @namespace,
|
string @namespace,
|
||||||
@@ -674,7 +674,7 @@ namespace k8s
|
|||||||
return WatchObjectAsync<V1StatefulSet>(path: path, @continue: @continue, fieldSelector: fieldSelector, labelSelector: labelSelector, limit: limit, pretty: pretty, timeoutSeconds: timeoutSeconds, resourceVersion: resourceVersion, customHeaders: customHeaders, onEvent: onEvent, onError: onError, onClosed: onClosed, cancellationToken: cancellationToken);
|
return WatchObjectAsync<V1StatefulSet>(path: path, @continue: @continue, fieldSelector: fieldSelector, labelSelector: labelSelector, limit: limit, pretty: pretty, timeoutSeconds: timeoutSeconds, resourceVersion: resourceVersion, customHeaders: customHeaders, onEvent: onEvent, onError: onError, onClosed: onClosed, cancellationToken: cancellationToken);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <inheritdoc>
|
/// <inheritdoc/>
|
||||||
public Task<Watcher<V1HorizontalPodAutoscaler>> WatchNamespacedHorizontalPodAutoscalerAsync(
|
public Task<Watcher<V1HorizontalPodAutoscaler>> WatchNamespacedHorizontalPodAutoscalerAsync(
|
||||||
string name,
|
string name,
|
||||||
string @namespace,
|
string @namespace,
|
||||||
@@ -698,7 +698,7 @@ namespace k8s
|
|||||||
return WatchObjectAsync<V1HorizontalPodAutoscaler>(path: path, @continue: @continue, fieldSelector: fieldSelector, labelSelector: labelSelector, limit: limit, pretty: pretty, timeoutSeconds: timeoutSeconds, resourceVersion: resourceVersion, customHeaders: customHeaders, onEvent: onEvent, onError: onError, onClosed: onClosed, cancellationToken: cancellationToken);
|
return WatchObjectAsync<V1HorizontalPodAutoscaler>(path: path, @continue: @continue, fieldSelector: fieldSelector, labelSelector: labelSelector, limit: limit, pretty: pretty, timeoutSeconds: timeoutSeconds, resourceVersion: resourceVersion, customHeaders: customHeaders, onEvent: onEvent, onError: onError, onClosed: onClosed, cancellationToken: cancellationToken);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <inheritdoc>
|
/// <inheritdoc/>
|
||||||
public Task<Watcher<V2beta1HorizontalPodAutoscaler>> WatchNamespacedHorizontalPodAutoscalerAsync(
|
public Task<Watcher<V2beta1HorizontalPodAutoscaler>> WatchNamespacedHorizontalPodAutoscalerAsync(
|
||||||
string name,
|
string name,
|
||||||
string @namespace,
|
string @namespace,
|
||||||
@@ -722,7 +722,7 @@ namespace k8s
|
|||||||
return WatchObjectAsync<V2beta1HorizontalPodAutoscaler>(path: path, @continue: @continue, fieldSelector: fieldSelector, labelSelector: labelSelector, limit: limit, pretty: pretty, timeoutSeconds: timeoutSeconds, resourceVersion: resourceVersion, customHeaders: customHeaders, onEvent: onEvent, onError: onError, onClosed: onClosed, cancellationToken: cancellationToken);
|
return WatchObjectAsync<V2beta1HorizontalPodAutoscaler>(path: path, @continue: @continue, fieldSelector: fieldSelector, labelSelector: labelSelector, limit: limit, pretty: pretty, timeoutSeconds: timeoutSeconds, resourceVersion: resourceVersion, customHeaders: customHeaders, onEvent: onEvent, onError: onError, onClosed: onClosed, cancellationToken: cancellationToken);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <inheritdoc>
|
/// <inheritdoc/>
|
||||||
public Task<Watcher<V2beta2HorizontalPodAutoscaler>> WatchNamespacedHorizontalPodAutoscalerAsync(
|
public Task<Watcher<V2beta2HorizontalPodAutoscaler>> WatchNamespacedHorizontalPodAutoscalerAsync(
|
||||||
string name,
|
string name,
|
||||||
string @namespace,
|
string @namespace,
|
||||||
@@ -746,7 +746,7 @@ namespace k8s
|
|||||||
return WatchObjectAsync<V2beta2HorizontalPodAutoscaler>(path: path, @continue: @continue, fieldSelector: fieldSelector, labelSelector: labelSelector, limit: limit, pretty: pretty, timeoutSeconds: timeoutSeconds, resourceVersion: resourceVersion, customHeaders: customHeaders, onEvent: onEvent, onError: onError, onClosed: onClosed, cancellationToken: cancellationToken);
|
return WatchObjectAsync<V2beta2HorizontalPodAutoscaler>(path: path, @continue: @continue, fieldSelector: fieldSelector, labelSelector: labelSelector, limit: limit, pretty: pretty, timeoutSeconds: timeoutSeconds, resourceVersion: resourceVersion, customHeaders: customHeaders, onEvent: onEvent, onError: onError, onClosed: onClosed, cancellationToken: cancellationToken);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <inheritdoc>
|
/// <inheritdoc/>
|
||||||
public Task<Watcher<V1Job>> WatchNamespacedJobAsync(
|
public Task<Watcher<V1Job>> WatchNamespacedJobAsync(
|
||||||
string name,
|
string name,
|
||||||
string @namespace,
|
string @namespace,
|
||||||
@@ -770,7 +770,7 @@ namespace k8s
|
|||||||
return WatchObjectAsync<V1Job>(path: path, @continue: @continue, fieldSelector: fieldSelector, labelSelector: labelSelector, limit: limit, pretty: pretty, timeoutSeconds: timeoutSeconds, resourceVersion: resourceVersion, customHeaders: customHeaders, onEvent: onEvent, onError: onError, onClosed: onClosed, cancellationToken: cancellationToken);
|
return WatchObjectAsync<V1Job>(path: path, @continue: @continue, fieldSelector: fieldSelector, labelSelector: labelSelector, limit: limit, pretty: pretty, timeoutSeconds: timeoutSeconds, resourceVersion: resourceVersion, customHeaders: customHeaders, onEvent: onEvent, onError: onError, onClosed: onClosed, cancellationToken: cancellationToken);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <inheritdoc>
|
/// <inheritdoc/>
|
||||||
public Task<Watcher<V1beta1CronJob>> WatchNamespacedCronJobAsync(
|
public Task<Watcher<V1beta1CronJob>> WatchNamespacedCronJobAsync(
|
||||||
string name,
|
string name,
|
||||||
string @namespace,
|
string @namespace,
|
||||||
@@ -794,7 +794,7 @@ namespace k8s
|
|||||||
return WatchObjectAsync<V1beta1CronJob>(path: path, @continue: @continue, fieldSelector: fieldSelector, labelSelector: labelSelector, limit: limit, pretty: pretty, timeoutSeconds: timeoutSeconds, resourceVersion: resourceVersion, customHeaders: customHeaders, onEvent: onEvent, onError: onError, onClosed: onClosed, cancellationToken: cancellationToken);
|
return WatchObjectAsync<V1beta1CronJob>(path: path, @continue: @continue, fieldSelector: fieldSelector, labelSelector: labelSelector, limit: limit, pretty: pretty, timeoutSeconds: timeoutSeconds, resourceVersion: resourceVersion, customHeaders: customHeaders, onEvent: onEvent, onError: onError, onClosed: onClosed, cancellationToken: cancellationToken);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <inheritdoc>
|
/// <inheritdoc/>
|
||||||
public Task<Watcher<V2alpha1CronJob>> WatchNamespacedCronJobAsync(
|
public Task<Watcher<V2alpha1CronJob>> WatchNamespacedCronJobAsync(
|
||||||
string name,
|
string name,
|
||||||
string @namespace,
|
string @namespace,
|
||||||
@@ -818,7 +818,7 @@ namespace k8s
|
|||||||
return WatchObjectAsync<V2alpha1CronJob>(path: path, @continue: @continue, fieldSelector: fieldSelector, labelSelector: labelSelector, limit: limit, pretty: pretty, timeoutSeconds: timeoutSeconds, resourceVersion: resourceVersion, customHeaders: customHeaders, onEvent: onEvent, onError: onError, onClosed: onClosed, cancellationToken: cancellationToken);
|
return WatchObjectAsync<V2alpha1CronJob>(path: path, @continue: @continue, fieldSelector: fieldSelector, labelSelector: labelSelector, limit: limit, pretty: pretty, timeoutSeconds: timeoutSeconds, resourceVersion: resourceVersion, customHeaders: customHeaders, onEvent: onEvent, onError: onError, onClosed: onClosed, cancellationToken: cancellationToken);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <inheritdoc>
|
/// <inheritdoc/>
|
||||||
public Task<Watcher<V1CertificateSigningRequest>> WatchCertificateSigningRequestAsync(
|
public Task<Watcher<V1CertificateSigningRequest>> WatchCertificateSigningRequestAsync(
|
||||||
string name,
|
string name,
|
||||||
bool? allowWatchBookmarks = null,
|
bool? allowWatchBookmarks = null,
|
||||||
@@ -841,7 +841,7 @@ namespace k8s
|
|||||||
return WatchObjectAsync<V1CertificateSigningRequest>(path: path, @continue: @continue, fieldSelector: fieldSelector, labelSelector: labelSelector, limit: limit, pretty: pretty, timeoutSeconds: timeoutSeconds, resourceVersion: resourceVersion, customHeaders: customHeaders, onEvent: onEvent, onError: onError, onClosed: onClosed, cancellationToken: cancellationToken);
|
return WatchObjectAsync<V1CertificateSigningRequest>(path: path, @continue: @continue, fieldSelector: fieldSelector, labelSelector: labelSelector, limit: limit, pretty: pretty, timeoutSeconds: timeoutSeconds, resourceVersion: resourceVersion, customHeaders: customHeaders, onEvent: onEvent, onError: onError, onClosed: onClosed, cancellationToken: cancellationToken);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <inheritdoc>
|
/// <inheritdoc/>
|
||||||
public Task<Watcher<V1beta1CertificateSigningRequest>> WatchCertificateSigningRequestAsync(
|
public Task<Watcher<V1beta1CertificateSigningRequest>> WatchCertificateSigningRequestAsync(
|
||||||
string name,
|
string name,
|
||||||
bool? allowWatchBookmarks = null,
|
bool? allowWatchBookmarks = null,
|
||||||
@@ -864,7 +864,7 @@ namespace k8s
|
|||||||
return WatchObjectAsync<V1beta1CertificateSigningRequest>(path: path, @continue: @continue, fieldSelector: fieldSelector, labelSelector: labelSelector, limit: limit, pretty: pretty, timeoutSeconds: timeoutSeconds, resourceVersion: resourceVersion, customHeaders: customHeaders, onEvent: onEvent, onError: onError, onClosed: onClosed, cancellationToken: cancellationToken);
|
return WatchObjectAsync<V1beta1CertificateSigningRequest>(path: path, @continue: @continue, fieldSelector: fieldSelector, labelSelector: labelSelector, limit: limit, pretty: pretty, timeoutSeconds: timeoutSeconds, resourceVersion: resourceVersion, customHeaders: customHeaders, onEvent: onEvent, onError: onError, onClosed: onClosed, cancellationToken: cancellationToken);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <inheritdoc>
|
/// <inheritdoc/>
|
||||||
public Task<Watcher<V1Lease>> WatchNamespacedLeaseAsync(
|
public Task<Watcher<V1Lease>> WatchNamespacedLeaseAsync(
|
||||||
string name,
|
string name,
|
||||||
string @namespace,
|
string @namespace,
|
||||||
@@ -888,7 +888,7 @@ namespace k8s
|
|||||||
return WatchObjectAsync<V1Lease>(path: path, @continue: @continue, fieldSelector: fieldSelector, labelSelector: labelSelector, limit: limit, pretty: pretty, timeoutSeconds: timeoutSeconds, resourceVersion: resourceVersion, customHeaders: customHeaders, onEvent: onEvent, onError: onError, onClosed: onClosed, cancellationToken: cancellationToken);
|
return WatchObjectAsync<V1Lease>(path: path, @continue: @continue, fieldSelector: fieldSelector, labelSelector: labelSelector, limit: limit, pretty: pretty, timeoutSeconds: timeoutSeconds, resourceVersion: resourceVersion, customHeaders: customHeaders, onEvent: onEvent, onError: onError, onClosed: onClosed, cancellationToken: cancellationToken);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <inheritdoc>
|
/// <inheritdoc/>
|
||||||
public Task<Watcher<V1beta1Lease>> WatchNamespacedLeaseAsync(
|
public Task<Watcher<V1beta1Lease>> WatchNamespacedLeaseAsync(
|
||||||
string name,
|
string name,
|
||||||
string @namespace,
|
string @namespace,
|
||||||
@@ -912,7 +912,7 @@ namespace k8s
|
|||||||
return WatchObjectAsync<V1beta1Lease>(path: path, @continue: @continue, fieldSelector: fieldSelector, labelSelector: labelSelector, limit: limit, pretty: pretty, timeoutSeconds: timeoutSeconds, resourceVersion: resourceVersion, customHeaders: customHeaders, onEvent: onEvent, onError: onError, onClosed: onClosed, cancellationToken: cancellationToken);
|
return WatchObjectAsync<V1beta1Lease>(path: path, @continue: @continue, fieldSelector: fieldSelector, labelSelector: labelSelector, limit: limit, pretty: pretty, timeoutSeconds: timeoutSeconds, resourceVersion: resourceVersion, customHeaders: customHeaders, onEvent: onEvent, onError: onError, onClosed: onClosed, cancellationToken: cancellationToken);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <inheritdoc>
|
/// <inheritdoc/>
|
||||||
public Task<Watcher<V1beta1EndpointSlice>> WatchNamespacedEndpointSliceAsync(
|
public Task<Watcher<V1beta1EndpointSlice>> WatchNamespacedEndpointSliceAsync(
|
||||||
string name,
|
string name,
|
||||||
string @namespace,
|
string @namespace,
|
||||||
@@ -936,7 +936,7 @@ namespace k8s
|
|||||||
return WatchObjectAsync<V1beta1EndpointSlice>(path: path, @continue: @continue, fieldSelector: fieldSelector, labelSelector: labelSelector, limit: limit, pretty: pretty, timeoutSeconds: timeoutSeconds, resourceVersion: resourceVersion, customHeaders: customHeaders, onEvent: onEvent, onError: onError, onClosed: onClosed, cancellationToken: cancellationToken);
|
return WatchObjectAsync<V1beta1EndpointSlice>(path: path, @continue: @continue, fieldSelector: fieldSelector, labelSelector: labelSelector, limit: limit, pretty: pretty, timeoutSeconds: timeoutSeconds, resourceVersion: resourceVersion, customHeaders: customHeaders, onEvent: onEvent, onError: onError, onClosed: onClosed, cancellationToken: cancellationToken);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <inheritdoc>
|
/// <inheritdoc/>
|
||||||
public Task<Watcher<Eventsv1Event>> WatchNamespacedEventAsync(
|
public Task<Watcher<Eventsv1Event>> WatchNamespacedEventAsync(
|
||||||
string name,
|
string name,
|
||||||
string @namespace,
|
string @namespace,
|
||||||
@@ -960,7 +960,7 @@ namespace k8s
|
|||||||
return WatchObjectAsync<Eventsv1Event>(path: path, @continue: @continue, fieldSelector: fieldSelector, labelSelector: labelSelector, limit: limit, pretty: pretty, timeoutSeconds: timeoutSeconds, resourceVersion: resourceVersion, customHeaders: customHeaders, onEvent: onEvent, onError: onError, onClosed: onClosed, cancellationToken: cancellationToken);
|
return WatchObjectAsync<Eventsv1Event>(path: path, @continue: @continue, fieldSelector: fieldSelector, labelSelector: labelSelector, limit: limit, pretty: pretty, timeoutSeconds: timeoutSeconds, resourceVersion: resourceVersion, customHeaders: customHeaders, onEvent: onEvent, onError: onError, onClosed: onClosed, cancellationToken: cancellationToken);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <inheritdoc>
|
/// <inheritdoc/>
|
||||||
public Task<Watcher<V1beta1Event>> WatchNamespacedEventAsync(
|
public Task<Watcher<V1beta1Event>> WatchNamespacedEventAsync(
|
||||||
string name,
|
string name,
|
||||||
string @namespace,
|
string @namespace,
|
||||||
@@ -984,7 +984,7 @@ namespace k8s
|
|||||||
return WatchObjectAsync<V1beta1Event>(path: path, @continue: @continue, fieldSelector: fieldSelector, labelSelector: labelSelector, limit: limit, pretty: pretty, timeoutSeconds: timeoutSeconds, resourceVersion: resourceVersion, customHeaders: customHeaders, onEvent: onEvent, onError: onError, onClosed: onClosed, cancellationToken: cancellationToken);
|
return WatchObjectAsync<V1beta1Event>(path: path, @continue: @continue, fieldSelector: fieldSelector, labelSelector: labelSelector, limit: limit, pretty: pretty, timeoutSeconds: timeoutSeconds, resourceVersion: resourceVersion, customHeaders: customHeaders, onEvent: onEvent, onError: onError, onClosed: onClosed, cancellationToken: cancellationToken);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <inheritdoc>
|
/// <inheritdoc/>
|
||||||
public Task<Watcher<Extensionsv1beta1Ingress>> WatchNamespacedIngressAsync(
|
public Task<Watcher<Extensionsv1beta1Ingress>> WatchNamespacedIngressAsync(
|
||||||
string name,
|
string name,
|
||||||
string @namespace,
|
string @namespace,
|
||||||
@@ -1008,7 +1008,7 @@ namespace k8s
|
|||||||
return WatchObjectAsync<Extensionsv1beta1Ingress>(path: path, @continue: @continue, fieldSelector: fieldSelector, labelSelector: labelSelector, limit: limit, pretty: pretty, timeoutSeconds: timeoutSeconds, resourceVersion: resourceVersion, customHeaders: customHeaders, onEvent: onEvent, onError: onError, onClosed: onClosed, cancellationToken: cancellationToken);
|
return WatchObjectAsync<Extensionsv1beta1Ingress>(path: path, @continue: @continue, fieldSelector: fieldSelector, labelSelector: labelSelector, limit: limit, pretty: pretty, timeoutSeconds: timeoutSeconds, resourceVersion: resourceVersion, customHeaders: customHeaders, onEvent: onEvent, onError: onError, onClosed: onClosed, cancellationToken: cancellationToken);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <inheritdoc>
|
/// <inheritdoc/>
|
||||||
public Task<Watcher<V1alpha1FlowSchema>> WatchFlowSchemaAsync(
|
public Task<Watcher<V1alpha1FlowSchema>> WatchFlowSchemaAsync(
|
||||||
string name,
|
string name,
|
||||||
bool? allowWatchBookmarks = null,
|
bool? allowWatchBookmarks = null,
|
||||||
@@ -1031,7 +1031,7 @@ namespace k8s
|
|||||||
return WatchObjectAsync<V1alpha1FlowSchema>(path: path, @continue: @continue, fieldSelector: fieldSelector, labelSelector: labelSelector, limit: limit, pretty: pretty, timeoutSeconds: timeoutSeconds, resourceVersion: resourceVersion, customHeaders: customHeaders, onEvent: onEvent, onError: onError, onClosed: onClosed, cancellationToken: cancellationToken);
|
return WatchObjectAsync<V1alpha1FlowSchema>(path: path, @continue: @continue, fieldSelector: fieldSelector, labelSelector: labelSelector, limit: limit, pretty: pretty, timeoutSeconds: timeoutSeconds, resourceVersion: resourceVersion, customHeaders: customHeaders, onEvent: onEvent, onError: onError, onClosed: onClosed, cancellationToken: cancellationToken);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <inheritdoc>
|
/// <inheritdoc/>
|
||||||
public Task<Watcher<V1alpha1PriorityLevelConfiguration>> WatchPriorityLevelConfigurationAsync(
|
public Task<Watcher<V1alpha1PriorityLevelConfiguration>> WatchPriorityLevelConfigurationAsync(
|
||||||
string name,
|
string name,
|
||||||
bool? allowWatchBookmarks = null,
|
bool? allowWatchBookmarks = null,
|
||||||
@@ -1054,7 +1054,7 @@ namespace k8s
|
|||||||
return WatchObjectAsync<V1alpha1PriorityLevelConfiguration>(path: path, @continue: @continue, fieldSelector: fieldSelector, labelSelector: labelSelector, limit: limit, pretty: pretty, timeoutSeconds: timeoutSeconds, resourceVersion: resourceVersion, customHeaders: customHeaders, onEvent: onEvent, onError: onError, onClosed: onClosed, cancellationToken: cancellationToken);
|
return WatchObjectAsync<V1alpha1PriorityLevelConfiguration>(path: path, @continue: @continue, fieldSelector: fieldSelector, labelSelector: labelSelector, limit: limit, pretty: pretty, timeoutSeconds: timeoutSeconds, resourceVersion: resourceVersion, customHeaders: customHeaders, onEvent: onEvent, onError: onError, onClosed: onClosed, cancellationToken: cancellationToken);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <inheritdoc>
|
/// <inheritdoc/>
|
||||||
public Task<Watcher<V1IngressClass>> WatchIngressClassAsync(
|
public Task<Watcher<V1IngressClass>> WatchIngressClassAsync(
|
||||||
string name,
|
string name,
|
||||||
bool? allowWatchBookmarks = null,
|
bool? allowWatchBookmarks = null,
|
||||||
@@ -1077,7 +1077,7 @@ namespace k8s
|
|||||||
return WatchObjectAsync<V1IngressClass>(path: path, @continue: @continue, fieldSelector: fieldSelector, labelSelector: labelSelector, limit: limit, pretty: pretty, timeoutSeconds: timeoutSeconds, resourceVersion: resourceVersion, customHeaders: customHeaders, onEvent: onEvent, onError: onError, onClosed: onClosed, cancellationToken: cancellationToken);
|
return WatchObjectAsync<V1IngressClass>(path: path, @continue: @continue, fieldSelector: fieldSelector, labelSelector: labelSelector, limit: limit, pretty: pretty, timeoutSeconds: timeoutSeconds, resourceVersion: resourceVersion, customHeaders: customHeaders, onEvent: onEvent, onError: onError, onClosed: onClosed, cancellationToken: cancellationToken);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <inheritdoc>
|
/// <inheritdoc/>
|
||||||
public Task<Watcher<V1Ingress>> WatchNamespacedIngressAsync(
|
public Task<Watcher<V1Ingress>> WatchNamespacedIngressAsync(
|
||||||
string name,
|
string name,
|
||||||
string @namespace,
|
string @namespace,
|
||||||
@@ -1101,7 +1101,7 @@ namespace k8s
|
|||||||
return WatchObjectAsync<V1Ingress>(path: path, @continue: @continue, fieldSelector: fieldSelector, labelSelector: labelSelector, limit: limit, pretty: pretty, timeoutSeconds: timeoutSeconds, resourceVersion: resourceVersion, customHeaders: customHeaders, onEvent: onEvent, onError: onError, onClosed: onClosed, cancellationToken: cancellationToken);
|
return WatchObjectAsync<V1Ingress>(path: path, @continue: @continue, fieldSelector: fieldSelector, labelSelector: labelSelector, limit: limit, pretty: pretty, timeoutSeconds: timeoutSeconds, resourceVersion: resourceVersion, customHeaders: customHeaders, onEvent: onEvent, onError: onError, onClosed: onClosed, cancellationToken: cancellationToken);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <inheritdoc>
|
/// <inheritdoc/>
|
||||||
public Task<Watcher<V1NetworkPolicy>> WatchNamespacedNetworkPolicyAsync(
|
public Task<Watcher<V1NetworkPolicy>> WatchNamespacedNetworkPolicyAsync(
|
||||||
string name,
|
string name,
|
||||||
string @namespace,
|
string @namespace,
|
||||||
@@ -1125,7 +1125,7 @@ namespace k8s
|
|||||||
return WatchObjectAsync<V1NetworkPolicy>(path: path, @continue: @continue, fieldSelector: fieldSelector, labelSelector: labelSelector, limit: limit, pretty: pretty, timeoutSeconds: timeoutSeconds, resourceVersion: resourceVersion, customHeaders: customHeaders, onEvent: onEvent, onError: onError, onClosed: onClosed, cancellationToken: cancellationToken);
|
return WatchObjectAsync<V1NetworkPolicy>(path: path, @continue: @continue, fieldSelector: fieldSelector, labelSelector: labelSelector, limit: limit, pretty: pretty, timeoutSeconds: timeoutSeconds, resourceVersion: resourceVersion, customHeaders: customHeaders, onEvent: onEvent, onError: onError, onClosed: onClosed, cancellationToken: cancellationToken);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <inheritdoc>
|
/// <inheritdoc/>
|
||||||
public Task<Watcher<V1beta1IngressClass>> WatchIngressClassAsync(
|
public Task<Watcher<V1beta1IngressClass>> WatchIngressClassAsync(
|
||||||
string name,
|
string name,
|
||||||
bool? allowWatchBookmarks = null,
|
bool? allowWatchBookmarks = null,
|
||||||
@@ -1148,7 +1148,7 @@ namespace k8s
|
|||||||
return WatchObjectAsync<V1beta1IngressClass>(path: path, @continue: @continue, fieldSelector: fieldSelector, labelSelector: labelSelector, limit: limit, pretty: pretty, timeoutSeconds: timeoutSeconds, resourceVersion: resourceVersion, customHeaders: customHeaders, onEvent: onEvent, onError: onError, onClosed: onClosed, cancellationToken: cancellationToken);
|
return WatchObjectAsync<V1beta1IngressClass>(path: path, @continue: @continue, fieldSelector: fieldSelector, labelSelector: labelSelector, limit: limit, pretty: pretty, timeoutSeconds: timeoutSeconds, resourceVersion: resourceVersion, customHeaders: customHeaders, onEvent: onEvent, onError: onError, onClosed: onClosed, cancellationToken: cancellationToken);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <inheritdoc>
|
/// <inheritdoc/>
|
||||||
public Task<Watcher<Networkingv1beta1Ingress>> WatchNamespacedIngressAsync(
|
public Task<Watcher<Networkingv1beta1Ingress>> WatchNamespacedIngressAsync(
|
||||||
string name,
|
string name,
|
||||||
string @namespace,
|
string @namespace,
|
||||||
@@ -1172,7 +1172,7 @@ namespace k8s
|
|||||||
return WatchObjectAsync<Networkingv1beta1Ingress>(path: path, @continue: @continue, fieldSelector: fieldSelector, labelSelector: labelSelector, limit: limit, pretty: pretty, timeoutSeconds: timeoutSeconds, resourceVersion: resourceVersion, customHeaders: customHeaders, onEvent: onEvent, onError: onError, onClosed: onClosed, cancellationToken: cancellationToken);
|
return WatchObjectAsync<Networkingv1beta1Ingress>(path: path, @continue: @continue, fieldSelector: fieldSelector, labelSelector: labelSelector, limit: limit, pretty: pretty, timeoutSeconds: timeoutSeconds, resourceVersion: resourceVersion, customHeaders: customHeaders, onEvent: onEvent, onError: onError, onClosed: onClosed, cancellationToken: cancellationToken);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <inheritdoc>
|
/// <inheritdoc/>
|
||||||
public Task<Watcher<V1alpha1RuntimeClass>> WatchRuntimeClassAsync(
|
public Task<Watcher<V1alpha1RuntimeClass>> WatchRuntimeClassAsync(
|
||||||
string name,
|
string name,
|
||||||
bool? allowWatchBookmarks = null,
|
bool? allowWatchBookmarks = null,
|
||||||
@@ -1195,7 +1195,7 @@ namespace k8s
|
|||||||
return WatchObjectAsync<V1alpha1RuntimeClass>(path: path, @continue: @continue, fieldSelector: fieldSelector, labelSelector: labelSelector, limit: limit, pretty: pretty, timeoutSeconds: timeoutSeconds, resourceVersion: resourceVersion, customHeaders: customHeaders, onEvent: onEvent, onError: onError, onClosed: onClosed, cancellationToken: cancellationToken);
|
return WatchObjectAsync<V1alpha1RuntimeClass>(path: path, @continue: @continue, fieldSelector: fieldSelector, labelSelector: labelSelector, limit: limit, pretty: pretty, timeoutSeconds: timeoutSeconds, resourceVersion: resourceVersion, customHeaders: customHeaders, onEvent: onEvent, onError: onError, onClosed: onClosed, cancellationToken: cancellationToken);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <inheritdoc>
|
/// <inheritdoc/>
|
||||||
public Task<Watcher<V1beta1RuntimeClass>> WatchRuntimeClassAsync(
|
public Task<Watcher<V1beta1RuntimeClass>> WatchRuntimeClassAsync(
|
||||||
string name,
|
string name,
|
||||||
bool? allowWatchBookmarks = null,
|
bool? allowWatchBookmarks = null,
|
||||||
@@ -1218,7 +1218,7 @@ namespace k8s
|
|||||||
return WatchObjectAsync<V1beta1RuntimeClass>(path: path, @continue: @continue, fieldSelector: fieldSelector, labelSelector: labelSelector, limit: limit, pretty: pretty, timeoutSeconds: timeoutSeconds, resourceVersion: resourceVersion, customHeaders: customHeaders, onEvent: onEvent, onError: onError, onClosed: onClosed, cancellationToken: cancellationToken);
|
return WatchObjectAsync<V1beta1RuntimeClass>(path: path, @continue: @continue, fieldSelector: fieldSelector, labelSelector: labelSelector, limit: limit, pretty: pretty, timeoutSeconds: timeoutSeconds, resourceVersion: resourceVersion, customHeaders: customHeaders, onEvent: onEvent, onError: onError, onClosed: onClosed, cancellationToken: cancellationToken);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <inheritdoc>
|
/// <inheritdoc/>
|
||||||
public Task<Watcher<V1beta1PodDisruptionBudget>> WatchNamespacedPodDisruptionBudgetAsync(
|
public Task<Watcher<V1beta1PodDisruptionBudget>> WatchNamespacedPodDisruptionBudgetAsync(
|
||||||
string name,
|
string name,
|
||||||
string @namespace,
|
string @namespace,
|
||||||
@@ -1242,7 +1242,7 @@ namespace k8s
|
|||||||
return WatchObjectAsync<V1beta1PodDisruptionBudget>(path: path, @continue: @continue, fieldSelector: fieldSelector, labelSelector: labelSelector, limit: limit, pretty: pretty, timeoutSeconds: timeoutSeconds, resourceVersion: resourceVersion, customHeaders: customHeaders, onEvent: onEvent, onError: onError, onClosed: onClosed, cancellationToken: cancellationToken);
|
return WatchObjectAsync<V1beta1PodDisruptionBudget>(path: path, @continue: @continue, fieldSelector: fieldSelector, labelSelector: labelSelector, limit: limit, pretty: pretty, timeoutSeconds: timeoutSeconds, resourceVersion: resourceVersion, customHeaders: customHeaders, onEvent: onEvent, onError: onError, onClosed: onClosed, cancellationToken: cancellationToken);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <inheritdoc>
|
/// <inheritdoc/>
|
||||||
public Task<Watcher<V1beta1PodSecurityPolicy>> WatchPodSecurityPolicyAsync(
|
public Task<Watcher<V1beta1PodSecurityPolicy>> WatchPodSecurityPolicyAsync(
|
||||||
string name,
|
string name,
|
||||||
bool? allowWatchBookmarks = null,
|
bool? allowWatchBookmarks = null,
|
||||||
@@ -1265,7 +1265,7 @@ namespace k8s
|
|||||||
return WatchObjectAsync<V1beta1PodSecurityPolicy>(path: path, @continue: @continue, fieldSelector: fieldSelector, labelSelector: labelSelector, limit: limit, pretty: pretty, timeoutSeconds: timeoutSeconds, resourceVersion: resourceVersion, customHeaders: customHeaders, onEvent: onEvent, onError: onError, onClosed: onClosed, cancellationToken: cancellationToken);
|
return WatchObjectAsync<V1beta1PodSecurityPolicy>(path: path, @continue: @continue, fieldSelector: fieldSelector, labelSelector: labelSelector, limit: limit, pretty: pretty, timeoutSeconds: timeoutSeconds, resourceVersion: resourceVersion, customHeaders: customHeaders, onEvent: onEvent, onError: onError, onClosed: onClosed, cancellationToken: cancellationToken);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <inheritdoc>
|
/// <inheritdoc/>
|
||||||
public Task<Watcher<V1ClusterRoleBinding>> WatchClusterRoleBindingAsync(
|
public Task<Watcher<V1ClusterRoleBinding>> WatchClusterRoleBindingAsync(
|
||||||
string name,
|
string name,
|
||||||
bool? allowWatchBookmarks = null,
|
bool? allowWatchBookmarks = null,
|
||||||
@@ -1288,7 +1288,7 @@ namespace k8s
|
|||||||
return WatchObjectAsync<V1ClusterRoleBinding>(path: path, @continue: @continue, fieldSelector: fieldSelector, labelSelector: labelSelector, limit: limit, pretty: pretty, timeoutSeconds: timeoutSeconds, resourceVersion: resourceVersion, customHeaders: customHeaders, onEvent: onEvent, onError: onError, onClosed: onClosed, cancellationToken: cancellationToken);
|
return WatchObjectAsync<V1ClusterRoleBinding>(path: path, @continue: @continue, fieldSelector: fieldSelector, labelSelector: labelSelector, limit: limit, pretty: pretty, timeoutSeconds: timeoutSeconds, resourceVersion: resourceVersion, customHeaders: customHeaders, onEvent: onEvent, onError: onError, onClosed: onClosed, cancellationToken: cancellationToken);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <inheritdoc>
|
/// <inheritdoc/>
|
||||||
public Task<Watcher<V1ClusterRole>> WatchClusterRoleAsync(
|
public Task<Watcher<V1ClusterRole>> WatchClusterRoleAsync(
|
||||||
string name,
|
string name,
|
||||||
bool? allowWatchBookmarks = null,
|
bool? allowWatchBookmarks = null,
|
||||||
@@ -1311,7 +1311,7 @@ namespace k8s
|
|||||||
return WatchObjectAsync<V1ClusterRole>(path: path, @continue: @continue, fieldSelector: fieldSelector, labelSelector: labelSelector, limit: limit, pretty: pretty, timeoutSeconds: timeoutSeconds, resourceVersion: resourceVersion, customHeaders: customHeaders, onEvent: onEvent, onError: onError, onClosed: onClosed, cancellationToken: cancellationToken);
|
return WatchObjectAsync<V1ClusterRole>(path: path, @continue: @continue, fieldSelector: fieldSelector, labelSelector: labelSelector, limit: limit, pretty: pretty, timeoutSeconds: timeoutSeconds, resourceVersion: resourceVersion, customHeaders: customHeaders, onEvent: onEvent, onError: onError, onClosed: onClosed, cancellationToken: cancellationToken);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <inheritdoc>
|
/// <inheritdoc/>
|
||||||
public Task<Watcher<V1RoleBinding>> WatchNamespacedRoleBindingAsync(
|
public Task<Watcher<V1RoleBinding>> WatchNamespacedRoleBindingAsync(
|
||||||
string name,
|
string name,
|
||||||
string @namespace,
|
string @namespace,
|
||||||
@@ -1335,7 +1335,7 @@ namespace k8s
|
|||||||
return WatchObjectAsync<V1RoleBinding>(path: path, @continue: @continue, fieldSelector: fieldSelector, labelSelector: labelSelector, limit: limit, pretty: pretty, timeoutSeconds: timeoutSeconds, resourceVersion: resourceVersion, customHeaders: customHeaders, onEvent: onEvent, onError: onError, onClosed: onClosed, cancellationToken: cancellationToken);
|
return WatchObjectAsync<V1RoleBinding>(path: path, @continue: @continue, fieldSelector: fieldSelector, labelSelector: labelSelector, limit: limit, pretty: pretty, timeoutSeconds: timeoutSeconds, resourceVersion: resourceVersion, customHeaders: customHeaders, onEvent: onEvent, onError: onError, onClosed: onClosed, cancellationToken: cancellationToken);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <inheritdoc>
|
/// <inheritdoc/>
|
||||||
public Task<Watcher<V1Role>> WatchNamespacedRoleAsync(
|
public Task<Watcher<V1Role>> WatchNamespacedRoleAsync(
|
||||||
string name,
|
string name,
|
||||||
string @namespace,
|
string @namespace,
|
||||||
@@ -1359,7 +1359,7 @@ namespace k8s
|
|||||||
return WatchObjectAsync<V1Role>(path: path, @continue: @continue, fieldSelector: fieldSelector, labelSelector: labelSelector, limit: limit, pretty: pretty, timeoutSeconds: timeoutSeconds, resourceVersion: resourceVersion, customHeaders: customHeaders, onEvent: onEvent, onError: onError, onClosed: onClosed, cancellationToken: cancellationToken);
|
return WatchObjectAsync<V1Role>(path: path, @continue: @continue, fieldSelector: fieldSelector, labelSelector: labelSelector, limit: limit, pretty: pretty, timeoutSeconds: timeoutSeconds, resourceVersion: resourceVersion, customHeaders: customHeaders, onEvent: onEvent, onError: onError, onClosed: onClosed, cancellationToken: cancellationToken);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <inheritdoc>
|
/// <inheritdoc/>
|
||||||
public Task<Watcher<V1alpha1ClusterRoleBinding>> WatchClusterRoleBindingAsync(
|
public Task<Watcher<V1alpha1ClusterRoleBinding>> WatchClusterRoleBindingAsync(
|
||||||
string name,
|
string name,
|
||||||
bool? allowWatchBookmarks = null,
|
bool? allowWatchBookmarks = null,
|
||||||
@@ -1382,7 +1382,7 @@ namespace k8s
|
|||||||
return WatchObjectAsync<V1alpha1ClusterRoleBinding>(path: path, @continue: @continue, fieldSelector: fieldSelector, labelSelector: labelSelector, limit: limit, pretty: pretty, timeoutSeconds: timeoutSeconds, resourceVersion: resourceVersion, customHeaders: customHeaders, onEvent: onEvent, onError: onError, onClosed: onClosed, cancellationToken: cancellationToken);
|
return WatchObjectAsync<V1alpha1ClusterRoleBinding>(path: path, @continue: @continue, fieldSelector: fieldSelector, labelSelector: labelSelector, limit: limit, pretty: pretty, timeoutSeconds: timeoutSeconds, resourceVersion: resourceVersion, customHeaders: customHeaders, onEvent: onEvent, onError: onError, onClosed: onClosed, cancellationToken: cancellationToken);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <inheritdoc>
|
/// <inheritdoc/>
|
||||||
public Task<Watcher<V1alpha1ClusterRole>> WatchClusterRoleAsync(
|
public Task<Watcher<V1alpha1ClusterRole>> WatchClusterRoleAsync(
|
||||||
string name,
|
string name,
|
||||||
bool? allowWatchBookmarks = null,
|
bool? allowWatchBookmarks = null,
|
||||||
@@ -1405,7 +1405,7 @@ namespace k8s
|
|||||||
return WatchObjectAsync<V1alpha1ClusterRole>(path: path, @continue: @continue, fieldSelector: fieldSelector, labelSelector: labelSelector, limit: limit, pretty: pretty, timeoutSeconds: timeoutSeconds, resourceVersion: resourceVersion, customHeaders: customHeaders, onEvent: onEvent, onError: onError, onClosed: onClosed, cancellationToken: cancellationToken);
|
return WatchObjectAsync<V1alpha1ClusterRole>(path: path, @continue: @continue, fieldSelector: fieldSelector, labelSelector: labelSelector, limit: limit, pretty: pretty, timeoutSeconds: timeoutSeconds, resourceVersion: resourceVersion, customHeaders: customHeaders, onEvent: onEvent, onError: onError, onClosed: onClosed, cancellationToken: cancellationToken);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <inheritdoc>
|
/// <inheritdoc/>
|
||||||
public Task<Watcher<V1alpha1RoleBinding>> WatchNamespacedRoleBindingAsync(
|
public Task<Watcher<V1alpha1RoleBinding>> WatchNamespacedRoleBindingAsync(
|
||||||
string name,
|
string name,
|
||||||
string @namespace,
|
string @namespace,
|
||||||
@@ -1429,7 +1429,7 @@ namespace k8s
|
|||||||
return WatchObjectAsync<V1alpha1RoleBinding>(path: path, @continue: @continue, fieldSelector: fieldSelector, labelSelector: labelSelector, limit: limit, pretty: pretty, timeoutSeconds: timeoutSeconds, resourceVersion: resourceVersion, customHeaders: customHeaders, onEvent: onEvent, onError: onError, onClosed: onClosed, cancellationToken: cancellationToken);
|
return WatchObjectAsync<V1alpha1RoleBinding>(path: path, @continue: @continue, fieldSelector: fieldSelector, labelSelector: labelSelector, limit: limit, pretty: pretty, timeoutSeconds: timeoutSeconds, resourceVersion: resourceVersion, customHeaders: customHeaders, onEvent: onEvent, onError: onError, onClosed: onClosed, cancellationToken: cancellationToken);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <inheritdoc>
|
/// <inheritdoc/>
|
||||||
public Task<Watcher<V1alpha1Role>> WatchNamespacedRoleAsync(
|
public Task<Watcher<V1alpha1Role>> WatchNamespacedRoleAsync(
|
||||||
string name,
|
string name,
|
||||||
string @namespace,
|
string @namespace,
|
||||||
@@ -1453,7 +1453,7 @@ namespace k8s
|
|||||||
return WatchObjectAsync<V1alpha1Role>(path: path, @continue: @continue, fieldSelector: fieldSelector, labelSelector: labelSelector, limit: limit, pretty: pretty, timeoutSeconds: timeoutSeconds, resourceVersion: resourceVersion, customHeaders: customHeaders, onEvent: onEvent, onError: onError, onClosed: onClosed, cancellationToken: cancellationToken);
|
return WatchObjectAsync<V1alpha1Role>(path: path, @continue: @continue, fieldSelector: fieldSelector, labelSelector: labelSelector, limit: limit, pretty: pretty, timeoutSeconds: timeoutSeconds, resourceVersion: resourceVersion, customHeaders: customHeaders, onEvent: onEvent, onError: onError, onClosed: onClosed, cancellationToken: cancellationToken);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <inheritdoc>
|
/// <inheritdoc/>
|
||||||
public Task<Watcher<V1beta1ClusterRoleBinding>> WatchClusterRoleBindingAsync(
|
public Task<Watcher<V1beta1ClusterRoleBinding>> WatchClusterRoleBindingAsync(
|
||||||
string name,
|
string name,
|
||||||
bool? allowWatchBookmarks = null,
|
bool? allowWatchBookmarks = null,
|
||||||
@@ -1476,7 +1476,7 @@ namespace k8s
|
|||||||
return WatchObjectAsync<V1beta1ClusterRoleBinding>(path: path, @continue: @continue, fieldSelector: fieldSelector, labelSelector: labelSelector, limit: limit, pretty: pretty, timeoutSeconds: timeoutSeconds, resourceVersion: resourceVersion, customHeaders: customHeaders, onEvent: onEvent, onError: onError, onClosed: onClosed, cancellationToken: cancellationToken);
|
return WatchObjectAsync<V1beta1ClusterRoleBinding>(path: path, @continue: @continue, fieldSelector: fieldSelector, labelSelector: labelSelector, limit: limit, pretty: pretty, timeoutSeconds: timeoutSeconds, resourceVersion: resourceVersion, customHeaders: customHeaders, onEvent: onEvent, onError: onError, onClosed: onClosed, cancellationToken: cancellationToken);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <inheritdoc>
|
/// <inheritdoc/>
|
||||||
public Task<Watcher<V1beta1ClusterRole>> WatchClusterRoleAsync(
|
public Task<Watcher<V1beta1ClusterRole>> WatchClusterRoleAsync(
|
||||||
string name,
|
string name,
|
||||||
bool? allowWatchBookmarks = null,
|
bool? allowWatchBookmarks = null,
|
||||||
@@ -1499,7 +1499,7 @@ namespace k8s
|
|||||||
return WatchObjectAsync<V1beta1ClusterRole>(path: path, @continue: @continue, fieldSelector: fieldSelector, labelSelector: labelSelector, limit: limit, pretty: pretty, timeoutSeconds: timeoutSeconds, resourceVersion: resourceVersion, customHeaders: customHeaders, onEvent: onEvent, onError: onError, onClosed: onClosed, cancellationToken: cancellationToken);
|
return WatchObjectAsync<V1beta1ClusterRole>(path: path, @continue: @continue, fieldSelector: fieldSelector, labelSelector: labelSelector, limit: limit, pretty: pretty, timeoutSeconds: timeoutSeconds, resourceVersion: resourceVersion, customHeaders: customHeaders, onEvent: onEvent, onError: onError, onClosed: onClosed, cancellationToken: cancellationToken);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <inheritdoc>
|
/// <inheritdoc/>
|
||||||
public Task<Watcher<V1beta1RoleBinding>> WatchNamespacedRoleBindingAsync(
|
public Task<Watcher<V1beta1RoleBinding>> WatchNamespacedRoleBindingAsync(
|
||||||
string name,
|
string name,
|
||||||
string @namespace,
|
string @namespace,
|
||||||
@@ -1523,7 +1523,7 @@ namespace k8s
|
|||||||
return WatchObjectAsync<V1beta1RoleBinding>(path: path, @continue: @continue, fieldSelector: fieldSelector, labelSelector: labelSelector, limit: limit, pretty: pretty, timeoutSeconds: timeoutSeconds, resourceVersion: resourceVersion, customHeaders: customHeaders, onEvent: onEvent, onError: onError, onClosed: onClosed, cancellationToken: cancellationToken);
|
return WatchObjectAsync<V1beta1RoleBinding>(path: path, @continue: @continue, fieldSelector: fieldSelector, labelSelector: labelSelector, limit: limit, pretty: pretty, timeoutSeconds: timeoutSeconds, resourceVersion: resourceVersion, customHeaders: customHeaders, onEvent: onEvent, onError: onError, onClosed: onClosed, cancellationToken: cancellationToken);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <inheritdoc>
|
/// <inheritdoc/>
|
||||||
public Task<Watcher<V1beta1Role>> WatchNamespacedRoleAsync(
|
public Task<Watcher<V1beta1Role>> WatchNamespacedRoleAsync(
|
||||||
string name,
|
string name,
|
||||||
string @namespace,
|
string @namespace,
|
||||||
@@ -1547,7 +1547,7 @@ namespace k8s
|
|||||||
return WatchObjectAsync<V1beta1Role>(path: path, @continue: @continue, fieldSelector: fieldSelector, labelSelector: labelSelector, limit: limit, pretty: pretty, timeoutSeconds: timeoutSeconds, resourceVersion: resourceVersion, customHeaders: customHeaders, onEvent: onEvent, onError: onError, onClosed: onClosed, cancellationToken: cancellationToken);
|
return WatchObjectAsync<V1beta1Role>(path: path, @continue: @continue, fieldSelector: fieldSelector, labelSelector: labelSelector, limit: limit, pretty: pretty, timeoutSeconds: timeoutSeconds, resourceVersion: resourceVersion, customHeaders: customHeaders, onEvent: onEvent, onError: onError, onClosed: onClosed, cancellationToken: cancellationToken);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <inheritdoc>
|
/// <inheritdoc/>
|
||||||
public Task<Watcher<V1PriorityClass>> WatchPriorityClassAsync(
|
public Task<Watcher<V1PriorityClass>> WatchPriorityClassAsync(
|
||||||
string name,
|
string name,
|
||||||
bool? allowWatchBookmarks = null,
|
bool? allowWatchBookmarks = null,
|
||||||
@@ -1570,7 +1570,7 @@ namespace k8s
|
|||||||
return WatchObjectAsync<V1PriorityClass>(path: path, @continue: @continue, fieldSelector: fieldSelector, labelSelector: labelSelector, limit: limit, pretty: pretty, timeoutSeconds: timeoutSeconds, resourceVersion: resourceVersion, customHeaders: customHeaders, onEvent: onEvent, onError: onError, onClosed: onClosed, cancellationToken: cancellationToken);
|
return WatchObjectAsync<V1PriorityClass>(path: path, @continue: @continue, fieldSelector: fieldSelector, labelSelector: labelSelector, limit: limit, pretty: pretty, timeoutSeconds: timeoutSeconds, resourceVersion: resourceVersion, customHeaders: customHeaders, onEvent: onEvent, onError: onError, onClosed: onClosed, cancellationToken: cancellationToken);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <inheritdoc>
|
/// <inheritdoc/>
|
||||||
public Task<Watcher<V1alpha1PriorityClass>> WatchPriorityClassAsync(
|
public Task<Watcher<V1alpha1PriorityClass>> WatchPriorityClassAsync(
|
||||||
string name,
|
string name,
|
||||||
bool? allowWatchBookmarks = null,
|
bool? allowWatchBookmarks = null,
|
||||||
@@ -1593,7 +1593,7 @@ namespace k8s
|
|||||||
return WatchObjectAsync<V1alpha1PriorityClass>(path: path, @continue: @continue, fieldSelector: fieldSelector, labelSelector: labelSelector, limit: limit, pretty: pretty, timeoutSeconds: timeoutSeconds, resourceVersion: resourceVersion, customHeaders: customHeaders, onEvent: onEvent, onError: onError, onClosed: onClosed, cancellationToken: cancellationToken);
|
return WatchObjectAsync<V1alpha1PriorityClass>(path: path, @continue: @continue, fieldSelector: fieldSelector, labelSelector: labelSelector, limit: limit, pretty: pretty, timeoutSeconds: timeoutSeconds, resourceVersion: resourceVersion, customHeaders: customHeaders, onEvent: onEvent, onError: onError, onClosed: onClosed, cancellationToken: cancellationToken);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <inheritdoc>
|
/// <inheritdoc/>
|
||||||
public Task<Watcher<V1beta1PriorityClass>> WatchPriorityClassAsync(
|
public Task<Watcher<V1beta1PriorityClass>> WatchPriorityClassAsync(
|
||||||
string name,
|
string name,
|
||||||
bool? allowWatchBookmarks = null,
|
bool? allowWatchBookmarks = null,
|
||||||
@@ -1616,7 +1616,7 @@ namespace k8s
|
|||||||
return WatchObjectAsync<V1beta1PriorityClass>(path: path, @continue: @continue, fieldSelector: fieldSelector, labelSelector: labelSelector, limit: limit, pretty: pretty, timeoutSeconds: timeoutSeconds, resourceVersion: resourceVersion, customHeaders: customHeaders, onEvent: onEvent, onError: onError, onClosed: onClosed, cancellationToken: cancellationToken);
|
return WatchObjectAsync<V1beta1PriorityClass>(path: path, @continue: @continue, fieldSelector: fieldSelector, labelSelector: labelSelector, limit: limit, pretty: pretty, timeoutSeconds: timeoutSeconds, resourceVersion: resourceVersion, customHeaders: customHeaders, onEvent: onEvent, onError: onError, onClosed: onClosed, cancellationToken: cancellationToken);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <inheritdoc>
|
/// <inheritdoc/>
|
||||||
public Task<Watcher<V1alpha1PodPreset>> WatchNamespacedPodPresetAsync(
|
public Task<Watcher<V1alpha1PodPreset>> WatchNamespacedPodPresetAsync(
|
||||||
string name,
|
string name,
|
||||||
string @namespace,
|
string @namespace,
|
||||||
@@ -1640,7 +1640,7 @@ namespace k8s
|
|||||||
return WatchObjectAsync<V1alpha1PodPreset>(path: path, @continue: @continue, fieldSelector: fieldSelector, labelSelector: labelSelector, limit: limit, pretty: pretty, timeoutSeconds: timeoutSeconds, resourceVersion: resourceVersion, customHeaders: customHeaders, onEvent: onEvent, onError: onError, onClosed: onClosed, cancellationToken: cancellationToken);
|
return WatchObjectAsync<V1alpha1PodPreset>(path: path, @continue: @continue, fieldSelector: fieldSelector, labelSelector: labelSelector, limit: limit, pretty: pretty, timeoutSeconds: timeoutSeconds, resourceVersion: resourceVersion, customHeaders: customHeaders, onEvent: onEvent, onError: onError, onClosed: onClosed, cancellationToken: cancellationToken);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <inheritdoc>
|
/// <inheritdoc/>
|
||||||
public Task<Watcher<V1CSIDriver>> WatchCSIDriverAsync(
|
public Task<Watcher<V1CSIDriver>> WatchCSIDriverAsync(
|
||||||
string name,
|
string name,
|
||||||
bool? allowWatchBookmarks = null,
|
bool? allowWatchBookmarks = null,
|
||||||
@@ -1663,7 +1663,7 @@ namespace k8s
|
|||||||
return WatchObjectAsync<V1CSIDriver>(path: path, @continue: @continue, fieldSelector: fieldSelector, labelSelector: labelSelector, limit: limit, pretty: pretty, timeoutSeconds: timeoutSeconds, resourceVersion: resourceVersion, customHeaders: customHeaders, onEvent: onEvent, onError: onError, onClosed: onClosed, cancellationToken: cancellationToken);
|
return WatchObjectAsync<V1CSIDriver>(path: path, @continue: @continue, fieldSelector: fieldSelector, labelSelector: labelSelector, limit: limit, pretty: pretty, timeoutSeconds: timeoutSeconds, resourceVersion: resourceVersion, customHeaders: customHeaders, onEvent: onEvent, onError: onError, onClosed: onClosed, cancellationToken: cancellationToken);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <inheritdoc>
|
/// <inheritdoc/>
|
||||||
public Task<Watcher<V1CSINode>> WatchCSINodeAsync(
|
public Task<Watcher<V1CSINode>> WatchCSINodeAsync(
|
||||||
string name,
|
string name,
|
||||||
bool? allowWatchBookmarks = null,
|
bool? allowWatchBookmarks = null,
|
||||||
@@ -1686,7 +1686,7 @@ namespace k8s
|
|||||||
return WatchObjectAsync<V1CSINode>(path: path, @continue: @continue, fieldSelector: fieldSelector, labelSelector: labelSelector, limit: limit, pretty: pretty, timeoutSeconds: timeoutSeconds, resourceVersion: resourceVersion, customHeaders: customHeaders, onEvent: onEvent, onError: onError, onClosed: onClosed, cancellationToken: cancellationToken);
|
return WatchObjectAsync<V1CSINode>(path: path, @continue: @continue, fieldSelector: fieldSelector, labelSelector: labelSelector, limit: limit, pretty: pretty, timeoutSeconds: timeoutSeconds, resourceVersion: resourceVersion, customHeaders: customHeaders, onEvent: onEvent, onError: onError, onClosed: onClosed, cancellationToken: cancellationToken);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <inheritdoc>
|
/// <inheritdoc/>
|
||||||
public Task<Watcher<V1StorageClass>> WatchStorageClassAsync(
|
public Task<Watcher<V1StorageClass>> WatchStorageClassAsync(
|
||||||
string name,
|
string name,
|
||||||
bool? allowWatchBookmarks = null,
|
bool? allowWatchBookmarks = null,
|
||||||
@@ -1709,7 +1709,7 @@ namespace k8s
|
|||||||
return WatchObjectAsync<V1StorageClass>(path: path, @continue: @continue, fieldSelector: fieldSelector, labelSelector: labelSelector, limit: limit, pretty: pretty, timeoutSeconds: timeoutSeconds, resourceVersion: resourceVersion, customHeaders: customHeaders, onEvent: onEvent, onError: onError, onClosed: onClosed, cancellationToken: cancellationToken);
|
return WatchObjectAsync<V1StorageClass>(path: path, @continue: @continue, fieldSelector: fieldSelector, labelSelector: labelSelector, limit: limit, pretty: pretty, timeoutSeconds: timeoutSeconds, resourceVersion: resourceVersion, customHeaders: customHeaders, onEvent: onEvent, onError: onError, onClosed: onClosed, cancellationToken: cancellationToken);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <inheritdoc>
|
/// <inheritdoc/>
|
||||||
public Task<Watcher<V1VolumeAttachment>> WatchVolumeAttachmentAsync(
|
public Task<Watcher<V1VolumeAttachment>> WatchVolumeAttachmentAsync(
|
||||||
string name,
|
string name,
|
||||||
bool? allowWatchBookmarks = null,
|
bool? allowWatchBookmarks = null,
|
||||||
@@ -1732,7 +1732,7 @@ namespace k8s
|
|||||||
return WatchObjectAsync<V1VolumeAttachment>(path: path, @continue: @continue, fieldSelector: fieldSelector, labelSelector: labelSelector, limit: limit, pretty: pretty, timeoutSeconds: timeoutSeconds, resourceVersion: resourceVersion, customHeaders: customHeaders, onEvent: onEvent, onError: onError, onClosed: onClosed, cancellationToken: cancellationToken);
|
return WatchObjectAsync<V1VolumeAttachment>(path: path, @continue: @continue, fieldSelector: fieldSelector, labelSelector: labelSelector, limit: limit, pretty: pretty, timeoutSeconds: timeoutSeconds, resourceVersion: resourceVersion, customHeaders: customHeaders, onEvent: onEvent, onError: onError, onClosed: onClosed, cancellationToken: cancellationToken);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <inheritdoc>
|
/// <inheritdoc/>
|
||||||
public Task<Watcher<V1alpha1VolumeAttachment>> WatchVolumeAttachmentAsync(
|
public Task<Watcher<V1alpha1VolumeAttachment>> WatchVolumeAttachmentAsync(
|
||||||
string name,
|
string name,
|
||||||
bool? allowWatchBookmarks = null,
|
bool? allowWatchBookmarks = null,
|
||||||
@@ -1755,7 +1755,7 @@ namespace k8s
|
|||||||
return WatchObjectAsync<V1alpha1VolumeAttachment>(path: path, @continue: @continue, fieldSelector: fieldSelector, labelSelector: labelSelector, limit: limit, pretty: pretty, timeoutSeconds: timeoutSeconds, resourceVersion: resourceVersion, customHeaders: customHeaders, onEvent: onEvent, onError: onError, onClosed: onClosed, cancellationToken: cancellationToken);
|
return WatchObjectAsync<V1alpha1VolumeAttachment>(path: path, @continue: @continue, fieldSelector: fieldSelector, labelSelector: labelSelector, limit: limit, pretty: pretty, timeoutSeconds: timeoutSeconds, resourceVersion: resourceVersion, customHeaders: customHeaders, onEvent: onEvent, onError: onError, onClosed: onClosed, cancellationToken: cancellationToken);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <inheritdoc>
|
/// <inheritdoc/>
|
||||||
public Task<Watcher<V1beta1CSIDriver>> WatchCSIDriverAsync(
|
public Task<Watcher<V1beta1CSIDriver>> WatchCSIDriverAsync(
|
||||||
string name,
|
string name,
|
||||||
bool? allowWatchBookmarks = null,
|
bool? allowWatchBookmarks = null,
|
||||||
@@ -1778,7 +1778,7 @@ namespace k8s
|
|||||||
return WatchObjectAsync<V1beta1CSIDriver>(path: path, @continue: @continue, fieldSelector: fieldSelector, labelSelector: labelSelector, limit: limit, pretty: pretty, timeoutSeconds: timeoutSeconds, resourceVersion: resourceVersion, customHeaders: customHeaders, onEvent: onEvent, onError: onError, onClosed: onClosed, cancellationToken: cancellationToken);
|
return WatchObjectAsync<V1beta1CSIDriver>(path: path, @continue: @continue, fieldSelector: fieldSelector, labelSelector: labelSelector, limit: limit, pretty: pretty, timeoutSeconds: timeoutSeconds, resourceVersion: resourceVersion, customHeaders: customHeaders, onEvent: onEvent, onError: onError, onClosed: onClosed, cancellationToken: cancellationToken);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <inheritdoc>
|
/// <inheritdoc/>
|
||||||
public Task<Watcher<V1beta1CSINode>> WatchCSINodeAsync(
|
public Task<Watcher<V1beta1CSINode>> WatchCSINodeAsync(
|
||||||
string name,
|
string name,
|
||||||
bool? allowWatchBookmarks = null,
|
bool? allowWatchBookmarks = null,
|
||||||
@@ -1801,7 +1801,7 @@ namespace k8s
|
|||||||
return WatchObjectAsync<V1beta1CSINode>(path: path, @continue: @continue, fieldSelector: fieldSelector, labelSelector: labelSelector, limit: limit, pretty: pretty, timeoutSeconds: timeoutSeconds, resourceVersion: resourceVersion, customHeaders: customHeaders, onEvent: onEvent, onError: onError, onClosed: onClosed, cancellationToken: cancellationToken);
|
return WatchObjectAsync<V1beta1CSINode>(path: path, @continue: @continue, fieldSelector: fieldSelector, labelSelector: labelSelector, limit: limit, pretty: pretty, timeoutSeconds: timeoutSeconds, resourceVersion: resourceVersion, customHeaders: customHeaders, onEvent: onEvent, onError: onError, onClosed: onClosed, cancellationToken: cancellationToken);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <inheritdoc>
|
/// <inheritdoc/>
|
||||||
public Task<Watcher<V1beta1StorageClass>> WatchStorageClassAsync(
|
public Task<Watcher<V1beta1StorageClass>> WatchStorageClassAsync(
|
||||||
string name,
|
string name,
|
||||||
bool? allowWatchBookmarks = null,
|
bool? allowWatchBookmarks = null,
|
||||||
@@ -1824,7 +1824,7 @@ namespace k8s
|
|||||||
return WatchObjectAsync<V1beta1StorageClass>(path: path, @continue: @continue, fieldSelector: fieldSelector, labelSelector: labelSelector, limit: limit, pretty: pretty, timeoutSeconds: timeoutSeconds, resourceVersion: resourceVersion, customHeaders: customHeaders, onEvent: onEvent, onError: onError, onClosed: onClosed, cancellationToken: cancellationToken);
|
return WatchObjectAsync<V1beta1StorageClass>(path: path, @continue: @continue, fieldSelector: fieldSelector, labelSelector: labelSelector, limit: limit, pretty: pretty, timeoutSeconds: timeoutSeconds, resourceVersion: resourceVersion, customHeaders: customHeaders, onEvent: onEvent, onError: onError, onClosed: onClosed, cancellationToken: cancellationToken);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <inheritdoc>
|
/// <inheritdoc/>
|
||||||
public Task<Watcher<V1beta1VolumeAttachment>> WatchVolumeAttachmentAsync(
|
public Task<Watcher<V1beta1VolumeAttachment>> WatchVolumeAttachmentAsync(
|
||||||
string name,
|
string name,
|
||||||
bool? allowWatchBookmarks = null,
|
bool? allowWatchBookmarks = null,
|
||||||
|
|||||||
@@ -109,7 +109,6 @@ namespace k8s.E2E
|
|||||||
pod = client.ListNamespacedPod(namespaceParameter).Items.First(p => p.Metadata.Name == podName);
|
pod = client.ListNamespacedPod(namespaceParameter).Items.First(p => p.Metadata.Name == podName);
|
||||||
|
|
||||||
Assert.Equal("test-jsonpatch", pod.Labels()["test"]);
|
Assert.Equal("test-jsonpatch", pod.Labels()["test"]);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -167,7 +167,7 @@ namespace k8s.Tests
|
|||||||
|
|
||||||
#if NETCOREAPP2_1 // The functionality under test, here, is dependent on managed HTTP / WebSocket in .NET Core 2.1 or newer.
|
#if NETCOREAPP2_1 // The functionality under test, here, is dependent on managed HTTP / WebSocket in .NET Core 2.1 or newer.
|
||||||
// this test doesn't work on OSX and is inconsistent on windows
|
// this test doesn't work on OSX and is inconsistent on windows
|
||||||
[OperatingSystemDependentFact(Exclude = OperatingSystem.OSX | OperatingSystem.Windows)]
|
[OperatingSystemDependentFact(Exclude = OperatingSystems.OSX | OperatingSystems.Windows)]
|
||||||
public void Cert()
|
public void Cert()
|
||||||
{
|
{
|
||||||
var serverCertificateData = File.ReadAllText("assets/apiserver-pfx-data.txt");
|
var serverCertificateData = File.ReadAllText("assets/apiserver-pfx-data.txt");
|
||||||
@@ -179,7 +179,7 @@ namespace k8s.Tests
|
|||||||
|
|
||||||
if (RuntimeInformation.IsOSPlatform(OSPlatform.OSX))
|
if (RuntimeInformation.IsOSPlatform(OSPlatform.OSX))
|
||||||
{
|
{
|
||||||
using (MemoryStream serverCertificateStream =
|
using (var serverCertificateStream =
|
||||||
new MemoryStream(Convert.FromBase64String(serverCertificateData)))
|
new MemoryStream(Convert.FromBase64String(serverCertificateData)))
|
||||||
{
|
{
|
||||||
serverCertificate = OpenCertificateStore(serverCertificateStream);
|
serverCertificate = OpenCertificateStore(serverCertificateStream);
|
||||||
@@ -272,7 +272,7 @@ namespace k8s.Tests
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
[OperatingSystemDependentFact(Exclude = OperatingSystem.OSX | OperatingSystem.Windows)]
|
[OperatingSystemDependentFact(Exclude = OperatingSystems.OSX | OperatingSystems.Windows)]
|
||||||
public void ExternalCertificate()
|
public void ExternalCertificate()
|
||||||
{
|
{
|
||||||
const string name = "testing_irrelevant";
|
const string name = "testing_irrelevant";
|
||||||
@@ -286,7 +286,7 @@ namespace k8s.Tests
|
|||||||
|
|
||||||
if (RuntimeInformation.IsOSPlatform(OSPlatform.OSX))
|
if (RuntimeInformation.IsOSPlatform(OSPlatform.OSX))
|
||||||
{
|
{
|
||||||
using (MemoryStream serverCertificateStream = new MemoryStream(serverCertificateData))
|
using (var serverCertificateStream = new MemoryStream(serverCertificateData))
|
||||||
{
|
{
|
||||||
serverCertificate = OpenCertificateStore(serverCertificateStream);
|
serverCertificate = OpenCertificateStore(serverCertificateStream);
|
||||||
}
|
}
|
||||||
@@ -457,7 +457,7 @@ namespace k8s.Tests
|
|||||||
|
|
||||||
private X509Certificate2 OpenCertificateStore(Stream stream)
|
private X509Certificate2 OpenCertificateStore(Stream stream)
|
||||||
{
|
{
|
||||||
Pkcs12Store store = new Pkcs12Store();
|
var store = new Pkcs12Store();
|
||||||
store.Load(stream, new char[] { });
|
store.Load(stream, new char[] { });
|
||||||
|
|
||||||
var keyAlias = store.Aliases.Cast<string>().SingleOrDefault(a => store.IsKeyEntry(a));
|
var keyAlias = store.Aliases.Cast<string>().SingleOrDefault(a => store.IsKeyEntry(a));
|
||||||
@@ -468,7 +468,7 @@ namespace k8s.Tests
|
|||||||
var certificate = new X509Certificate2(DotNetUtilities.ToX509Certificate(bouncyCertificate));
|
var certificate = new X509Certificate2(DotNetUtilities.ToX509Certificate(bouncyCertificate));
|
||||||
var parameters = DotNetUtilities.ToRSAParameters(key);
|
var parameters = DotNetUtilities.ToRSAParameters(key);
|
||||||
|
|
||||||
RSACryptoServiceProvider rsa = new RSACryptoServiceProvider();
|
var rsa = new RSACryptoServiceProvider();
|
||||||
rsa.ImportParameters(parameters);
|
rsa.ImportParameters(parameters);
|
||||||
|
|
||||||
certificate = RSACertificateExtensions.CopyWithPrivateKey(certificate, rsa);
|
certificate = RSACertificateExtensions.CopyWithPrivateKey(certificate, rsa);
|
||||||
|
|||||||
@@ -21,7 +21,7 @@ namespace k8s.Tests
|
|||||||
[Fact]
|
[Fact]
|
||||||
public void LinearReadWriteTest()
|
public void LinearReadWriteTest()
|
||||||
{
|
{
|
||||||
ByteBuffer buffer = new ByteBuffer(bufferSize: 0x10, maximumSize: 0x100);
|
var buffer = new ByteBuffer(0x10, 0x100);
|
||||||
|
|
||||||
// There's no real guarantee that this will be the case because the ArrayPool does not guarantee
|
// There's no real guarantee that this will be the case because the ArrayPool does not guarantee
|
||||||
// a specific buffer size. So let's assert this first to make sure the test fails should this
|
// a specific buffer size. So let's assert this first to make sure the test fails should this
|
||||||
@@ -35,7 +35,7 @@ namespace k8s.Tests
|
|||||||
Assert.Equal(0, buffer.WriteWaterMark);
|
Assert.Equal(0, buffer.WriteWaterMark);
|
||||||
|
|
||||||
// Write two bytes
|
// Write two bytes
|
||||||
buffer.Write(this.writeData, 0, 2);
|
buffer.Write(writeData, 0, 2);
|
||||||
|
|
||||||
Assert.Equal(2, buffer.AvailableReadableBytes);
|
Assert.Equal(2, buffer.AvailableReadableBytes);
|
||||||
Assert.Equal(0x0E, buffer.AvailableWritableBytes);
|
Assert.Equal(0x0E, buffer.AvailableWritableBytes);
|
||||||
@@ -43,7 +43,7 @@ namespace k8s.Tests
|
|||||||
Assert.Equal(2, buffer.WriteWaterMark);
|
Assert.Equal(2, buffer.WriteWaterMark);
|
||||||
|
|
||||||
// Read two bytes, one byte at a time
|
// Read two bytes, one byte at a time
|
||||||
byte[] readData = new byte[0x10];
|
var readData = new byte[0x10];
|
||||||
|
|
||||||
var read = buffer.Read(readData, 0, 1);
|
var read = buffer.Read(readData, 0, 1);
|
||||||
Assert.Equal(1, read);
|
Assert.Equal(1, read);
|
||||||
@@ -79,7 +79,7 @@ namespace k8s.Tests
|
|||||||
[Fact]
|
[Fact]
|
||||||
public void BoundaryReadWriteTest()
|
public void BoundaryReadWriteTest()
|
||||||
{
|
{
|
||||||
ByteBuffer buffer = new ByteBuffer(bufferSize: 0x10, maximumSize: 0x100);
|
var buffer = new ByteBuffer(0x10, 0x100);
|
||||||
|
|
||||||
// There's no real guarantee that this will be the case because the ArrayPool does not guarantee
|
// There's no real guarantee that this will be the case because the ArrayPool does not guarantee
|
||||||
// a specific buffer size. So let's assert this first to make sure the test fails should this
|
// a specific buffer size. So let's assert this first to make sure the test fails should this
|
||||||
@@ -87,7 +87,7 @@ namespace k8s.Tests
|
|||||||
Assert.Equal(0x10, buffer.Size);
|
Assert.Equal(0x10, buffer.Size);
|
||||||
|
|
||||||
// Write out 0x0A bytes to the buffer, to increase the high water level for writing bytes
|
// Write out 0x0A bytes to the buffer, to increase the high water level for writing bytes
|
||||||
buffer.Write(this.writeData, 0, 0x0A);
|
buffer.Write(writeData, 0, 0x0A);
|
||||||
|
|
||||||
// Assert the initial values.
|
// Assert the initial values.
|
||||||
Assert.Equal(0x0A, buffer.AvailableReadableBytes);
|
Assert.Equal(0x0A, buffer.AvailableReadableBytes);
|
||||||
@@ -96,7 +96,7 @@ namespace k8s.Tests
|
|||||||
Assert.Equal(0x0A, buffer.WriteWaterMark);
|
Assert.Equal(0x0A, buffer.WriteWaterMark);
|
||||||
|
|
||||||
// Read 0x0A bytes, to increase the high water level for reading bytes
|
// Read 0x0A bytes, to increase the high water level for reading bytes
|
||||||
byte[] readData = new byte[0x10];
|
var readData = new byte[0x10];
|
||||||
var read = buffer.Read(readData, 0, 0x0A);
|
var read = buffer.Read(readData, 0, 0x0A);
|
||||||
Assert.Equal(0x0A, read);
|
Assert.Equal(0x0A, read);
|
||||||
|
|
||||||
@@ -107,9 +107,9 @@ namespace k8s.Tests
|
|||||||
|
|
||||||
// Write an additional 0x0A bytes, but now in reverse order. This will cause the data
|
// Write an additional 0x0A bytes, but now in reverse order. This will cause the data
|
||||||
// to be wrapped.
|
// to be wrapped.
|
||||||
Array.Reverse(this.writeData);
|
Array.Reverse(writeData);
|
||||||
|
|
||||||
buffer.Write(this.writeData, 0, 0x0A);
|
buffer.Write(writeData, 0, 0x0A);
|
||||||
|
|
||||||
// Assert the resulting state of the buffer.
|
// Assert the resulting state of the buffer.
|
||||||
Assert.Equal(0x0A, buffer.AvailableReadableBytes);
|
Assert.Equal(0x0A, buffer.AvailableReadableBytes);
|
||||||
@@ -147,7 +147,7 @@ namespace k8s.Tests
|
|||||||
[Fact]
|
[Fact]
|
||||||
public void ResizeWriteTest()
|
public void ResizeWriteTest()
|
||||||
{
|
{
|
||||||
ByteBuffer buffer = new ByteBuffer(bufferSize: 0x10, maximumSize: 0x100);
|
var buffer = new ByteBuffer(0x10, 0x100);
|
||||||
|
|
||||||
// There's no real guarantee that this will be the case because the ArrayPool does not guarantee
|
// There's no real guarantee that this will be the case because the ArrayPool does not guarantee
|
||||||
// a specific buffer size. So let's assert this first to make sure the test fails should this
|
// a specific buffer size. So let's assert this first to make sure the test fails should this
|
||||||
@@ -155,9 +155,9 @@ namespace k8s.Tests
|
|||||||
Assert.Equal(0x10, buffer.Size);
|
Assert.Equal(0x10, buffer.Size);
|
||||||
|
|
||||||
// Write out 0x0A bytes to the buffer, to increase the high water level for writing bytes
|
// Write out 0x0A bytes to the buffer, to increase the high water level for writing bytes
|
||||||
buffer.Write(this.writeData, 0, 0x0A);
|
buffer.Write(writeData, 0, 0x0A);
|
||||||
|
|
||||||
byte[] readData = new byte[0x20];
|
var readData = new byte[0x20];
|
||||||
|
|
||||||
// Read these 0x0A bytes.
|
// Read these 0x0A bytes.
|
||||||
var read = buffer.Read(readData, 0, 0x0A);
|
var read = buffer.Read(readData, 0, 0x0A);
|
||||||
@@ -170,7 +170,7 @@ namespace k8s.Tests
|
|||||||
Assert.Equal(0x0A, buffer.WriteWaterMark);
|
Assert.Equal(0x0A, buffer.WriteWaterMark);
|
||||||
|
|
||||||
// Write out 0x0A bytes to the buffer, this will cause the buffer to wrap
|
// Write out 0x0A bytes to the buffer, this will cause the buffer to wrap
|
||||||
buffer.Write(this.writeData, 0, 0x0A);
|
buffer.Write(writeData, 0, 0x0A);
|
||||||
|
|
||||||
Assert.Equal(0x0A, buffer.AvailableReadableBytes);
|
Assert.Equal(0x0A, buffer.AvailableReadableBytes);
|
||||||
Assert.Equal(0x06, buffer.AvailableWritableBytes);
|
Assert.Equal(0x06, buffer.AvailableWritableBytes);
|
||||||
@@ -178,9 +178,9 @@ namespace k8s.Tests
|
|||||||
Assert.Equal(0x04, buffer.WriteWaterMark);
|
Assert.Equal(0x04, buffer.WriteWaterMark);
|
||||||
|
|
||||||
// Write an additional 0x0A bytes, but now in reverse order. This will cause the buffer to be resized.
|
// Write an additional 0x0A bytes, but now in reverse order. This will cause the buffer to be resized.
|
||||||
Array.Reverse(this.writeData);
|
Array.Reverse(writeData);
|
||||||
|
|
||||||
buffer.Write(this.writeData, 0, 0x0A);
|
buffer.Write(writeData, 0, 0x0A);
|
||||||
|
|
||||||
// Make sure the buffer has been resized.
|
// Make sure the buffer has been resized.
|
||||||
Assert.Equal(0x20, buffer.Size);
|
Assert.Equal(0x20, buffer.Size);
|
||||||
@@ -226,7 +226,7 @@ namespace k8s.Tests
|
|||||||
var readData = new byte[0x10];
|
var readData = new byte[0x10];
|
||||||
|
|
||||||
// Read 0x010 bytes of data when only 0x06 are available
|
// Read 0x010 bytes of data when only 0x06 are available
|
||||||
buffer.Write(this.writeData, 0, 0x06);
|
buffer.Write(writeData, 0, 0x06);
|
||||||
|
|
||||||
var read = buffer.Read(readData, 0, readData.Length);
|
var read = buffer.Read(readData, 0, readData.Length);
|
||||||
Assert.Equal(0x06, read);
|
Assert.Equal(0x06, read);
|
||||||
@@ -258,12 +258,12 @@ namespace k8s.Tests
|
|||||||
Assert.False(readTask.IsCompleted, "Read task completed before data was available.");
|
Assert.False(readTask.IsCompleted, "Read task completed before data was available.");
|
||||||
|
|
||||||
// Write data to the buffer
|
// Write data to the buffer
|
||||||
buffer.Write(this.writeData, 0, 0x03);
|
buffer.Write(writeData, 0, 0x03);
|
||||||
|
|
||||||
await TaskAssert.Completed(
|
await TaskAssert.Completed(
|
||||||
readTask,
|
readTask,
|
||||||
timeout: TimeSpan.FromMilliseconds(1000),
|
TimeSpan.FromMilliseconds(1000),
|
||||||
message: "Timed out waiting for read task to complete.").ConfigureAwait(false);
|
"Timed out waiting for read task to complete.").ConfigureAwait(false);
|
||||||
|
|
||||||
Assert.Equal(3, read);
|
Assert.Equal(3, read);
|
||||||
Assert.Equal(0xF0, readData[0]);
|
Assert.Equal(0xF0, readData[0]);
|
||||||
@@ -278,15 +278,15 @@ namespace k8s.Tests
|
|||||||
[Fact]
|
[Fact]
|
||||||
public void ReadUntilEndOfFileTest()
|
public void ReadUntilEndOfFileTest()
|
||||||
{
|
{
|
||||||
ByteBuffer buffer = new ByteBuffer(bufferSize: 0x10, maximumSize: 0x100);
|
var buffer = new ByteBuffer(0x10, 0x100);
|
||||||
|
|
||||||
// There's no real guarantee that this will be the case because the ArrayPool does not guarantee
|
// There's no real guarantee that this will be the case because the ArrayPool does not guarantee
|
||||||
// a specific buffer size. So let's assert this first to make sure the test fails should this
|
// a specific buffer size. So let's assert this first to make sure the test fails should this
|
||||||
// assumption not hold.
|
// assumption not hold.
|
||||||
Assert.Equal(0x10, buffer.Size);
|
Assert.Equal(0x10, buffer.Size);
|
||||||
|
|
||||||
buffer.Write(this.writeData, 0, 2);
|
buffer.Write(writeData, 0, 2);
|
||||||
buffer.Write(this.writeData, 2, 2);
|
buffer.Write(writeData, 2, 2);
|
||||||
buffer.WriteEnd();
|
buffer.WriteEnd();
|
||||||
|
|
||||||
// Assert the initial state of the buffer
|
// Assert the initial state of the buffer
|
||||||
@@ -296,7 +296,7 @@ namespace k8s.Tests
|
|||||||
Assert.Equal(0x04, buffer.WriteWaterMark);
|
Assert.Equal(0x04, buffer.WriteWaterMark);
|
||||||
|
|
||||||
// Read the data on a chunk-by-chunk basis
|
// Read the data on a chunk-by-chunk basis
|
||||||
byte[] readData = new byte[0x03];
|
var readData = new byte[0x03];
|
||||||
var read = buffer.Read(readData, 0, 3);
|
var read = buffer.Read(readData, 0, 3);
|
||||||
Assert.Equal(3, read);
|
Assert.Equal(3, read);
|
||||||
Assert.Equal(0xF0, readData[0]);
|
Assert.Equal(0xF0, readData[0]);
|
||||||
@@ -314,15 +314,15 @@ namespace k8s.Tests
|
|||||||
[Fact]
|
[Fact]
|
||||||
public void ReadUntilEndOfFileTest2()
|
public void ReadUntilEndOfFileTest2()
|
||||||
{
|
{
|
||||||
ByteBuffer buffer = new ByteBuffer(bufferSize: 0x10, maximumSize: 0x100);
|
var buffer = new ByteBuffer(0x10, 0x100);
|
||||||
|
|
||||||
// There's no real guarantee that this will be the case because the ArrayPool does not guarantee
|
// There's no real guarantee that this will be the case because the ArrayPool does not guarantee
|
||||||
// a specific buffer size. So let's assert this first to make sure the test fails should this
|
// a specific buffer size. So let's assert this first to make sure the test fails should this
|
||||||
// assumption not hold.
|
// assumption not hold.
|
||||||
Assert.Equal(0x10, buffer.Size);
|
Assert.Equal(0x10, buffer.Size);
|
||||||
|
|
||||||
buffer.Write(this.writeData, 0, 2);
|
buffer.Write(writeData, 0, 2);
|
||||||
buffer.Write(this.writeData, 2, 2);
|
buffer.Write(writeData, 2, 2);
|
||||||
buffer.WriteEnd();
|
buffer.WriteEnd();
|
||||||
|
|
||||||
// Assert the initial state of the buffer
|
// Assert the initial state of the buffer
|
||||||
@@ -332,7 +332,7 @@ namespace k8s.Tests
|
|||||||
Assert.Equal(0x04, buffer.WriteWaterMark);
|
Assert.Equal(0x04, buffer.WriteWaterMark);
|
||||||
|
|
||||||
// Read the data at once
|
// Read the data at once
|
||||||
byte[] readData = new byte[0x10];
|
var readData = new byte[0x10];
|
||||||
var read = buffer.Read(readData, 0, 0x10);
|
var read = buffer.Read(readData, 0, 0x10);
|
||||||
Assert.Equal(4, read);
|
Assert.Equal(4, read);
|
||||||
Assert.Equal(0xF0, readData[0]);
|
Assert.Equal(0xF0, readData[0]);
|
||||||
@@ -354,12 +354,12 @@ namespace k8s.Tests
|
|||||||
{
|
{
|
||||||
// In the current implementation, the minimum size of the buffer will be 16 bytes,
|
// In the current implementation, the minimum size of the buffer will be 16 bytes,
|
||||||
// but that's not guaranteed.
|
// but that's not guaranteed.
|
||||||
ByteBuffer buffer = new ByteBuffer(1, 128);
|
var buffer = new ByteBuffer(1, 128);
|
||||||
|
|
||||||
byte[] data = new byte[buffer.Size + 1];
|
var data = new byte[buffer.Size + 1];
|
||||||
RandomNumberGenerator.Create().GetBytes(data);
|
RandomNumberGenerator.Create().GetBytes(data);
|
||||||
|
|
||||||
byte[] output = new byte[buffer.Size + 1];
|
var output = new byte[buffer.Size + 1];
|
||||||
|
|
||||||
buffer.Write(data, 0, data.Length);
|
buffer.Write(data, 0, data.Length);
|
||||||
|
|
||||||
@@ -376,12 +376,12 @@ namespace k8s.Tests
|
|||||||
{
|
{
|
||||||
// In the current implementation, the minimum size of the buffer will be 16 bytes,
|
// In the current implementation, the minimum size of the buffer will be 16 bytes,
|
||||||
// but that's not guaranteed.
|
// but that's not guaranteed.
|
||||||
ByteBuffer buffer = new ByteBuffer(1, 128);
|
var buffer = new ByteBuffer(1, 128);
|
||||||
|
|
||||||
byte[] data = new byte[buffer.Size + 1];
|
var data = new byte[buffer.Size + 1];
|
||||||
RandomNumberGenerator.Create().GetBytes(data);
|
RandomNumberGenerator.Create().GetBytes(data);
|
||||||
|
|
||||||
byte[] output = new byte[buffer.Size + 1];
|
var output = new byte[buffer.Size + 1];
|
||||||
|
|
||||||
buffer.Write(data, 0, 1);
|
buffer.Write(data, 0, 1);
|
||||||
buffer.Write(data, 0, data.Length);
|
buffer.Write(data, 0, data.Length);
|
||||||
@@ -402,12 +402,12 @@ namespace k8s.Tests
|
|||||||
[Fact]
|
[Fact]
|
||||||
public async Task ReadFirstTest()
|
public async Task ReadFirstTest()
|
||||||
{
|
{
|
||||||
ByteBuffer buffer = new ByteBuffer(1, 128);
|
var buffer = new ByteBuffer(1, 128);
|
||||||
|
|
||||||
byte[] data = new byte[buffer.Size + 1];
|
var data = new byte[buffer.Size + 1];
|
||||||
RandomNumberGenerator.Create().GetBytes(data);
|
RandomNumberGenerator.Create().GetBytes(data);
|
||||||
|
|
||||||
byte[] output = new byte[buffer.Size + 1];
|
var output = new byte[buffer.Size + 1];
|
||||||
|
|
||||||
var readTask = Task.Run(() => buffer.Read(output, 0, output.Length));
|
var readTask = Task.Run(() => buffer.Read(output, 0, output.Length));
|
||||||
await Task.Delay(TimeSpan.FromSeconds(1)).ConfigureAwait(false);
|
await Task.Delay(TimeSpan.FromSeconds(1)).ConfigureAwait(false);
|
||||||
|
|||||||
@@ -9,7 +9,7 @@ namespace k8s.Tests
|
|||||||
{
|
{
|
||||||
public class GcpTokenProviderTests
|
public class GcpTokenProviderTests
|
||||||
{
|
{
|
||||||
[OperatingSystemDependentFact(Exclude = OperatingSystem.OSX)]
|
[OperatingSystemDependentFact(Exclude = OperatingSystems.OSX)]
|
||||||
public async Task GetToken()
|
public async Task GetToken()
|
||||||
{
|
{
|
||||||
var isWindows = Environment.OSVersion.Platform == PlatformID.Win32NT;
|
var isWindows = Environment.OSVersion.Platform == PlatformID.Win32NT;
|
||||||
|
|||||||
@@ -17,26 +17,22 @@
|
|||||||
|
|
||||||
<PackageReference Include="Microsoft.Extensions.Logging" Version="2.2.0" />
|
<PackageReference Include="Microsoft.Extensions.Logging" Version="2.2.0" />
|
||||||
<PackageReference Include="System.Reactive" Version="4.3.2" />
|
<PackageReference Include="System.Reactive" Version="4.3.2" />
|
||||||
<PackageReference Include="Nito.AsyncEx" Version="5.0.0" />
|
<PackageReference Include="Nito.AsyncEx" Version="5.1.0" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
<!-- <ItemGroup Condition=" '$(TargetFramework)' == 'netcoreapp2.0' ">
|
|
||||||
<Compile Remove="Kubernetes.Exec.Tests.cs" />
|
|
||||||
</ItemGroup>
|
|
||||||
<ItemGroup Condition=" '$(TargetFramework)' == 'netcoreapp2.1' ">
|
|
||||||
<Compile Remove="Kubernetes.WebSockets.Tests.cs" />
|
|
||||||
</ItemGroup> -->
|
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
|
||||||
<PackageReference Include="coverlet.msbuild" Version="2.8.0">
|
<PackageReference Include="coverlet.msbuild" Version="2.9.0">
|
||||||
<PrivateAssets>all</PrivateAssets>
|
<PrivateAssets>all</PrivateAssets>
|
||||||
<IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets>
|
<IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets>
|
||||||
</PackageReference>
|
</PackageReference>
|
||||||
|
|
||||||
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.0.1" />
|
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.8.0" />
|
||||||
<PackageReference Include="xunit" Version="2.4.1" />
|
<PackageReference Include="xunit" Version="2.4.1" />
|
||||||
<PackageReference Include="xunit.runner.visualstudio" Version="2.4.1" />
|
<PackageReference Include="xunit.runner.visualstudio" Version="2.4.3">
|
||||||
|
<PrivateAssets>all</PrivateAssets>
|
||||||
|
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
||||||
|
</PackageReference>
|
||||||
<PackageReference Include="Xunit.StaFact" Version="0.3.18" />
|
<PackageReference Include="Xunit.StaFact" Version="0.3.18" />
|
||||||
<PackageReference Include="Moq" Version="4.13.1" />
|
<PackageReference Include="Moq" Version="4.13.1" />
|
||||||
|
|
||||||
|
|||||||
@@ -163,7 +163,7 @@ namespace k8s.Tests
|
|||||||
var k8sConfig =
|
var k8sConfig =
|
||||||
KubernetesClientConfiguration.LoadKubeConfig(
|
KubernetesClientConfiguration.LoadKubeConfig(
|
||||||
new FileInfo("assets/kubeconfig.yml"),
|
new FileInfo("assets/kubeconfig.yml"),
|
||||||
useRelativePaths: false);
|
false);
|
||||||
var cfg = KubernetesClientConfiguration.BuildConfigFromConfigObject(k8sConfig);
|
var cfg = KubernetesClientConfiguration.BuildConfigFromConfigObject(k8sConfig);
|
||||||
Assert.NotNull(cfg.Host);
|
Assert.NotNull(cfg.Host);
|
||||||
}
|
}
|
||||||
@@ -341,7 +341,7 @@ namespace k8s.Tests
|
|||||||
{
|
{
|
||||||
var filePath = "assets/kubeconfig.yml";
|
var filePath = "assets/kubeconfig.yml";
|
||||||
var cfg = KubernetesClientConfiguration.BuildConfigFromConfigFile(filePath, null, null,
|
var cfg = KubernetesClientConfiguration.BuildConfigFromConfigFile(filePath, null, null,
|
||||||
useRelativePaths: false);
|
false);
|
||||||
Assert.NotNull(cfg.Host);
|
Assert.NotNull(cfg.Host);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -368,7 +368,7 @@ namespace k8s.Tests
|
|||||||
var filePath = "assets/kubeconfig.as-user-extra.yml";
|
var filePath = "assets/kubeconfig.as-user-extra.yml";
|
||||||
|
|
||||||
var cfg = KubernetesClientConfiguration.BuildConfigFromConfigFile(filePath, null, null,
|
var cfg = KubernetesClientConfiguration.BuildConfigFromConfigFile(filePath, null, null,
|
||||||
useRelativePaths: false);
|
false);
|
||||||
Assert.NotNull(cfg.Host);
|
Assert.NotNull(cfg.Host);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -12,6 +12,7 @@ namespace k8s.Tests.Logging
|
|||||||
: ILogger
|
: ILogger
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
/// Initializes a new instance of the <see cref="TestOutputLogger"/> class.
|
||||||
/// Create a new <see cref="TestOutputLogger"/>.
|
/// Create a new <see cref="TestOutputLogger"/>.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="testOutput">
|
/// <param name="testOutput">
|
||||||
|
|||||||
@@ -11,6 +11,7 @@ namespace k8s.Tests.Logging
|
|||||||
: ILoggerProvider
|
: ILoggerProvider
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
/// Initializes a new instance of the <see cref="TestOutputLoggerProvider"/> class.
|
||||||
/// Create a new <see cref="TestOutputLoggerProvider"/>.
|
/// Create a new <see cref="TestOutputLoggerProvider"/>.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="testOutput">
|
/// <param name="testOutput">
|
||||||
|
|||||||
@@ -59,6 +59,7 @@ namespace k8s.Tests.Mock
|
|||||||
{
|
{
|
||||||
_webHost.StopAsync();
|
_webHost.StopAsync();
|
||||||
_webHost.WaitForShutdown();
|
_webHost.WaitForShutdown();
|
||||||
|
_webHost.Dispose();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -9,7 +9,7 @@ namespace k8s.Tests.Mock
|
|||||||
{
|
{
|
||||||
public class MockWebSocket : WebSocket
|
public class MockWebSocket : WebSocket
|
||||||
{
|
{
|
||||||
private WebSocketCloseStatus? closeStatus = null;
|
private WebSocketCloseStatus? closeStatus;
|
||||||
private string closeStatusDescription;
|
private string closeStatusDescription;
|
||||||
private WebSocketState state;
|
private WebSocketState state;
|
||||||
private string subProtocol;
|
private string subProtocol;
|
||||||
@@ -31,23 +31,23 @@ namespace k8s.Tests.Mock
|
|||||||
|
|
||||||
public Task InvokeReceiveAsync(ArraySegment<byte> buffer, WebSocketMessageType messageType, bool endOfMessage)
|
public Task InvokeReceiveAsync(ArraySegment<byte> buffer, WebSocketMessageType messageType, bool endOfMessage)
|
||||||
{
|
{
|
||||||
this.receiveBuffers.Enqueue(new MessageData()
|
receiveBuffers.Enqueue(new MessageData()
|
||||||
{
|
{
|
||||||
Buffer = buffer,
|
Buffer = buffer,
|
||||||
MessageType = messageType,
|
MessageType = messageType,
|
||||||
EndOfMessage = endOfMessage,
|
EndOfMessage = endOfMessage,
|
||||||
});
|
});
|
||||||
this.receiveEvent.Set();
|
receiveEvent.Set();
|
||||||
return Task.CompletedTask;
|
return Task.CompletedTask;
|
||||||
}
|
}
|
||||||
|
|
||||||
public override WebSocketCloseStatus? CloseStatus => this.closeStatus;
|
public override WebSocketCloseStatus? CloseStatus => closeStatus;
|
||||||
|
|
||||||
public override string CloseStatusDescription => this.closeStatusDescription;
|
public override string CloseStatusDescription => closeStatusDescription;
|
||||||
|
|
||||||
public override WebSocketState State => this.state;
|
public override WebSocketState State => state;
|
||||||
|
|
||||||
public override string SubProtocol => this.subProtocol;
|
public override string SubProtocol => subProtocol;
|
||||||
|
|
||||||
public override void Abort()
|
public override void Abort()
|
||||||
{
|
{
|
||||||
@@ -58,14 +58,14 @@ namespace k8s.Tests.Mock
|
|||||||
CancellationToken cancellationToken)
|
CancellationToken cancellationToken)
|
||||||
{
|
{
|
||||||
this.closeStatus = closeStatus;
|
this.closeStatus = closeStatus;
|
||||||
this.closeStatusDescription = statusDescription;
|
closeStatusDescription = statusDescription;
|
||||||
this.receiveBuffers.Enqueue(new MessageData()
|
receiveBuffers.Enqueue(new MessageData()
|
||||||
{
|
{
|
||||||
Buffer = new ArraySegment<byte>(new byte[] { }),
|
Buffer = new ArraySegment<byte>(new byte[] { }),
|
||||||
EndOfMessage = true,
|
EndOfMessage = true,
|
||||||
MessageType = WebSocketMessageType.Close,
|
MessageType = WebSocketMessageType.Close,
|
||||||
});
|
});
|
||||||
this.receiveEvent.Set();
|
receiveEvent.Set();
|
||||||
return Task.CompletedTask;
|
return Task.CompletedTask;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -79,22 +79,22 @@ namespace k8s.Tests.Mock
|
|||||||
ArraySegment<byte> buffer,
|
ArraySegment<byte> buffer,
|
||||||
CancellationToken cancellationToken)
|
CancellationToken cancellationToken)
|
||||||
{
|
{
|
||||||
if (this.receiveBuffers.Count == 0)
|
if (receiveBuffers.IsEmpty)
|
||||||
{
|
{
|
||||||
await this.receiveEvent.WaitAsync(cancellationToken).ConfigureAwait(false);
|
await receiveEvent.WaitAsync(cancellationToken).ConfigureAwait(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
int bytesReceived = 0;
|
var bytesReceived = 0;
|
||||||
bool endOfMessage = true;
|
var endOfMessage = true;
|
||||||
WebSocketMessageType messageType = WebSocketMessageType.Close;
|
var messageType = WebSocketMessageType.Close;
|
||||||
|
|
||||||
MessageData received = null;
|
MessageData received = null;
|
||||||
if (this.receiveBuffers.TryPeek(out received))
|
if (receiveBuffers.TryPeek(out received))
|
||||||
{
|
{
|
||||||
messageType = received.MessageType;
|
messageType = received.MessageType;
|
||||||
if (received.Buffer.Count <= buffer.Count)
|
if (received.Buffer.Count <= buffer.Count)
|
||||||
{
|
{
|
||||||
this.receiveBuffers.TryDequeue(out received);
|
receiveBuffers.TryDequeue(out received);
|
||||||
received.Buffer.CopyTo(buffer);
|
received.Buffer.CopyTo(buffer);
|
||||||
bytesReceived = received.Buffer.Count;
|
bytesReceived = received.Buffer.Count;
|
||||||
endOfMessage = received.EndOfMessage;
|
endOfMessage = received.EndOfMessage;
|
||||||
@@ -114,7 +114,7 @@ namespace k8s.Tests.Mock
|
|||||||
public override Task SendAsync(ArraySegment<byte> buffer, WebSocketMessageType messageType, bool endOfMessage,
|
public override Task SendAsync(ArraySegment<byte> buffer, WebSocketMessageType messageType, bool endOfMessage,
|
||||||
CancellationToken cancellationToken)
|
CancellationToken cancellationToken)
|
||||||
{
|
{
|
||||||
this.MessageSent?.Invoke(
|
MessageSent?.Invoke(
|
||||||
this,
|
this,
|
||||||
new MessageDataEventArgs()
|
new MessageDataEventArgs()
|
||||||
{
|
{
|
||||||
@@ -146,8 +146,8 @@ namespace k8s.Tests.Mock
|
|||||||
{
|
{
|
||||||
if (disposing)
|
if (disposing)
|
||||||
{
|
{
|
||||||
this.receiveBuffers.Clear();
|
receiveBuffers.Clear();
|
||||||
this.receiveEvent.Set();
|
receiveEvent.Set();
|
||||||
}
|
}
|
||||||
|
|
||||||
disposedValue = true;
|
disposedValue = true;
|
||||||
@@ -164,7 +164,7 @@ namespace k8s.Tests.Mock
|
|||||||
public override void Dispose()
|
public override void Dispose()
|
||||||
{
|
{
|
||||||
// Do not change this code. Put cleanup code in 'Dispose(bool disposing)' method
|
// Do not change this code. Put cleanup code in 'Dispose(bool disposing)' method
|
||||||
Dispose(disposing: true);
|
Dispose(true);
|
||||||
GC.SuppressFinalize(this);
|
GC.SuppressFinalize(this);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -13,6 +13,7 @@ namespace k8s.Tests.Mock.Server.Controllers
|
|||||||
: Controller
|
: Controller
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
/// Initializes a new instance of the <see cref="PodExecController"/> class.
|
||||||
/// Create a new <see cref="PodExecController"/>.
|
/// Create a new <see cref="PodExecController"/>.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="webSocketTestAdapter">
|
/// <param name="webSocketTestAdapter">
|
||||||
@@ -50,8 +51,8 @@ namespace k8s.Tests.Mock.Server.Controllers
|
|||||||
return BadRequest("Exec requires WebSockets");
|
return BadRequest("Exec requires WebSockets");
|
||||||
}
|
}
|
||||||
|
|
||||||
WebSocket webSocket = await HttpContext.WebSockets.AcceptWebSocketAsync(
|
var webSocket = await HttpContext.WebSockets.AcceptWebSocketAsync(
|
||||||
subProtocol: WebSocketProtocol.ChannelWebSocketProtocol).ConfigureAwait(false);
|
WebSocketProtocol.ChannelWebSocketProtocol).ConfigureAwait(false);
|
||||||
|
|
||||||
WebSocketTestAdapter.AcceptedPodExecV1Connection.AcceptServerSocket(webSocket);
|
WebSocketTestAdapter.AcceptedPodExecV1Connection.AcceptServerSocket(webSocket);
|
||||||
|
|
||||||
|
|||||||
@@ -14,6 +14,7 @@ namespace k8s.Tests.Mock.Server.Controllers
|
|||||||
: Controller
|
: Controller
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
/// Initializes a new instance of the <see cref="PodPortForwardController"/> class.
|
||||||
/// Create a new <see cref="PodPortForwardController"/>.
|
/// Create a new <see cref="PodPortForwardController"/>.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="webSocketTestAdapter">
|
/// <param name="webSocketTestAdapter">
|
||||||
@@ -54,8 +55,8 @@ namespace k8s.Tests.Mock.Server.Controllers
|
|||||||
return BadRequest("PortForward requires WebSockets");
|
return BadRequest("PortForward requires WebSockets");
|
||||||
}
|
}
|
||||||
|
|
||||||
WebSocket webSocket = await HttpContext.WebSockets.AcceptWebSocketAsync(
|
var webSocket = await HttpContext.WebSockets.AcceptWebSocketAsync(
|
||||||
subProtocol: WebSocketProtocol.ChannelWebSocketProtocol).ConfigureAwait(false);
|
WebSocketProtocol.ChannelWebSocketProtocol).ConfigureAwait(false);
|
||||||
|
|
||||||
WebSocketTestAdapter.AcceptedPodPortForwardV1Connection.AcceptServerSocket(webSocket);
|
WebSocketTestAdapter.AcceptedPodPortForwardV1Connection.AcceptServerSocket(webSocket);
|
||||||
|
|
||||||
|
|||||||
@@ -11,6 +11,7 @@ namespace k8s.Tests.Mock.Server
|
|||||||
public class Startup
|
public class Startup
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
/// Initializes a new instance of the <see cref="Startup"/> class.
|
||||||
/// Create a new <see cref="Startup"/>.
|
/// Create a new <see cref="Startup"/>.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public Startup()
|
public Startup()
|
||||||
|
|||||||
@@ -5,8 +5,8 @@ namespace k8s.Tests
|
|||||||
{
|
{
|
||||||
public class OperatingSystemDependentFactAttribute : FactAttribute
|
public class OperatingSystemDependentFactAttribute : FactAttribute
|
||||||
{
|
{
|
||||||
public OperatingSystem Include { get; set; } = OperatingSystem.Linux | OperatingSystem.Windows | OperatingSystem.OSX;
|
public OperatingSystems Include { get; set; } = OperatingSystems.Linux | OperatingSystems.Windows | OperatingSystems.OSX;
|
||||||
public OperatingSystem Exclude { get; set; }
|
public OperatingSystems Exclude { get; set; }
|
||||||
|
|
||||||
public override string Skip
|
public override string Skip
|
||||||
{
|
{
|
||||||
@@ -14,19 +14,19 @@ namespace k8s.Tests
|
|||||||
set { }
|
set { }
|
||||||
}
|
}
|
||||||
|
|
||||||
private bool IsOS(OperatingSystem operatingSystem)
|
private bool IsOS(OperatingSystems operatingSystems)
|
||||||
{
|
{
|
||||||
if (operatingSystem.HasFlag(OperatingSystem.Linux) && RuntimeInformation.IsOSPlatform(OSPlatform.Linux))
|
if (operatingSystems.HasFlag(OperatingSystems.Linux) && RuntimeInformation.IsOSPlatform(OSPlatform.Linux))
|
||||||
{
|
{
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (operatingSystem.HasFlag(OperatingSystem.Windows) && RuntimeInformation.IsOSPlatform(OSPlatform.Windows))
|
if (operatingSystems.HasFlag(OperatingSystems.Windows) && RuntimeInformation.IsOSPlatform(OSPlatform.Windows))
|
||||||
{
|
{
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (operatingSystem.HasFlag(OperatingSystem.OSX) && RuntimeInformation.IsOSPlatform(OSPlatform.OSX))
|
if (operatingSystems.HasFlag(OperatingSystems.OSX) && RuntimeInformation.IsOSPlatform(OSPlatform.OSX))
|
||||||
{
|
{
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ using System;
|
|||||||
namespace k8s.Tests
|
namespace k8s.Tests
|
||||||
{
|
{
|
||||||
[Flags]
|
[Flags]
|
||||||
public enum OperatingSystem
|
public enum OperatingSystems
|
||||||
{
|
{
|
||||||
Windows = 1,
|
Windows = 1,
|
||||||
Linux = 2,
|
Linux = 2,
|
||||||
@@ -28,6 +28,7 @@ namespace k8s.Tests
|
|||||||
private readonly ITestOutputHelper testOutput;
|
private readonly ITestOutputHelper testOutput;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
/// Initializes a new instance of the <see cref="PodExecTests"/> class.
|
||||||
/// Create a new <see cref="KubeApiClient"/> exec-in-pod test suite.
|
/// Create a new <see cref="KubeApiClient"/> exec-in-pod test suite.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="testOutput">
|
/// <param name="testOutput">
|
||||||
@@ -58,13 +59,13 @@ namespace k8s.Tests
|
|||||||
testOutput.WriteLine("Invoking exec operation...");
|
testOutput.WriteLine("Invoking exec operation...");
|
||||||
|
|
||||||
WebSocket clientSocket = await client.WebSocketNamespacedPodExecAsync(
|
WebSocket clientSocket = await client.WebSocketNamespacedPodExecAsync(
|
||||||
name: "mypod",
|
"mypod",
|
||||||
@namespace: "mynamespace",
|
"mynamespace",
|
||||||
command: new string[] { "/bin/bash" },
|
new string[] { "/bin/bash" },
|
||||||
container: "mycontainer",
|
"mycontainer",
|
||||||
stderr: false,
|
false,
|
||||||
stdin: false,
|
false,
|
||||||
stdout: true,
|
true,
|
||||||
webSocketSubProtol: WebSocketProtocol.ChannelWebSocketProtocol,
|
webSocketSubProtol: WebSocketProtocol.ChannelWebSocketProtocol,
|
||||||
cancellationToken: TestCancellation).ConfigureAwait(false);
|
cancellationToken: TestCancellation).ConfigureAwait(false);
|
||||||
Assert.Equal(
|
Assert.Equal(
|
||||||
@@ -92,8 +93,8 @@ namespace k8s.Tests
|
|||||||
Assert.Equal(expectedOutput, receivedText);
|
Assert.Equal(expectedOutput, receivedText);
|
||||||
|
|
||||||
await Disconnect(clientSocket, serverSocket,
|
await Disconnect(clientSocket, serverSocket,
|
||||||
closeStatus: WebSocketCloseStatus.NormalClosure,
|
WebSocketCloseStatus.NormalClosure,
|
||||||
closeStatusDescription: "Normal Closure").ConfigureAwait(false);
|
"Normal Closure").ConfigureAwait(false);
|
||||||
|
|
||||||
WebSocketTestAdapter.CompleteTest();
|
WebSocketTestAdapter.CompleteTest();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -22,10 +22,10 @@ namespace k8s.Tests
|
|||||||
[Fact]
|
[Fact]
|
||||||
public async Task SendDataRemoteCommand()
|
public async Task SendDataRemoteCommand()
|
||||||
{
|
{
|
||||||
using (MockWebSocket ws = new MockWebSocket())
|
using (var ws = new MockWebSocket())
|
||||||
using (StreamDemuxer demuxer = new StreamDemuxer(ws))
|
using (var demuxer = new StreamDemuxer(ws))
|
||||||
{
|
{
|
||||||
List<byte> sentBuffer = new List<byte>();
|
var sentBuffer = new List<byte>();
|
||||||
ws.MessageSent += (sender, args) => { sentBuffer.AddRange(args.Data.Buffer); };
|
ws.MessageSent += (sender, args) => { sentBuffer.AddRange(args.Data.Buffer); };
|
||||||
|
|
||||||
demuxer.Start();
|
demuxer.Start();
|
||||||
@@ -47,10 +47,10 @@ namespace k8s.Tests
|
|||||||
[Fact]
|
[Fact]
|
||||||
public async Task SendMultipleDataRemoteCommand()
|
public async Task SendMultipleDataRemoteCommand()
|
||||||
{
|
{
|
||||||
using (MockWebSocket ws = new MockWebSocket())
|
using (var ws = new MockWebSocket())
|
||||||
using (StreamDemuxer demuxer = new StreamDemuxer(ws))
|
using (var demuxer = new StreamDemuxer(ws))
|
||||||
{
|
{
|
||||||
List<byte> sentBuffer = new List<byte>();
|
var sentBuffer = new List<byte>();
|
||||||
ws.MessageSent += (sender, args) => { sentBuffer.AddRange(args.Data.Buffer); };
|
ws.MessageSent += (sender, args) => { sentBuffer.AddRange(args.Data.Buffer); };
|
||||||
|
|
||||||
demuxer.Start();
|
demuxer.Start();
|
||||||
@@ -76,17 +76,17 @@ namespace k8s.Tests
|
|||||||
[Fact]
|
[Fact]
|
||||||
public async Task ReceiveDataRemoteCommand()
|
public async Task ReceiveDataRemoteCommand()
|
||||||
{
|
{
|
||||||
using (MockWebSocket ws = new MockWebSocket())
|
using (var ws = new MockWebSocket())
|
||||||
using (StreamDemuxer demuxer = new StreamDemuxer(ws))
|
using (var demuxer = new StreamDemuxer(ws))
|
||||||
{
|
{
|
||||||
demuxer.Start();
|
demuxer.Start();
|
||||||
|
|
||||||
List<byte> receivedBuffer = new List<byte>();
|
var receivedBuffer = new List<byte>();
|
||||||
byte channelIndex = 12;
|
byte channelIndex = 12;
|
||||||
var stream = demuxer.GetStream(channelIndex, channelIndex);
|
var stream = demuxer.GetStream(channelIndex, channelIndex);
|
||||||
|
|
||||||
// Receive 600 bytes in 3 messages. Exclude 1 channel index byte per message, expect 597 bytes payload.
|
// Receive 600 bytes in 3 messages. Exclude 1 channel index byte per message, expect 597 bytes payload.
|
||||||
int expectedCount = 597;
|
var expectedCount = 597;
|
||||||
|
|
||||||
var t = Task.Run(async () =>
|
var t = Task.Run(async () =>
|
||||||
{
|
{
|
||||||
@@ -112,7 +112,7 @@ namespace k8s.Tests
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (int i = 0; i < cRead; i++)
|
for (var i = 0; i < cRead; i++)
|
||||||
{
|
{
|
||||||
receivedBuffer.Add(buffer[i]);
|
receivedBuffer.Add(buffer[i]);
|
||||||
}
|
}
|
||||||
@@ -135,18 +135,18 @@ namespace k8s.Tests
|
|||||||
[Fact]
|
[Fact]
|
||||||
public async Task ReceiveDataPortForward()
|
public async Task ReceiveDataPortForward()
|
||||||
{
|
{
|
||||||
using (MockWebSocket ws = new MockWebSocket())
|
using (var ws = new MockWebSocket())
|
||||||
using (StreamDemuxer demuxer = new StreamDemuxer(ws, StreamType.PortForward))
|
using (var demuxer = new StreamDemuxer(ws, StreamType.PortForward))
|
||||||
{
|
{
|
||||||
demuxer.Start();
|
demuxer.Start();
|
||||||
|
|
||||||
List<byte> receivedBuffer = new List<byte>();
|
var receivedBuffer = new List<byte>();
|
||||||
byte channelIndex = 12;
|
byte channelIndex = 12;
|
||||||
var stream = demuxer.GetStream(channelIndex, channelIndex);
|
var stream = demuxer.GetStream(channelIndex, channelIndex);
|
||||||
|
|
||||||
// Receive 600 bytes in 3 messages. Exclude 1 channel index byte per message, and 2 port bytes in the first message.
|
// Receive 600 bytes in 3 messages. Exclude 1 channel index byte per message, and 2 port bytes in the first message.
|
||||||
// expect 600 - 3 - 2 = 595 bytes payload.
|
// expect 600 - 3 - 2 = 595 bytes payload.
|
||||||
int expectedCount = 595;
|
var expectedCount = 595;
|
||||||
|
|
||||||
var t = Task.Run(async () =>
|
var t = Task.Run(async () =>
|
||||||
{
|
{
|
||||||
@@ -172,7 +172,7 @@ namespace k8s.Tests
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (int i = 0; i < cRead; i++)
|
for (var i = 0; i < cRead; i++)
|
||||||
{
|
{
|
||||||
receivedBuffer.Add(buffer[i]);
|
receivedBuffer.Add(buffer[i]);
|
||||||
}
|
}
|
||||||
@@ -195,18 +195,18 @@ namespace k8s.Tests
|
|||||||
[Fact]
|
[Fact]
|
||||||
public async Task ReceiveDataPortForwardOneByteMessage()
|
public async Task ReceiveDataPortForwardOneByteMessage()
|
||||||
{
|
{
|
||||||
using (MockWebSocket ws = new MockWebSocket())
|
using (var ws = new MockWebSocket())
|
||||||
using (StreamDemuxer demuxer = new StreamDemuxer(ws, StreamType.PortForward))
|
using (var demuxer = new StreamDemuxer(ws, StreamType.PortForward))
|
||||||
{
|
{
|
||||||
demuxer.Start();
|
demuxer.Start();
|
||||||
|
|
||||||
List<byte> receivedBuffer = new List<byte>();
|
var receivedBuffer = new List<byte>();
|
||||||
byte channelIndex = 12;
|
byte channelIndex = 12;
|
||||||
var stream = demuxer.GetStream(channelIndex, channelIndex);
|
var stream = demuxer.GetStream(channelIndex, channelIndex);
|
||||||
|
|
||||||
// Receive 402 bytes in 3 buffers of 2 messages. Exclude 1 channel index byte per message, and 2 port bytes in the first message.
|
// Receive 402 bytes in 3 buffers of 2 messages. Exclude 1 channel index byte per message, and 2 port bytes in the first message.
|
||||||
// expect 402 - 1 x 2 - 2 = 398 bytes payload.
|
// expect 402 - 1 x 2 - 2 = 398 bytes payload.
|
||||||
int expectedCount = 398;
|
var expectedCount = 398;
|
||||||
|
|
||||||
var t = Task.Run(async () =>
|
var t = Task.Run(async () =>
|
||||||
{
|
{
|
||||||
@@ -232,7 +232,7 @@ namespace k8s.Tests
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (int i = 0; i < cRead; i++)
|
for (var i = 0; i < cRead; i++)
|
||||||
{
|
{
|
||||||
receivedBuffer.Add(buffer[i]);
|
receivedBuffer.Add(buffer[i]);
|
||||||
}
|
}
|
||||||
@@ -253,23 +253,23 @@ namespace k8s.Tests
|
|||||||
[Fact]
|
[Fact]
|
||||||
public async Task ReceiveDataRemoteCommandMultipleStream()
|
public async Task ReceiveDataRemoteCommandMultipleStream()
|
||||||
{
|
{
|
||||||
using (MockWebSocket ws = new MockWebSocket())
|
using (var ws = new MockWebSocket())
|
||||||
using (StreamDemuxer demuxer = new StreamDemuxer(ws))
|
using (var demuxer = new StreamDemuxer(ws))
|
||||||
{
|
{
|
||||||
demuxer.Start();
|
demuxer.Start();
|
||||||
|
|
||||||
List<byte> receivedBuffer1 = new List<byte>();
|
var receivedBuffer1 = new List<byte>();
|
||||||
byte channelIndex1 = 1;
|
byte channelIndex1 = 1;
|
||||||
var stream1 = demuxer.GetStream(channelIndex1, channelIndex1);
|
var stream1 = demuxer.GetStream(channelIndex1, channelIndex1);
|
||||||
List<byte> receivedBuffer2 = new List<byte>();
|
var receivedBuffer2 = new List<byte>();
|
||||||
byte channelIndex2 = 2;
|
byte channelIndex2 = 2;
|
||||||
var stream2 = demuxer.GetStream(channelIndex2, channelIndex2);
|
var stream2 = demuxer.GetStream(channelIndex2, channelIndex2);
|
||||||
|
|
||||||
// stream 1: receive 100 + 300 = 400 bytes, exclude 1 channel index per message, expect 400 - 1 x 2 = 398 bytes.
|
// stream 1: receive 100 + 300 = 400 bytes, exclude 1 channel index per message, expect 400 - 1 x 2 = 398 bytes.
|
||||||
int expectedCount1 = 398;
|
var expectedCount1 = 398;
|
||||||
|
|
||||||
// stream 2: receive 200 bytes, exclude 1 channel index per message, expect 200 - 1 = 199 bytes.
|
// stream 2: receive 200 bytes, exclude 1 channel index per message, expect 200 - 1 = 199 bytes.
|
||||||
int expectedCount2 = 199;
|
var expectedCount2 = 199;
|
||||||
|
|
||||||
var t1 = Task.Run(async () =>
|
var t1 = Task.Run(async () =>
|
||||||
{
|
{
|
||||||
@@ -299,7 +299,7 @@ namespace k8s.Tests
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (int i = 0; i < cRead; i++)
|
for (var i = 0; i < cRead; i++)
|
||||||
{
|
{
|
||||||
receivedBuffer1.Add(buffer[i]);
|
receivedBuffer1.Add(buffer[i]);
|
||||||
}
|
}
|
||||||
@@ -316,7 +316,7 @@ namespace k8s.Tests
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (int i = 0; i < cRead; i++)
|
for (var i = 0; i < cRead; i++)
|
||||||
{
|
{
|
||||||
receivedBuffer2.Add(buffer[i]);
|
receivedBuffer2.Add(buffer[i]);
|
||||||
}
|
}
|
||||||
@@ -342,25 +342,25 @@ namespace k8s.Tests
|
|||||||
[Fact]
|
[Fact]
|
||||||
public async Task ReceiveDataPortForwardMultipleStream()
|
public async Task ReceiveDataPortForwardMultipleStream()
|
||||||
{
|
{
|
||||||
using (MockWebSocket ws = new MockWebSocket())
|
using (var ws = new MockWebSocket())
|
||||||
using (StreamDemuxer demuxer = new StreamDemuxer(ws, StreamType.PortForward))
|
using (var demuxer = new StreamDemuxer(ws, StreamType.PortForward))
|
||||||
{
|
{
|
||||||
demuxer.Start();
|
demuxer.Start();
|
||||||
|
|
||||||
List<byte> receivedBuffer1 = new List<byte>();
|
var receivedBuffer1 = new List<byte>();
|
||||||
byte channelIndex1 = 1;
|
byte channelIndex1 = 1;
|
||||||
var stream1 = demuxer.GetStream(channelIndex1, channelIndex1);
|
var stream1 = demuxer.GetStream(channelIndex1, channelIndex1);
|
||||||
List<byte> receivedBuffer2 = new List<byte>();
|
var receivedBuffer2 = new List<byte>();
|
||||||
byte channelIndex2 = 2;
|
byte channelIndex2 = 2;
|
||||||
var stream2 = demuxer.GetStream(channelIndex2, channelIndex2);
|
var stream2 = demuxer.GetStream(channelIndex2, channelIndex2);
|
||||||
|
|
||||||
// stream 1: receive 100 + 300 = 400 bytes, exclude 1 channel index per message, exclude port bytes in the first message,
|
// stream 1: receive 100 + 300 = 400 bytes, exclude 1 channel index per message, exclude port bytes in the first message,
|
||||||
// expect 400 - 1 x 2 - 2 = 396 bytes.
|
// expect 400 - 1 x 2 - 2 = 396 bytes.
|
||||||
int expectedCount1 = 396;
|
var expectedCount1 = 396;
|
||||||
|
|
||||||
// stream 2: receive 200 bytes, exclude 1 channel index per message, exclude port bytes in the first message,
|
// stream 2: receive 200 bytes, exclude 1 channel index per message, exclude port bytes in the first message,
|
||||||
// expect 200 - 1 - 2 = 197 bytes.
|
// expect 200 - 1 - 2 = 197 bytes.
|
||||||
int expectedCount2 = 197;
|
var expectedCount2 = 197;
|
||||||
|
|
||||||
var t1 = Task.Run(async () =>
|
var t1 = Task.Run(async () =>
|
||||||
{
|
{
|
||||||
@@ -390,7 +390,7 @@ namespace k8s.Tests
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (int i = 0; i < cRead; i++)
|
for (var i = 0; i < cRead; i++)
|
||||||
{
|
{
|
||||||
receivedBuffer1.Add(buffer[i]);
|
receivedBuffer1.Add(buffer[i]);
|
||||||
}
|
}
|
||||||
@@ -407,7 +407,7 @@ namespace k8s.Tests
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (int i = 0; i < cRead; i++)
|
for (var i = 0; i < cRead; i++)
|
||||||
{
|
{
|
||||||
receivedBuffer2.Add(buffer[i]);
|
receivedBuffer2.Add(buffer[i]);
|
||||||
}
|
}
|
||||||
@@ -453,7 +453,7 @@ namespace k8s.Tests
|
|||||||
private static byte[] GenerateRandomBuffer(int length, byte content)
|
private static byte[] GenerateRandomBuffer(int length, byte content)
|
||||||
{
|
{
|
||||||
var buffer = new byte[length];
|
var buffer = new byte[length];
|
||||||
for (int i = 0; i < length; i++)
|
for (var i = 0; i < length; i++)
|
||||||
{
|
{
|
||||||
buffer[i] = content;
|
buffer[i] = content;
|
||||||
}
|
}
|
||||||
@@ -463,7 +463,7 @@ namespace k8s.Tests
|
|||||||
|
|
||||||
private async Task<bool> WaitForAsync(Func<bool> handler, float waitForSeconds = 1)
|
private async Task<bool> WaitForAsync(Func<bool> handler, float waitForSeconds = 1)
|
||||||
{
|
{
|
||||||
Stopwatch w = Stopwatch.StartNew();
|
var w = Stopwatch.StartNew();
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
do
|
do
|
||||||
|
|||||||
@@ -54,7 +54,7 @@ namespace k8s.Tests
|
|||||||
[Fact]
|
[Fact]
|
||||||
public async Task CannotWatch()
|
public async Task CannotWatch()
|
||||||
{
|
{
|
||||||
using (var server = new MockKubeApiServer(testOutput: testOutput))
|
using (var server = new MockKubeApiServer(testOutput))
|
||||||
{
|
{
|
||||||
var client = new Kubernetes(new KubernetesClientConfiguration { Host = server.Uri.ToString() });
|
var client = new Kubernetes(new KubernetesClientConfiguration { Host = server.Uri.ToString() });
|
||||||
|
|
||||||
@@ -64,9 +64,9 @@ namespace k8s.Tests
|
|||||||
|
|
||||||
using (listTask.Watch<V1Pod, V1PodList>((type, item) => { }, e => { onErrorCalled = true; }))
|
using (listTask.Watch<V1Pod, V1PodList>((type, item) => { }, e => { onErrorCalled = true; }))
|
||||||
{
|
{
|
||||||
|
await Task.Delay(TimeSpan.FromSeconds(1)).ConfigureAwait(false); // delay for onerror to be called
|
||||||
}
|
}
|
||||||
|
|
||||||
await Task.Delay(TimeSpan.FromSeconds(1)).ConfigureAwait(false); // delay for onerror to be called
|
|
||||||
Assert.True(onErrorCalled);
|
Assert.True(onErrorCalled);
|
||||||
|
|
||||||
|
|
||||||
@@ -114,9 +114,9 @@ namespace k8s.Tests
|
|||||||
[Fact]
|
[Fact]
|
||||||
public async Task SuriveBadLine()
|
public async Task SuriveBadLine()
|
||||||
{
|
{
|
||||||
AsyncCountdownEvent eventsReceived = new AsyncCountdownEvent(5);
|
var eventsReceived = new AsyncCountdownEvent(5);
|
||||||
AsyncManualResetEvent serverShutdown = new AsyncManualResetEvent();
|
var serverShutdown = new AsyncManualResetEvent();
|
||||||
AsyncManualResetEvent connectionClosed = new AsyncManualResetEvent();
|
var connectionClosed = new AsyncManualResetEvent();
|
||||||
|
|
||||||
using (var server =
|
using (var server =
|
||||||
new MockKubeApiServer(
|
new MockKubeApiServer(
|
||||||
@@ -159,7 +159,7 @@ namespace k8s.Tests
|
|||||||
errors += 1;
|
errors += 1;
|
||||||
eventsReceived.Signal();
|
eventsReceived.Signal();
|
||||||
},
|
},
|
||||||
onClosed: connectionClosed.Set);
|
connectionClosed.Set);
|
||||||
|
|
||||||
// wait server yields all events
|
// wait server yields all events
|
||||||
await Task.WhenAny(eventsReceived.WaitAsync(), Task.Delay(TestTimeout)).ConfigureAwait(false);
|
await Task.WhenAny(eventsReceived.WaitAsync(), Task.Delay(TestTimeout)).ConfigureAwait(false);
|
||||||
@@ -188,7 +188,7 @@ namespace k8s.Tests
|
|||||||
{
|
{
|
||||||
var connectionClosed = new AsyncManualResetEvent();
|
var connectionClosed = new AsyncManualResetEvent();
|
||||||
var eventsReceived = new CountdownEvent(1);
|
var eventsReceived = new CountdownEvent(1);
|
||||||
bool serverRunning = true;
|
var serverRunning = true;
|
||||||
|
|
||||||
using (var server = new MockKubeApiServer(testOutput, async httpContext =>
|
using (var server = new MockKubeApiServer(testOutput, async httpContext =>
|
||||||
{
|
{
|
||||||
@@ -247,9 +247,9 @@ namespace k8s.Tests
|
|||||||
[Fact]
|
[Fact]
|
||||||
public async Task WatchAllEvents()
|
public async Task WatchAllEvents()
|
||||||
{
|
{
|
||||||
AsyncCountdownEvent eventsReceived =
|
var eventsReceived =
|
||||||
new AsyncCountdownEvent(4 /* first line of response is eaten by WatcherDelegatingHandler */);
|
new AsyncCountdownEvent(4 /* first line of response is eaten by WatcherDelegatingHandler */);
|
||||||
AsyncManualResetEvent serverShutdown = new AsyncManualResetEvent();
|
var serverShutdown = new AsyncManualResetEvent();
|
||||||
var waitForClosed = new AsyncManualResetEvent(false);
|
var waitForClosed = new AsyncManualResetEvent(false);
|
||||||
|
|
||||||
using (var server = new MockKubeApiServer(testOutput, async httpContext =>
|
using (var server = new MockKubeApiServer(testOutput, async httpContext =>
|
||||||
@@ -286,7 +286,7 @@ namespace k8s.Tests
|
|||||||
errors += 1;
|
errors += 1;
|
||||||
eventsReceived.Signal();
|
eventsReceived.Signal();
|
||||||
},
|
},
|
||||||
onClosed: waitForClosed.Set);
|
waitForClosed.Set);
|
||||||
|
|
||||||
// wait server yields all events
|
// wait server yields all events
|
||||||
await Task.WhenAny(eventsReceived.WaitAsync(), Task.Delay(TestTimeout)).ConfigureAwait(false);
|
await Task.WhenAny(eventsReceived.WaitAsync(), Task.Delay(TestTimeout)).ConfigureAwait(false);
|
||||||
@@ -315,9 +315,9 @@ namespace k8s.Tests
|
|||||||
[Fact]
|
[Fact]
|
||||||
public async Task WatchEventsWithTimeout()
|
public async Task WatchEventsWithTimeout()
|
||||||
{
|
{
|
||||||
AsyncCountdownEvent eventsReceived = new AsyncCountdownEvent(5);
|
var eventsReceived = new AsyncCountdownEvent(5);
|
||||||
AsyncManualResetEvent serverShutdown = new AsyncManualResetEvent();
|
var serverShutdown = new AsyncManualResetEvent();
|
||||||
AsyncManualResetEvent connectionClosed = new AsyncManualResetEvent();
|
var connectionClosed = new AsyncManualResetEvent();
|
||||||
|
|
||||||
using (var server = new MockKubeApiServer(testOutput, async httpContext =>
|
using (var server = new MockKubeApiServer(testOutput, async httpContext =>
|
||||||
{
|
{
|
||||||
@@ -355,7 +355,7 @@ namespace k8s.Tests
|
|||||||
errors += 1;
|
errors += 1;
|
||||||
eventsReceived.Signal();
|
eventsReceived.Signal();
|
||||||
},
|
},
|
||||||
onClosed: connectionClosed.Set);
|
connectionClosed.Set);
|
||||||
|
|
||||||
// wait server yields all events
|
// wait server yields all events
|
||||||
await Task.WhenAny(eventsReceived.WaitAsync(), Task.Delay(TestTimeout)).ConfigureAwait(false);
|
await Task.WhenAny(eventsReceived.WaitAsync(), Task.Delay(TestTimeout)).ConfigureAwait(false);
|
||||||
@@ -402,13 +402,13 @@ namespace k8s.Tests
|
|||||||
waitForException.Set();
|
waitForException.Set();
|
||||||
Watcher<V1Pod> watcher;
|
Watcher<V1Pod> watcher;
|
||||||
watcher = listTask.Watch<V1Pod, V1PodList>(
|
watcher = listTask.Watch<V1Pod, V1PodList>(
|
||||||
onEvent: (type, item) => { },
|
(type, item) => { },
|
||||||
onError: e =>
|
e =>
|
||||||
{
|
{
|
||||||
exceptionCatched = e;
|
exceptionCatched = e;
|
||||||
exceptionReceived.Set();
|
exceptionReceived.Set();
|
||||||
},
|
},
|
||||||
onClosed: waitForClosed.Set);
|
waitForClosed.Set);
|
||||||
|
|
||||||
// wait server down
|
// wait server down
|
||||||
await Task.WhenAny(exceptionReceived.WaitAsync(), Task.Delay(TestTimeout)).ConfigureAwait(false);
|
await Task.WhenAny(exceptionReceived.WaitAsync(), Task.Delay(TestTimeout)).ConfigureAwait(false);
|
||||||
@@ -440,8 +440,8 @@ namespace k8s.Tests
|
|||||||
[Fact]
|
[Fact]
|
||||||
public async Task TestWatchWithHandlers()
|
public async Task TestWatchWithHandlers()
|
||||||
{
|
{
|
||||||
AsyncCountdownEvent eventsReceived = new AsyncCountdownEvent(1);
|
var eventsReceived = new AsyncCountdownEvent(1);
|
||||||
AsyncManualResetEvent serverShutdown = new AsyncManualResetEvent();
|
var serverShutdown = new AsyncManualResetEvent();
|
||||||
|
|
||||||
using (var server = new MockKubeApiServer(testOutput, async httpContext =>
|
using (var server = new MockKubeApiServer(testOutput, async httpContext =>
|
||||||
{
|
{
|
||||||
@@ -492,9 +492,9 @@ namespace k8s.Tests
|
|||||||
[Fact]
|
[Fact]
|
||||||
public async Task DirectWatchAllEvents()
|
public async Task DirectWatchAllEvents()
|
||||||
{
|
{
|
||||||
AsyncCountdownEvent eventsReceived = new AsyncCountdownEvent(4);
|
var eventsReceived = new AsyncCountdownEvent(4);
|
||||||
AsyncManualResetEvent serverShutdown = new AsyncManualResetEvent();
|
var serverShutdown = new AsyncManualResetEvent();
|
||||||
AsyncManualResetEvent connectionClosed = new AsyncManualResetEvent();
|
var connectionClosed = new AsyncManualResetEvent();
|
||||||
|
|
||||||
using (var server = new MockKubeApiServer(testOutput, async httpContext =>
|
using (var server = new MockKubeApiServer(testOutput, async httpContext =>
|
||||||
{
|
{
|
||||||
@@ -514,8 +514,8 @@ namespace k8s.Tests
|
|||||||
var errors = 0;
|
var errors = 0;
|
||||||
|
|
||||||
var watcher = await client.WatchNamespacedPodAsync(
|
var watcher = await client.WatchNamespacedPodAsync(
|
||||||
name: "myPod",
|
"myPod",
|
||||||
@namespace: "default",
|
"default",
|
||||||
onEvent:
|
onEvent:
|
||||||
(type, item) =>
|
(type, item) =>
|
||||||
{
|
{
|
||||||
@@ -562,7 +562,7 @@ namespace k8s.Tests
|
|||||||
{
|
{
|
||||||
var kubernetesConfig =
|
var kubernetesConfig =
|
||||||
KubernetesClientConfiguration.BuildConfigFromConfigFile(
|
KubernetesClientConfiguration.BuildConfigFromConfigFile(
|
||||||
kubeconfigPath: @"C:\Users\frede\Source\Repos\cloud\minikube.config");
|
@"C:\Users\frede\Source\Repos\cloud\minikube.config");
|
||||||
var kubernetes = new Kubernetes(kubernetesConfig);
|
var kubernetes = new Kubernetes(kubernetesConfig);
|
||||||
|
|
||||||
var job = await kubernetes.CreateNamespacedJobAsync(
|
var job = await kubernetes.CreateNamespacedJobAsync(
|
||||||
@@ -597,10 +597,10 @@ namespace k8s.Tests
|
|||||||
},
|
},
|
||||||
"default").ConfigureAwait(false);
|
"default").ConfigureAwait(false);
|
||||||
|
|
||||||
Collection<Tuple<WatchEventType, V1Job>> events = new Collection<Tuple<WatchEventType, V1Job>>();
|
var events = new Collection<Tuple<WatchEventType, V1Job>>();
|
||||||
|
|
||||||
AsyncManualResetEvent started = new AsyncManualResetEvent();
|
var started = new AsyncManualResetEvent();
|
||||||
AsyncManualResetEvent connectionClosed = new AsyncManualResetEvent();
|
var connectionClosed = new AsyncManualResetEvent();
|
||||||
|
|
||||||
var watcher = await kubernetes.WatchNamespacedJobAsync(
|
var watcher = await kubernetes.WatchNamespacedJobAsync(
|
||||||
job.Metadata.Name,
|
job.Metadata.Name,
|
||||||
@@ -631,8 +631,8 @@ namespace k8s.Tests
|
|||||||
[Fact(Skip = "https://github.com/kubernetes-client/csharp/issues/165")]
|
[Fact(Skip = "https://github.com/kubernetes-client/csharp/issues/165")]
|
||||||
public async Task DirectWatchEventsWithTimeout()
|
public async Task DirectWatchEventsWithTimeout()
|
||||||
{
|
{
|
||||||
AsyncCountdownEvent eventsReceived = new AsyncCountdownEvent(4);
|
var eventsReceived = new AsyncCountdownEvent(4);
|
||||||
AsyncManualResetEvent serverShutdown = new AsyncManualResetEvent();
|
var serverShutdown = new AsyncManualResetEvent();
|
||||||
|
|
||||||
using (var server = new MockKubeApiServer(testOutput, async httpContext =>
|
using (var server = new MockKubeApiServer(testOutput, async httpContext =>
|
||||||
{
|
{
|
||||||
@@ -653,8 +653,8 @@ namespace k8s.Tests
|
|||||||
var errors = 0;
|
var errors = 0;
|
||||||
|
|
||||||
var watcher = await client.WatchNamespacedPodAsync(
|
var watcher = await client.WatchNamespacedPodAsync(
|
||||||
name: "myPod",
|
"myPod",
|
||||||
@namespace: "default",
|
"default",
|
||||||
onEvent:
|
onEvent:
|
||||||
(type, item) =>
|
(type, item) =>
|
||||||
{
|
{
|
||||||
@@ -695,7 +695,7 @@ namespace k8s.Tests
|
|||||||
[Fact]
|
[Fact]
|
||||||
public async Task WatchShouldCancelAfterRequested()
|
public async Task WatchShouldCancelAfterRequested()
|
||||||
{
|
{
|
||||||
AsyncManualResetEvent serverShutdown = new AsyncManualResetEvent();
|
var serverShutdown = new AsyncManualResetEvent();
|
||||||
|
|
||||||
using (var server = new MockKubeApiServer(testOutput, async httpContext =>
|
using (var server = new MockKubeApiServer(testOutput, async httpContext =>
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -13,16 +13,16 @@ namespace k8s.Tests
|
|||||||
[Fact]
|
[Fact]
|
||||||
public void ReadError()
|
public void ReadError()
|
||||||
{
|
{
|
||||||
byte[] data = Encoding.UTF8.GetBytes(
|
var data = Encoding.UTF8.GetBytes(
|
||||||
"{\"type\":\"ERROR\",\"object\":{\"kind\":\"Status\",\"apiVersion\":\"v1\",\"metadata\":{},\"status\":\"Failure\",\"message\":\"too old resource version: 44982(53593)\",\"reason\":\"Gone\",\"code\":410}}");
|
"{\"type\":\"ERROR\",\"object\":{\"kind\":\"Status\",\"apiVersion\":\"v1\",\"metadata\":{},\"status\":\"Failure\",\"message\":\"too old resource version: 44982(53593)\",\"reason\":\"Gone\",\"code\":410}}");
|
||||||
|
|
||||||
using (MemoryStream stream = new MemoryStream(data))
|
using (var stream = new MemoryStream(data))
|
||||||
using (StreamReader reader = new StreamReader(stream))
|
using (var reader = new StreamReader(stream))
|
||||||
{
|
{
|
||||||
Exception recordedException = null;
|
Exception recordedException = null;
|
||||||
ManualResetEvent mre = new ManualResetEvent(false);
|
var mre = new ManualResetEvent(false);
|
||||||
|
|
||||||
Watcher<V1Pod> watcher = new Watcher<V1Pod>(
|
var watcher = new Watcher<V1Pod>(
|
||||||
() => Task.FromResult(reader),
|
() => Task.FromResult(reader),
|
||||||
null,
|
null,
|
||||||
(exception) =>
|
(exception) =>
|
||||||
|
|||||||
@@ -29,6 +29,7 @@ namespace k8s.Tests
|
|||||||
private readonly ITestOutputHelper testOutput;
|
private readonly ITestOutputHelper testOutput;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
/// Initializes a new instance of the <see cref="WebSocketTestBase"/> class.
|
||||||
/// Create a new <see cref="WebSocketTestBase"/>.
|
/// Create a new <see cref="WebSocketTestBase"/>.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="testOutput">
|
/// <param name="testOutput">
|
||||||
@@ -81,7 +82,7 @@ namespace k8s.Tests
|
|||||||
protected CancellationTokenSource CancellationSource { get; } = new CancellationTokenSource();
|
protected CancellationTokenSource CancellationSource { get; } = new CancellationTokenSource();
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// A <see cref="System.Threading.CancellationToken"/> that can be used to cancel asynchronous operations.
|
/// A <see cref="CancellationToken"/> that can be used to cancel asynchronous operations.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <seealso cref="CancellationSource"/>
|
/// <seealso cref="CancellationSource"/>
|
||||||
protected CancellationToken TestCancellation => CancellationSource.Token;
|
protected CancellationToken TestCancellation => CancellationSource.Token;
|
||||||
@@ -117,7 +118,7 @@ namespace k8s.Tests
|
|||||||
}
|
}
|
||||||
|
|
||||||
logging.ClearProviders(); // Don't log to console.
|
logging.ClearProviders(); // Don't log to console.
|
||||||
logging.AddTestOutput(this.testOutput, LogLevel.Information);
|
logging.AddTestOutput(testOutput, LogLevel.Information);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -260,8 +261,8 @@ namespace k8s.Tests
|
|||||||
Array.Copy(payload, 0, sendBuffer, 1, payload.Length);
|
Array.Copy(payload, 0, sendBuffer, 1, payload.Length);
|
||||||
|
|
||||||
await webSocket.SendAsync(sendBuffer, WebSocketMessageType.Binary,
|
await webSocket.SendAsync(sendBuffer, WebSocketMessageType.Binary,
|
||||||
endOfMessage: true,
|
true,
|
||||||
cancellationToken: TestCancellation).ConfigureAwait(false);
|
TestCancellation).ConfigureAwait(false);
|
||||||
|
|
||||||
return sendBuffer.Length;
|
return sendBuffer.Length;
|
||||||
}
|
}
|
||||||
@@ -330,6 +331,7 @@ namespace k8s.Tests
|
|||||||
public static readonly AnonymousClientCredentials Instance = new AnonymousClientCredentials();
|
public static readonly AnonymousClientCredentials Instance = new AnonymousClientCredentials();
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
/// Initializes a new instance of the <see cref="AnonymousClientCredentials"/> class.
|
||||||
/// Create new <see cref="AnonymousClientCredentials"/>.
|
/// Create new <see cref="AnonymousClientCredentials"/>.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
private AnonymousClientCredentials()
|
private AnonymousClientCredentials()
|
||||||
@@ -372,7 +374,7 @@ namespace k8s.Tests
|
|||||||
public void Dispose()
|
public void Dispose()
|
||||||
{
|
{
|
||||||
// Do not change this code. Put cleanup code in 'Dispose(bool disposing)' method
|
// Do not change this code. Put cleanup code in 'Dispose(bool disposing)' method
|
||||||
Dispose(disposing: true);
|
Dispose(true);
|
||||||
GC.SuppressFinalize(this);
|
GC.SuppressFinalize(this);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -99,7 +99,7 @@ metadata:
|
|||||||
name: foo
|
name: foo
|
||||||
";
|
";
|
||||||
|
|
||||||
using (MemoryStream stream = new MemoryStream(System.Text.Encoding.UTF8.GetBytes(content)))
|
using (var stream = new MemoryStream(Encoding.UTF8.GetBytes(content)))
|
||||||
{
|
{
|
||||||
var obj = Yaml.LoadFromStreamAsync<V1Pod>(stream).Result;
|
var obj = Yaml.LoadFromStreamAsync<V1Pod>(stream).Result;
|
||||||
|
|
||||||
@@ -261,7 +261,7 @@ spec:
|
|||||||
var obj = Yaml.LoadFromString<V1Service>(content);
|
var obj = Yaml.LoadFromString<V1Service>(content);
|
||||||
|
|
||||||
Assert.Equal(3000, obj.Spec.Ports[0].Port);
|
Assert.Equal(3000, obj.Spec.Ports[0].Port);
|
||||||
Assert.Equal(3000, (int)obj.Spec.Ports[0].TargetPort);
|
Assert.Equal(3000, int.Parse(obj.Spec.Ports[0].TargetPort));
|
||||||
}
|
}
|
||||||
|
|
||||||
[Fact]
|
[Fact]
|
||||||
@@ -278,7 +278,7 @@ spec:
|
|||||||
- port: 3000
|
- port: 3000
|
||||||
targetPort: 3000";
|
targetPort: 3000";
|
||||||
|
|
||||||
Dictionary<string, string> labels = new Dictionary<string, string> { { "app", "test" } };
|
var labels = new Dictionary<string, string> { { "app", "test" } };
|
||||||
var obj = new V1Service
|
var obj = new V1Service
|
||||||
{
|
{
|
||||||
Kind = "Service",
|
Kind = "Service",
|
||||||
@@ -290,7 +290,7 @@ spec:
|
|||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
var output = Yaml.SaveToString<V1Service>(obj);
|
var output = Yaml.SaveToString(obj);
|
||||||
Assert.Equal(ToLines(output), ToLines(content));
|
Assert.Equal(ToLines(output), ToLines(content));
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -327,7 +327,7 @@ spec:
|
|||||||
[Fact]
|
[Fact]
|
||||||
public void LoadSecret()
|
public void LoadSecret()
|
||||||
{
|
{
|
||||||
string kManifest = @"
|
var kManifest = @"
|
||||||
apiVersion: v1
|
apiVersion: v1
|
||||||
kind: Secret
|
kind: Secret
|
||||||
metadata:
|
metadata:
|
||||||
|
|||||||
@@ -15,7 +15,7 @@ namespace k8s.E2E
|
|||||||
{
|
{
|
||||||
public void Initialize(TestLoggerEvents events, Dictionary<string, string> parameters)
|
public void Initialize(TestLoggerEvents events, Dictionary<string, string> parameters)
|
||||||
{
|
{
|
||||||
if (parameters.TryGetValue("file", out var file))
|
if (parameters != null && parameters.TryGetValue("file", out var file))
|
||||||
{
|
{
|
||||||
InnerInitialize(events, file);
|
InnerInitialize(events, file);
|
||||||
}
|
}
|
||||||
@@ -27,6 +27,11 @@ namespace k8s.E2E
|
|||||||
|
|
||||||
private static void InnerInitialize(TestLoggerEvents events, string file)
|
private static void InnerInitialize(TestLoggerEvents events, string file)
|
||||||
{
|
{
|
||||||
|
if (events == null)
|
||||||
|
{
|
||||||
|
throw new ArgumentNullException(nameof(events));
|
||||||
|
}
|
||||||
|
|
||||||
Console.WriteLine($"using {file} for skipped test case log");
|
Console.WriteLine($"using {file} for skipped test case log");
|
||||||
events.TestResult += (sender, args) =>
|
events.TestResult += (sender, args) =>
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user