generate api v1.32 (#1603)

* generate based on v1.32

* bump ver

* Delete swagger.json.unprocessed

* Update target frameworks and SDK versions in project files

* Remove extra API endpoint from swagger.json

* Update .NET SDK version to 9.0.x and adjust package references

* happy build

* Enhance certificate handling for .NET 9.0 compatibility in CertUtils and KubernetesClientConfiguration

* Add mapping for V1beta1ResourceClaim to V1ResourceClaim in AutoMapper configurations

* Refactor certificate loading to improve compatibility with .NET 9.0

* Update package versions in Directory.Packages.props for improved compatibility and features

* Update Fractions package version to 7.3.0 for improved compatibility
This commit is contained in:
Boshi Lian
2025-01-07 07:12:29 -08:00
committed by GitHub
parent 61e6b13fd7
commit f7e7613d09
21 changed files with 8211 additions and 5671 deletions

View File

@@ -15,8 +15,8 @@ jobs:
uses: actions/setup-dotnet@v4
with:
dotnet-version: |
6.0.x
8.0.x
9.0.x
# - name: Check Format
# # don't check formatting on Windows b/c of CRLF issues.
# if: matrix.os == 'ubuntu-latest'
@@ -66,8 +66,8 @@ jobs:
uses: actions/setup-dotnet@v4
with:
dotnet-version: |
6.0.x
8.0.x
9.0.x
- name: Minikube
run: minikube start
- name: Test

View File

@@ -34,8 +34,8 @@ jobs:
uses: actions/setup-dotnet@v4
with:
dotnet-version: |
6.0.x
8.0.x
9.0.x
# Initializes the CodeQL tools for scanning.
- name: Initialize CodeQL

View File

@@ -33,8 +33,8 @@ jobs:
uses: actions/setup-dotnet@v4
with:
dotnet-version: |
6.0.x
8.0.x
9.0.x
- name: Build
run: dotnet build -c Release

View File

@@ -21,8 +21,8 @@ jobs:
uses: actions/setup-dotnet@v4
with:
dotnet-version: |
6.0.x
8.0.x
9.0.x
- name: dotnet restore
run: dotnet restore --verbosity minimal --configfile nuget.config

View File

@@ -18,8 +18,8 @@ jobs:
uses: actions/setup-dotnet@v4
with:
dotnet-version: |
6.0.x
8.0.x
9.0.x
- name: dotnet restore
run: dotnet restore --verbosity minimal --configfile nuget.config

View File

@@ -3,19 +3,19 @@
<ManagePackageVersionsCentrally>true</ManagePackageVersionsCentrally>
</PropertyGroup>
<ItemGroup>
<PackageVersion Include="AutoMapper" Version="12.0.1" />
<PackageVersion Include="BouncyCastle.Cryptography" Version="2.3.1" />
<PackageVersion Include="FluentAssertions" Version="6.12.0" />
<PackageVersion Include="AutoMapper" Version="13.0.1" />
<PackageVersion Include="BouncyCastle.Cryptography" Version="2.5.0" />
<PackageVersion Include="FluentAssertions" Version="7.0.0" />
<PackageVersion Include="Fractions" Version="7.3.0" />
<PackageVersion Include="IdentityModel.OidcClient" Version="5.2.1" />
<PackageVersion Include="IdentityModel.OidcClient" Version="6.0.0" />
<PackageVersion Include="JsonPatch.Net" Version="2.1.0" />
<PackageVersion Include="MartinCostello.Logging.XUnit" Version="0.3.0" />
<PackageVersion Include="Microsoft.Bcl.AsyncInterfaces" Version="8.0.0" />
<PackageVersion Include="Microsoft.Extensions.Hosting" Version="8.0.0" />
<PackageVersion Include="Microsoft.Extensions.Logging" Version="8.0.0" />
<PackageVersion Include="Microsoft.NET.Test.Sdk" Version="17.8.0" />
<PackageVersion Include="Microsoft.TestPlatform.ObjectModel" Version="17.8.0" />
<PackageVersion Include="Moq" Version="4.20.70" />
<PackageVersion Include="MartinCostello.Logging.XUnit" Version="0.5.1" />
<PackageVersion Include="Microsoft.Bcl.AsyncInterfaces" Version="9.0.0" />
<PackageVersion Include="Microsoft.Extensions.Hosting" Version="9.0.0" />
<PackageVersion Include="Microsoft.Extensions.Logging" Version="9.0.0" />
<PackageVersion Include="Microsoft.NET.Test.Sdk" Version="17.12.0" />
<PackageVersion Include="Microsoft.TestPlatform.ObjectModel" Version="17.12.0" />
<PackageVersion Include="Moq" Version="4.20.72" />
<PackageVersion Include="Nito.AsyncEx" Version="5.1.2" />
<PackageVersion Include="Nito.AsyncEx.Coordination" Version="5.1.2" />
<PackageVersion Include="OpenTelemetry.Exporter.Console" Version="1.7.0" />
@@ -23,19 +23,19 @@
<PackageVersion Include="Portable.BouncyCastle" Version="1.9.0" />
<PackageVersion Include="SharpZipLib" Version="1.4.2" />
<PackageVersion Include="Swashbuckle.AspNetCore" Version="6.5.0" />
<PackageVersion Include="System.Diagnostics.DiagnosticSource" Version="8.0.0" />
<PackageVersion Include="System.IdentityModel.Tokens.Jwt" Version="7.1.2" />
<PackageVersion Include="System.IO.Abstractions.TestingHelpers" Version="20.0.15" />
<PackageVersion Include="System.Reactive" Version="6.0.0" />
<PackageVersion Include="System.Text.Json" Version="8.0.4" />
<PackageVersion Include="Vecc.YamlDotNet.Analyzers.StaticGenerator" Version="16.0.0" />
<PackageVersion Include="xunit" Version="2.6.6" />
<PackageVersion Include="xunit.runner.visualstudio" Version="2.5.6" />
<PackageVersion Include="System.Diagnostics.DiagnosticSource" Version="9.0.0" />
<PackageVersion Include="System.IdentityModel.Tokens.Jwt" Version="8.3.0" />
<PackageVersion Include="System.IO.Abstractions.TestingHelpers" Version="21.2.1" />
<PackageVersion Include="System.Reactive" Version="6.0.1" />
<PackageVersion Include="System.Text.Json" Version="9.0.0" />
<PackageVersion Include="Vecc.YamlDotNet.Analyzers.StaticGenerator" Version="16.3.0" />
<PackageVersion Include="xunit" Version="2.9.2" />
<PackageVersion Include="xunit.runner.visualstudio" Version="3.0.0" />
<PackageVersion Include="Xunit.StaFact" Version="1.1.11" />
<PackageVersion Include="YamlDotNet" Version="16.0.0" />
<PackageVersion Include="YamlDotNet" Version="16.3.0" />
</ItemGroup>
<ItemGroup>
<PackageVersion Include="Autofac" Version="8.0.0" />
<PackageVersion Include="Autofac" Version="8.2.0" />
<PackageVersion Include="CaseExtensions" Version="1.1.0" />
<PackageVersion Include="Microsoft.CodeAnalysis.CSharp.Workspaces" Version="4.4.0" />
<PackageVersion Include="Namotion.Reflection" Version="3.0.1" />
@@ -45,10 +45,10 @@
<PackageVersion Include="Scriban" Version="5.9.1" />
</ItemGroup>
<ItemGroup>
<GlobalPackageReference Include="Microsoft.CodeAnalysis.NetAnalyzers" Version="8.0.0" />
<GlobalPackageReference Include="Microsoft.CodeAnalysis.NetAnalyzers" Version="9.0.0" />
<GlobalPackageReference Include="Microsoft.SourceLink.GitHub" Version="8.0.0" />
<GlobalPackageReference Include="Microsoft.VisualStudio.SlnGen" Version="11.2.6" />
<GlobalPackageReference Include="Nerdbank.GitVersioning" Version="3.6.133" />
<GlobalPackageReference Include="Microsoft.VisualStudio.SlnGen" Version="12.0.3" />
<GlobalPackageReference Include="Nerdbank.GitVersioning" Version="3.7.112" />
<GlobalPackageReference Include="StyleCop.Analyzers" Version="1.1.118" />
</ItemGroup>
</Project>

View File

@@ -154,7 +154,9 @@ ${GEN_DIR}/openapi/csharp.sh ${REPO_DIR}/src/KubernetesClient ${REPO_DIR}/csharp
| SDK Version | Kubernetes Version | .NET Targeting |
|-------------|--------------------|-----------------------------------------------------|
| 14.0 | 1.30 | net6.0;net8.0;net48*;netstandard2.0* |
| 16.0 | 1.32 | net8.0;net9.0;net48*;netstandard2.0* |
| 15.0 | 1.31 | net6.0;net8.0;net48*;netstandard2.0* |
| 14.0 | 1.30 | net6.0;net8.0;net48*;netstandard2.0* |
| 13.0 | 1.29 | net6.0;net7.0;net8.0;net48*;netstandard2.0* |
| 12.0 | 1.28 | net6.0;net7.0;net48*;netstandard2.0* |
| 11.0 | 1.27 | net6.0;net7.0;net48*;netstandard2.0* |

View File

@@ -1,3 +1,3 @@
export KUBERNETES_BRANCH=v1.31.0
export KUBERNETES_BRANCH=v1.32.0
export CLIENT_VERSION=0.0.1
export PACKAGE_NAME=k8s

View File

@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFrameworks>net8.0</TargetFrameworks>
<TargetFrameworks>net8.0;net9.0</TargetFrameworks>
<RootNamespace>k8s</RootNamespace>
<PublishAot>true</PublishAot>
<IsAotCompatible>true</IsAotCompatible>

View File

@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFrameworks>net6.0;net8.0</TargetFrameworks>
<TargetFrameworks>net8.0;net9.0</TargetFrameworks>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<RootNamespace>k8s.kubectl</RootNamespace>

View File

@@ -168,8 +168,9 @@ internal static partial class VersionConverter
.ForMember(dest => dest.Request, opt => opt.Ignore())
.ReverseMap();
cfg.CreateMap<V1beta3PolicyRulesWithSubjects, V1PolicyRulesWithSubjects>()
.ForMember(dest => dest.Subjects, opt => opt.Ignore())
cfg.CreateMap<V1beta1ResourceClaim, V1ResourceClaim>()
.ForMember(dest => dest.Name, opt => opt.Ignore())
.ForMember(dest => dest.Request, opt => opt.Ignore())
.ReverseMap();
}
}

