Skip to content

Commit 1c870bf

Browse files
committed
feat: upgrade KubernetesClient
1 parent 38a4e5c commit 1c870bf

File tree

15 files changed

+18
-130
lines changed

15 files changed

+18
-130
lines changed

README.md

Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -12,17 +12,21 @@ detailed documentation, head to the [GitHub Pages](https://buehler.github.io/dot
1212

1313
## Packages
1414

15+
All packages support .NET6.0 and higher. The reason is that modern C# features are
16+
used and client libraries are still possible for .NET 6.0 and up.
17+
Also, the KubernetesClient package follows the same strategy regarding the
18+
older framework versions.
1519
The following packages exist:
1620

17-
| Package | Description | Framework Support | Latest Version |
18-
|----------------------------------------------------------------------|--------------------------------------------------------|---------------------------------------------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
19-
| [KubeOps.Abstractions](./src/KubeOps.Abstractions/README.md) | Contains abstractions, attributes, etc. for the SDK | netstandard2.0 netstandard2.1 net6.0 net7.0 | [![Nuget](https://img.shields.io/nuget/vpre/KubeOps.Abstractions?label=nuget%20prerelease)](https://www.nuget.org/packages/KubeOps.Abstractions/absoluteLatest) |
20-
| [KubeOps.Cli](./src/KubeOps.Cli/README.md) | CLI Dotnet Tool to generate stuff | net7.0 | [![Nuget](https://img.shields.io/nuget/vpre/KubeOps.Cli?label=nuget%20prerelease)](https://www.nuget.org/packages/KubeOps.Cli/absoluteLatest) |
21-
| [KubeOps.Generator](./src/KubeOps.Generator/README.md) | Source Generator for the SDK | netstandard2.0 | [![Nuget](https://img.shields.io/nuget/vpre/KubeOps.Generator?label=nuget%20prerelease)](https://www.nuget.org/packages/KubeOps.Generator/absoluteLatest) |
22-
| [KubeOps.KubernetesClient](./src/KubeOps.KubernetesClient/README.md) | Extended client to communicate with the Kubernetes API | net6.0 net7.0 | [![Nuget](https://img.shields.io/nuget/vpre/KubeOps.KubernetesClient?label=nuget%20prerelease)](https://www.nuget.org/packages/KubeOps.KubernetesClient/absoluteLatest) |
23-
| [KubeOps.Operator](./src/KubeOps.Operator/README.md) | Main SDK entrypoint to create an operator | net6.0 net7.0 | [![Nuget](https://img.shields.io/nuget/vpre/KubeOps.Operator?label=nuget%20prerelease)](https://www.nuget.org/packages/KubeOps.Operator/absoluteLatest) |
24-
| [KubeOps.Operator.Web](./src/KubeOps.Operator.Web/README.md) | Web part of the operator (for webhooks) | net6.0 net7.0 | [![Nuget](https://img.shields.io/nuget/vpre/KubeOps.Operator.Web?label=nuget%20prerelease)](https://www.nuget.org/packages/KubeOps.Operator.Web/absoluteLatest) |
25-
| [KubeOps.Transpiler](./src/KubeOps.Transpiler/README.md) | Transpilation helpers for CRDs and RBAC elements | netstandard2.0 netstandard2.1 net6.0 net7.0 | [![Nuget](https://img.shields.io/nuget/vpre/KubeOps.Transpiler?label=nuget%20prerelease)](https://www.nuget.org/packages/KubeOps.Transpiler/absoluteLatest) |
21+
| Package | Description | Latest Version |
22+
|----------------------------------------------------------------------|--------------------------------------------------------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
23+
| [KubeOps.Abstractions](./src/KubeOps.Abstractions/README.md) | Contains abstractions, attributes, etc. for the SDK | [![Nuget](https://img.shields.io/nuget/vpre/KubeOps.Abstractions?label=nuget%20prerelease)](https://www.nuget.org/packages/KubeOps.Abstractions/absoluteLatest) |
24+
| [KubeOps.Cli](./src/KubeOps.Cli/README.md) | CLI Dotnet Tool to generate stuff | [![Nuget](https://img.shields.io/nuget/vpre/KubeOps.Cli?label=nuget%20prerelease)](https://www.nuget.org/packages/KubeOps.Cli/absoluteLatest) |
25+
| [KubeOps.Generator](./src/KubeOps.Generator/README.md) | Source Generator for the SDK | [![Nuget](https://img.shields.io/nuget/vpre/KubeOps.Generator?label=nuget%20prerelease)](https://www.nuget.org/packages/KubeOps.Generator/absoluteLatest) |
26+
| [KubeOps.KubernetesClient](./src/KubeOps.KubernetesClient/README.md) | Extended client to communicate with the Kubernetes API | [![Nuget](https://img.shields.io/nuget/vpre/KubeOps.KubernetesClient?label=nuget%20prerelease)](https://www.nuget.org/packages/KubeOps.KubernetesClient/absoluteLatest) |
27+
| [KubeOps.Operator](./src/KubeOps.Operator/README.md) | Main SDK entrypoint to create an operator | [![Nuget](https://img.shields.io/nuget/vpre/KubeOps.Operator?label=nuget%20prerelease)](https://www.nuget.org/packages/KubeOps.Operator/absoluteLatest) |
28+
| [KubeOps.Operator.Web](./src/KubeOps.Operator.Web/README.md) | Web part of the operator (for webhooks) | [![Nuget](https://img.shields.io/nuget/vpre/KubeOps.Operator.Web?label=nuget%20prerelease)](https://www.nuget.org/packages/KubeOps.Operator.Web/absoluteLatest) |
29+
| [KubeOps.Transpiler](./src/KubeOps.Transpiler/README.md) | Transpilation helpers for CRDs and RBAC elements | [![Nuget](https://img.shields.io/nuget/vpre/KubeOps.Transpiler?label=nuget%20prerelease)](https://www.nuget.org/packages/KubeOps.Transpiler/absoluteLatest) |
2630

2731
## Contribution
2832

src/KubeOps.Abstractions/Controller/IEntityController{TEntity}.cs

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -41,12 +41,8 @@ public interface IEntityController<in TEntity>
4141
/// </summary>
4242
/// <param name="entity">The entity that fired the reconcile event.</param>
4343
/// <returns>A task that completes when the reconciliation is done.</returns>
44-
#if NETSTANDARD2_0
45-
Task ReconcileAsync(TEntity entity);
46-
#else
4744
Task ReconcileAsync(TEntity entity) =>
4845
Task.CompletedTask;
49-
#endif
5046

5147
/// <summary>
5248
/// Called for `delete` events for a given entity.
@@ -55,10 +51,6 @@ Task ReconcileAsync(TEntity entity) =>
5551
/// <returns>
5652
/// A task that completes, when the reconciliation is done.
5753
/// </returns>
58-
#if NETSTANDARD2_0
59-
Task DeletedAsync(TEntity entity);
60-
#else
6154
Task DeletedAsync(TEntity entity) =>
6255
Task.CompletedTask;
63-
#endif
6456
}

src/KubeOps.Abstractions/Entities/Attributes/GenericAdditionalPrinterColumnAttribute.cs

Lines changed: 1 addition & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
1-
using k8s.Models;
2-
3-
namespace KubeOps.Abstractions.Entities.Attributes;
1+
namespace KubeOps.Abstractions.Entities.Attributes;
42

53
/// <summary>
64
/// Defines a generic additional printer column.
@@ -40,11 +38,7 @@ public GenericAdditionalPrinterColumnAttribute(string jsonPath, string name, str
4038
/// <summary>
4139
/// Description for the column.
4240
/// </summary>
43-
#if NETSTANDARD
44-
public string? Description { get; set; }
45-
#else
4641
public string? Description { get; init; }
47-
#endif
4842

4943
/// <summary>
5044
/// The type of the column.
@@ -104,11 +98,7 @@ public GenericAdditionalPrinterColumnAttribute(string jsonPath, string name, str
10498
/// </item>
10599
/// </list>
106100
/// </summary>
107-
#if NETSTANDARD
108-
public string? Format { get; set; }
109-
#else
110101
public string? Format { get; init; }
111-
#endif
112102

113103
/// <summary>
114104
/// The priority of the additional printer column.
@@ -124,9 +114,5 @@ public GenericAdditionalPrinterColumnAttribute(string jsonPath, string name, str
124114
/// </item>
125115
/// </list>
126116
/// </summary>
127-
#if NETSTANDARD
128-
public PrinterColumnPriority Priority { get; set; }
129-
#else
130117
public PrinterColumnPriority Priority { get; init; }
131-
#endif
132118
}
Lines changed: 0 additions & 51 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
namespace KubeOps.Abstractions.Entities;
22

3-
#if NET
43
/// <summary>
54
/// Metadata for a given entity.
65
/// </summary>
@@ -25,53 +24,3 @@ public record EntityMetadata(string Kind, string Version, string? Group = null,
2524
/// </summary>
2625
public string PluralName => Plural ?? $"{Kind.ToLower()}s";
2726
}
28-
#else
29-
/// <summary>
30-
/// Metadata for a given entity.
31-
/// </summary>
32-
public class EntityMetadata
33-
{
34-
public EntityMetadata(string kind, string version, string? group = null, string? plural = null)
35-
{
36-
Kind = kind;
37-
Version = version;
38-
Group = group;
39-
Plural = plural;
40-
}
41-
42-
/// <summary>
43-
/// The kind of the entity (e.g. deployment).
44-
/// </summary>
45-
public string Kind { get; }
46-
47-
/// <summary>
48-
/// Version (e.g. v1 or v2-alpha).
49-
/// </summary>
50-
public string Version { get; }
51-
52-
/// <summary>
53-
/// The group in Kubernetes (e.g. "testing.dev").
54-
/// </summary>
55-
public string? Group { get; }
56-
57-
/// <summary>
58-
/// An optional plural name. Defaults to the singular name with an added "s".
59-
/// </summary>
60-
public string? Plural { get; }
61-
62-
/// <summary>
63-
/// Kind of the entity when used in a list.
64-
/// </summary>
65-
public string ListKind => $"{Kind}List";
66-
67-
/// <summary>
68-
/// Name of the singular entity.
69-
/// </summary>
70-
public string SingularName => Kind.ToLower();
71-
72-
/// <summary>
73-
/// Name of the plural entity.
74-
/// </summary>
75-
public string PluralName => Plural ?? $"{Kind.ToLower()}s";
76-
}
77-
#endif

src/KubeOps.Abstractions/Finalizer/IEntityFinalizer{TEntity}.cs

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,6 @@ public interface IEntityFinalizer<in TEntity>
1515
/// </summary>
1616
/// <param name="entity">The kubernetes entity that needs to be finalized.</param>
1717
/// <returns>A task that resolves when the operation is done.</returns>
18-
#if NETSTANDARD2_0
19-
Task FinalizeAsync(TEntity entity);
20-
#else
2118
Task FinalizeAsync(TEntity entity) =>
2219
Task.CompletedTask;
23-
#endif
2420
}
Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<Project Sdk="Microsoft.NET.Sdk">
22

33
<PropertyGroup>
4-
<TargetFrameworks>netstandard2.0;netstandard2.1;net6.0;net7.0</TargetFrameworks>
4+
<TargetFrameworks>net6.0;net7.0</TargetFrameworks>
55
</PropertyGroup>
66

77
<PropertyGroup>
@@ -14,11 +14,8 @@
1414
</PropertyGroup>
1515

1616
<ItemGroup>
17-
<PackageReference Include="KubernetesClient.Models" Version="12.0.16"/>
17+
<PackageReference Include="KubernetesClient" Version="12.1.1"/>
1818
<PackageReference Include="Microsoft.Extensions.Hosting.Abstractions" Version="7.0.0"/>
1919
</ItemGroup>
2020

21-
22-
23-
2421
</Project>

src/KubeOps.Abstractions/Rbac/EntityRbacAttribute.cs

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -31,9 +31,5 @@ public EntityRbacAttribute(params Type[] entities)
3131
/// "verbs: ["get", "list", "watch"]".
3232
/// </para>
3333
/// </summary>
34-
#if NETSTANDARD
35-
public RbacVerb Verbs { get; set; }
36-
#else
3734
public RbacVerb Verbs { get; init; }
38-
#endif
3935
}

src/KubeOps.Abstractions/Rbac/GenericRbacAttribute.cs

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -18,11 +18,7 @@ public class GenericRbacAttribute : RbacAttribute
1818
/// "apiGroups: ...".
1919
/// </para>
2020
/// </summary>
21-
#if NETSTANDARD
22-
public string[] Groups { get; set; } = { };
23-
#else
2421
public string[] Groups { get; init; } = Array.Empty<string>();
25-
#endif
2622

2723
/// <summary>
2824
/// <para>List of resources.</para>
@@ -31,20 +27,12 @@ public class GenericRbacAttribute : RbacAttribute
3127
/// "resources: ["pods"]".
3228
/// </para>
3329
/// </summary>
34-
#if NETSTANDARD
35-
public string[] Resources { get; set; } = { };
36-
#else
3730
public string[] Resources { get; init; } = Array.Empty<string>();
38-
#endif
3931

4032
/// <summary>
4133
/// List of urls.
4234
/// </summary>
43-
#if NETSTANDARD
44-
public string[] Urls { get; set; } = { };
45-
#else
4635
public string[] Urls { get; init; } = Array.Empty<string>();
47-
#endif
4836

4937
/// <summary>
5038
/// <para>Flags ("list") of allowed verbs.</para>
@@ -53,9 +41,5 @@ public class GenericRbacAttribute : RbacAttribute
5341
/// "verbs: ["get", "list", "watch"]".
5442
/// </para>
5543
/// </summary>
56-
#if NETSTANDARD
57-
public RbacVerb Verbs { get; set; }
58-
#else
5944
public RbacVerb Verbs { get; init; }
60-
#endif
6145
}

src/KubeOps.Cli/KubeOps.Cli.csproj

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@
1818

1919
<ItemGroup>
2020
<PackageReference Include="BouncyCastle.Cryptography" Version="2.2.1" />
21-
<PackageReference Include="KubernetesClient" Version="12.0.16"/>
2221
<PackageReference Include="Microsoft.Build.Locator" Version="1.6.10" />
2322
<PackageReference Include="Microsoft.CodeAnalysis.CSharp" Version="4.7.0"/>
2423
<PackageReference Include="Microsoft.CodeAnalysis.CSharp.Workspaces" Version="4.7.0" />

src/KubeOps.KubernetesClient/KubeOps.KubernetesClient.csproj

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,6 @@
1515
</PackageDescription>
1616
</PropertyGroup>
1717

18-
<ItemGroup>
19-
<PackageReference Include="KubernetesClient" Version="12.0.16"/>
20-
</ItemGroup>
21-
2218
<ItemGroup>
2319
<ProjectReference Include="..\KubeOps.Abstractions\KubeOps.Abstractions.csproj"/>
2420
</ItemGroup>

0 commit comments

Comments
 (0)