Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
chore(deps): upgrade KubernetesClient to version 18.0.5
- Updated project files to use the latest version of `KubernetesClient` across the solution.
- Adjusted `Crds` logic to align with the updated library API.
  • Loading branch information
kimpenhaus committed Oct 31, 2025
commit 7a65fed003b63919b3d342b6a6d6f4980bb1a198
2 changes: 1 addition & 1 deletion src/KubeOps.Abstractions/KubeOps.Abstractions.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@

<ItemGroup>
<PackageReference Include="JsonPatch.Net" Version="3.3.0" />
<PackageReference Include="KubernetesClient" Version="17.0.14" />
<PackageReference Include="KubernetesClient" Version="18.0.5" />
<PackageReference Include="Microsoft.Extensions.Hosting.Abstractions" Version="9.0.10"/>
<PackageReference Include="ZiggyCreatures.FusionCache" Version="2.4.0" />
</ItemGroup>
Expand Down
37 changes: 22 additions & 15 deletions src/KubeOps.Transpiler/Crds.cs
Original file line number Diff line number Diff line change
Expand Up @@ -48,13 +48,13 @@ public static V1CustomResourceDefinition Transpile(this MetadataLoadContext cont
{
type = context.GetContextType(type);
var (meta, scope) = context.ToEntityMetadata(type);
var crd = new V1CustomResourceDefinition(new()).Initialize();
var crd = new V1CustomResourceDefinition { Spec = new() }.Initialize();

crd.Metadata.Name = $"{meta.PluralName}.{meta.Group}";
crd.Spec.Group = meta.Group;

crd.Spec.Names =
new V1CustomResourceDefinitionNames
new()
{
Kind = meta.Kind,
ListKind = meta.ListKind,
Expand All @@ -68,25 +68,32 @@ public static V1CustomResourceDefinition Transpile(this MetadataLoadContext cont
crd.Spec.Names.ShortNames = shortNames.Select(a => a.Value?.ToString()).ToList();
}

var version = new V1CustomResourceDefinitionVersion(meta.Version, true, true);
var version = new V1CustomResourceDefinitionVersion { Name = meta.Version, Served = true, Storage = true };
if
(type.GetProperty("Status") != null
|| type.GetProperty("status") != null)
{
version.Subresources = new V1CustomResourceSubresources(null, new object());
version.Subresources = new()
{
Scale = null,
Status = new(),
};
}

version.Schema = new V1CustomResourceValidation(new V1JSONSchemaProps
{
Type = Object,
Description =
type.GetCustomAttributeData<DescriptionAttribute>()?.GetCustomAttributeCtorArg<string>(context, 0),
Properties = type.GetProperties()
.Where(p => !IgnoredToplevelProperties.Contains(p.Name.ToLowerInvariant())
&& p.GetCustomAttributeData<IgnoreAttribute>() == null)
.Select(p => (Name: p.GetPropertyName(context), Schema: context.Map(p)))
.ToDictionary(t => t.Name, t => t.Schema),
});
version.Schema = new()
{
OpenAPIV3Schema = new()
{
Type = Object,
Description =
type.GetCustomAttributeData<DescriptionAttribute>()?.GetCustomAttributeCtorArg<string>(context, 0),
Properties = type.GetProperties()
.Where(p => !IgnoredToplevelProperties.Contains(p.Name.ToLowerInvariant())
&& p.GetCustomAttributeData<IgnoreAttribute>() == null)
.Select(p => (Name: p.GetPropertyName(context), Schema: context.Map(p)))
.ToDictionary(t => t.Name, t => t.Schema),
},
};

version.AdditionalPrinterColumns = context.MapPrinterColumns(type).ToList() switch
{
Expand Down
2 changes: 1 addition & 1 deletion test/KubeOps.Cli.Test/KubeOps.Cli.Test.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<ProjectReference Include="..\..\src\KubeOps.Cli\KubeOps.Cli.csproj" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="KubernetesClient" Version="17.0.14" />
<PackageReference Include="KubernetesClient" Version="18.0.5" />
<PackageReference Include="Microsoft.CodeAnalysis" Version="4.14.0" />
<PackageReference Include="Microsoft.CodeAnalysis.Common" Version="4.14.0" />
<PackageReference Include="Microsoft.CodeAnalysis.CSharp" Version="4.14.0" />
Expand Down
2 changes: 1 addition & 1 deletion test/KubeOps.Operator.Test/KubeOps.Operator.Test.csproj
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<Project Sdk="Microsoft.NET.Sdk">
<ItemGroup>
<PackageReference Include="KubernetesClient" Version="17.0.14" />
<PackageReference Include="KubernetesClient" Version="18.0.5" />
<PackageReference Include="Microsoft.Build.Locator" Version="1.10.2"/>
<PackageReference Include="Microsoft.CodeAnalysis" Version="4.14.0" />
<PackageReference Include="Microsoft.CodeAnalysis.Common" Version="4.14.0" />
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<Project Sdk="Microsoft.NET.Sdk">
<ItemGroup>
<PackageReference Include="KubernetesClient" Version="17.0.14" />
<PackageReference Include="KubernetesClient" Version="18.0.5" />
<PackageReference Include="Microsoft.AspNetCore.Mvc.Testing" Version="9.0.10"/>
<PackageReference Include="Microsoft.Build.Locator" Version="1.10.2"/>
<PackageReference Include="Microsoft.CodeAnalysis" Version="4.14.0" />
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">

<ItemGroup>
<PackageReference Include="KubernetesClient" Version="17.0.14" />
<PackageReference Include="KubernetesClient" Version="18.0.5" />
<PackageReference Include="Microsoft.Build.Locator" Version="1.10.2" />
<PackageReference Include="Microsoft.CodeAnalysis" Version="4.14.0" />
<PackageReference Include="Microsoft.CodeAnalysis.Common" Version="4.14.0" />
Expand Down