View File

@@ -1,6 +1,6 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFrameworks>net6.0;net8.0</TargetFrameworks>
<TargetFrameworks>net8.0;net9.0</TargetFrameworks>
<RootNamespace>k8s.ModelConverter</RootNamespace>
</PropertyGroup>

View File

@@ -80,11 +80,20 @@ namespace k8s
if (config.ClientCertificateKeyStoreFlags.HasValue)
{
#if NET9_0_OR_GREATER
X509CertificateLoader.LoadPkcs12(cert.Export(X509ContentType.Pkcs12), nullPassword, config.ClientCertificateKeyStoreFlags.Value);
#else
cert = new X509Certificate2(cert.Export(X509ContentType.Pkcs12), nullPassword, config.ClientCertificateKeyStoreFlags.Value);
#endif
}
else
{
#if NET9_0_OR_GREATER
X509CertificateLoader.LoadPkcs12(cert.Export(X509ContentType.Pkcs12), nullPassword);
#else
cert = new X509Certificate2(cert.Export(X509ContentType.Pkcs12), nullPassword);
#endif
}
}

View File

@@ -1,13 +1,12 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFrameworks>net6.0;net8.0</TargetFrameworks>
<TargetFrameworks>net8.0;net9.0</TargetFrameworks>
<RootNamespace>k8s</RootNamespace>
<EmitCompilerGeneratedFiles>true</EmitCompilerGeneratedFiles>
</PropertyGroup>
<ItemGroup>
<PackageReference Condition="'$(TargetFramework)'=='net6.0'" Include="System.Diagnostics.DiagnosticSource" VersionOverride="7.0.0" />
<PackageReference Include="System.IdentityModel.Tokens.Jwt" />
<PackageReference Include="IdentityModel.OidcClient" />
<PackageReference Include="Fractions" />

View File

@@ -307,17 +307,27 @@ namespace k8s
{
if (!string.IsNullOrEmpty(clusterDetails.ClusterEndpoint.CertificateAuthorityData))
{
var data = clusterDetails.ClusterEndpoint.CertificateAuthorityData;
#if NET9_0_OR_GREATER
SslCaCerts = new X509Certificate2Collection(X509CertificateLoader.LoadCertificate(Convert.FromBase64String(data)));
#else
string nullPassword = null;
// This null password is to change the constructor to fix this KB:
// https://support.microsoft.com/en-us/topic/kb5025823-change-in-how-net-applications-import-x-509-certificates-bf81c936-af2b-446e-9f7a-016f4713b46b
string nullPassword = null;
var data = clusterDetails.ClusterEndpoint.CertificateAuthorityData;
SslCaCerts = new X509Certificate2Collection(new X509Certificate2(Convert.FromBase64String(data), nullPassword));
#endif
}
else if (!string.IsNullOrEmpty(clusterDetails.ClusterEndpoint.CertificateAuthority))
{
#if NET9_0_OR_GREATER
SslCaCerts = new X509Certificate2Collection(X509CertificateLoader.LoadCertificateFromFile(GetFullPath(
k8SConfig,
clusterDetails.ClusterEndpoint.CertificateAuthority)));
#else
SslCaCerts = new X509Certificate2Collection(new X509Certificate2(GetFullPath(
k8SConfig,
clusterDetails.ClusterEndpoint.CertificateAuthority)));
#endif
}
}
}

13707
swagger.json

File diff suppressed because it is too large Load Diff

View File

@@ -2,7 +2,7 @@
<PropertyGroup>
<IsPackable>false</IsPackable>
<RootNamespace>k8s.E2E</RootNamespace>
<TargetFrameworks>net6.0;net8.0</TargetFrameworks>
<TargetFrameworks>net8.0;net9.0</TargetFrameworks>
</PropertyGroup>
<ItemGroup>

View File

@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFrameworks>net6.0;net8.0</TargetFrameworks>
<TargetFrameworks>net8.0;net9.0</TargetFrameworks>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<IsPackable>false</IsPackable>

View File

@@ -2,8 +2,8 @@
<PropertyGroup>
<IsPackable>false</IsPackable>
<RootNamespace>k8s.Tests</RootNamespace>
<TargetFrameworks Condition="'$(OS)' != 'Windows_NT'">net6.0;net8.0</TargetFrameworks>
<TargetFrameworks Condition="'$(OS)' == 'Windows_NT'">net6.0;net8.0;net48</TargetFrameworks>
<TargetFrameworks Condition="'$(OS)' != 'Windows_NT'">net8.0;net9.0</TargetFrameworks>
<TargetFrameworks Condition="'$(OS)' == 'Windows_NT'">net8.0;net9.0;net48</TargetFrameworks>
</PropertyGroup>
<ItemGroup>

View File

@@ -2,7 +2,7 @@
<PropertyGroup>
<IsPackable>false</IsPackable>
<RootNamespace>k8s.Tests</RootNamespace>
<TargetFrameworks>net6.0;net8.0</TargetFrameworks>
<TargetFrameworks>net8.0;net9.0</TargetFrameworks>
</PropertyGroup>
<ItemGroup>

View File

@@ -1,6 +1,6 @@
{
"$schema": "https://raw.githubusercontent.com/AArnott/Nerdbank.GitVersioning/master/src/NerdBank.GitVersioning/version.schema.json",
"version": "15.0",
"version": "16.0",
"publicReleaseRefSpec": [
"^refs/heads/master$",
"^refs/tags/v\\d+\\.\\d+\\.\\d+"