From 534aaf73fa844658db7a7222d749001180750b44 Mon Sep 17 00:00:00 2001 From: Boshi Lian Date: Tue, 8 Nov 2022 16:29:59 -0800 Subject: [PATCH 01/10] add net7 --- .github/workflows/buildtest.yaml | 3 ++- .github/workflows/codeql-analysis.yml | 3 ++- .github/workflows/draft.yaml | 3 ++- .github/workflows/nuget.yaml | 3 ++- examples/Directory.Build.props | 2 +- global.json | 2 +- src/KubernetesClient.Kubectl/KubernetesClient.Kubectl.csproj | 2 +- src/KubernetesClient/KubernetesClient.csproj | 2 +- tests/E2E.Tests/E2E.Tests.csproj | 2 +- tests/Kubectl.Tests/Kubectl.Tests.csproj | 2 +- tests/KubernetesClient.Tests/KubernetesClient.Tests.csproj | 2 +- 11 files changed, 15 insertions(+), 11 deletions(-) diff --git a/.github/workflows/buildtest.yaml b/.github/workflows/buildtest.yaml index c23aa96ac..2eabc678e 100644 --- a/.github/workflows/buildtest.yaml +++ b/.github/workflows/buildtest.yaml @@ -17,7 +17,8 @@ jobs: dotnet-version: | 3.1.x 5.0.x - 6.0.x + 6.0.x + 7.0.x # - name: Check Format # # don't check formatting on Windows b/c of CRLF issues. # if: matrix.os == 'ubuntu-latest' diff --git a/.github/workflows/codeql-analysis.yml b/.github/workflows/codeql-analysis.yml index b1a19e385..5ac49afae 100644 --- a/.github/workflows/codeql-analysis.yml +++ b/.github/workflows/codeql-analysis.yml @@ -31,7 +31,8 @@ jobs: dotnet-version: | 3.1.x 5.0.x - 6.0.x + 6.0.x + 7.0.x # Initializes the CodeQL tools for scanning. - name: Initialize CodeQL diff --git a/.github/workflows/draft.yaml b/.github/workflows/draft.yaml index 21863b8f7..2bd97f4fc 100644 --- a/.github/workflows/draft.yaml +++ b/.github/workflows/draft.yaml @@ -20,7 +20,8 @@ jobs: dotnet-version: | 3.1.x 5.0.x - 6.0.x + 6.0.x + 7.0.x - name: dotnet restore run: dotnet restore --verbosity minimal --configfile nuget.config diff --git a/.github/workflows/nuget.yaml b/.github/workflows/nuget.yaml index 4d5d2483e..c8ca8b302 100644 --- a/.github/workflows/nuget.yaml +++ b/.github/workflows/nuget.yaml @@ -20,7 +20,8 @@ jobs: dotnet-version: | 3.1.x 5.0.x - 6.0.x + 6.0.x + 7.0.x - name: dotnet restore run: dotnet restore --verbosity minimal --configfile nuget.config diff --git a/examples/Directory.Build.props b/examples/Directory.Build.props index ab4d8e735..609159b2e 100644 --- a/examples/Directory.Build.props +++ b/examples/Directory.Build.props @@ -1,6 +1,6 @@ - net6.0 + net7.0 diff --git a/global.json b/global.json index 7d31d2f6d..e1538bea1 100644 --- a/global.json +++ b/global.json @@ -1,7 +1,7 @@ { "sdk": { - "version": "6.0.400", + "version": "7.0.100", "rollForward": "latestMajor" }, "msbuild-sdks": { diff --git a/src/KubernetesClient.Kubectl/KubernetesClient.Kubectl.csproj b/src/KubernetesClient.Kubectl/KubernetesClient.Kubectl.csproj index 794a3d87c..4265c3545 100644 --- a/src/KubernetesClient.Kubectl/KubernetesClient.Kubectl.csproj +++ b/src/KubernetesClient.Kubectl/KubernetesClient.Kubectl.csproj @@ -1,7 +1,7 @@ - net6.0 + net6.0;net7.0 enable enable k8s.kubectl diff --git a/src/KubernetesClient/KubernetesClient.csproj b/src/KubernetesClient/KubernetesClient.csproj index 87050fd54..7ed224483 100644 --- a/src/KubernetesClient/KubernetesClient.csproj +++ b/src/KubernetesClient/KubernetesClient.csproj @@ -1,7 +1,7 @@ - netstandard2.1;net5.0;net6.0 + netstandard2.1;net5.0;net6.0;net7.0 k8s diff --git a/tests/E2E.Tests/E2E.Tests.csproj b/tests/E2E.Tests/E2E.Tests.csproj index 92938709b..4beea81ad 100644 --- a/tests/E2E.Tests/E2E.Tests.csproj +++ b/tests/E2E.Tests/E2E.Tests.csproj @@ -3,7 +3,7 @@ false true k8s.E2E - netcoreapp3.1;net5.0;net6.0 + netcoreapp3.1;net5.0;net6.0;net7.0 diff --git a/tests/Kubectl.Tests/Kubectl.Tests.csproj b/tests/Kubectl.Tests/Kubectl.Tests.csproj index 779fce922..976bda9c8 100644 --- a/tests/Kubectl.Tests/Kubectl.Tests.csproj +++ b/tests/Kubectl.Tests/Kubectl.Tests.csproj @@ -1,7 +1,7 @@ - net6.0 + net6.0;net7.0 enable enable false diff --git a/tests/KubernetesClient.Tests/KubernetesClient.Tests.csproj b/tests/KubernetesClient.Tests/KubernetesClient.Tests.csproj index 0ebdcf541..91482dea8 100644 --- a/tests/KubernetesClient.Tests/KubernetesClient.Tests.csproj +++ b/tests/KubernetesClient.Tests/KubernetesClient.Tests.csproj @@ -2,7 +2,7 @@ false k8s.Tests - netcoreapp3.1;net5.0;net6.0 + netcoreapp3.1;net5.0;net6.0;net7.0 From c1c3b8c314d5edcb9478b014d37c33fcc9694160 Mon Sep 17 00:00:00 2001 From: Boshi Lian Date: Tue, 8 Nov 2022 16:42:40 -0800 Subject: [PATCH 02/10] remove net5 --- .github/workflows/buildtest.yaml | 1 - .github/workflows/codeql-analysis.yml | 1 - .github/workflows/draft.yaml | 1 - .github/workflows/nuget.yaml | 1 - Directory.Build.targets | 2 +- src/KubernetesClient/KubernetesClient.csproj | 2 +- tests/E2E.Tests/E2E.Tests.csproj | 2 +- tests/KubernetesClient.Tests/KubernetesClient.Tests.csproj | 2 +- version.json | 2 +- 9 files changed, 5 insertions(+), 9 deletions(-) diff --git a/.github/workflows/buildtest.yaml b/.github/workflows/buildtest.yaml index 2eabc678e..c1dbe19c3 100644 --- a/.github/workflows/buildtest.yaml +++ b/.github/workflows/buildtest.yaml @@ -16,7 +16,6 @@ jobs: with: dotnet-version: | 3.1.x - 5.0.x 6.0.x 7.0.x # - name: Check Format diff --git a/.github/workflows/codeql-analysis.yml b/.github/workflows/codeql-analysis.yml index 5ac49afae..31df77068 100644 --- a/.github/workflows/codeql-analysis.yml +++ b/.github/workflows/codeql-analysis.yml @@ -30,7 +30,6 @@ jobs: with: dotnet-version: | 3.1.x - 5.0.x 6.0.x 7.0.x diff --git a/.github/workflows/draft.yaml b/.github/workflows/draft.yaml index 2bd97f4fc..6097e7280 100644 --- a/.github/workflows/draft.yaml +++ b/.github/workflows/draft.yaml @@ -19,7 +19,6 @@ jobs: with: dotnet-version: | 3.1.x - 5.0.x 6.0.x 7.0.x diff --git a/.github/workflows/nuget.yaml b/.github/workflows/nuget.yaml index c8ca8b302..b3ed47ee6 100644 --- a/.github/workflows/nuget.yaml +++ b/.github/workflows/nuget.yaml @@ -19,7 +19,6 @@ jobs: with: dotnet-version: | 3.1.x - 5.0.x 6.0.x 7.0.x diff --git a/Directory.Build.targets b/Directory.Build.targets index f88121bab..6894b82f8 100644 --- a/Directory.Build.targets +++ b/Directory.Build.targets @@ -1,7 +1,7 @@ - + diff --git a/src/KubernetesClient/KubernetesClient.csproj b/src/KubernetesClient/KubernetesClient.csproj index 7ed224483..687076e92 100644 --- a/src/KubernetesClient/KubernetesClient.csproj +++ b/src/KubernetesClient/KubernetesClient.csproj @@ -1,7 +1,7 @@ - netstandard2.1;net5.0;net6.0;net7.0 + netstandard2.1;net6.0;net7.0 k8s diff --git a/tests/E2E.Tests/E2E.Tests.csproj b/tests/E2E.Tests/E2E.Tests.csproj index 4beea81ad..3e190c634 100644 --- a/tests/E2E.Tests/E2E.Tests.csproj +++ b/tests/E2E.Tests/E2E.Tests.csproj @@ -3,7 +3,7 @@ false true k8s.E2E - netcoreapp3.1;net5.0;net6.0;net7.0 + netcoreapp3.1;net6.0;net7.0 diff --git a/tests/KubernetesClient.Tests/KubernetesClient.Tests.csproj b/tests/KubernetesClient.Tests/KubernetesClient.Tests.csproj index 91482dea8..7f9b50537 100644 --- a/tests/KubernetesClient.Tests/KubernetesClient.Tests.csproj +++ b/tests/KubernetesClient.Tests/KubernetesClient.Tests.csproj @@ -2,7 +2,7 @@ false k8s.Tests - netcoreapp3.1;net5.0;net6.0;net7.0 + netcoreapp3.1;net6.0;net7.0 diff --git a/version.json b/version.json index 320197d69..f0c243600 100644 --- a/version.json +++ b/version.json @@ -1,6 +1,6 @@ { "$schema": "https://raw.githubusercontent.com/AArnott/Nerdbank.GitVersioning/master/src/NerdBank.GitVersioning/version.schema.json", - "version": "9.0", + "version": "9.1", "publicReleaseRefSpec": [ "^refs/heads/master$", "^refs/tags/v\\d+\\.\\d+\\.\\d+" From 6c2b4bea853be2c0419d59a48ae13dbdf531b143 Mon Sep 17 00:00:00 2001 From: Boshi Lian Date: Tue, 8 Nov 2022 18:45:39 -0800 Subject: [PATCH 03/10] fix build --- Directory.Build.props | 2 +- Directory.Build.targets | 2 +- src/KubernetesClient.Kubectl/KubernetesClient.Kubectl.csproj | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Directory.Build.props b/Directory.Build.props index 6af780d70..db3a195a0 100644 --- a/Directory.Build.props +++ b/Directory.Build.props @@ -26,7 +26,7 @@ snupkg true $(AllowedOutputExtensionsInPackageBuildOutputFolder);.pdb - 10.0 + 11.0 diff --git a/Directory.Build.targets b/Directory.Build.targets index 6894b82f8..d8ab7bef5 100644 --- a/Directory.Build.targets +++ b/Directory.Build.targets @@ -1,7 +1,7 @@ - + diff --git a/src/KubernetesClient.Kubectl/KubernetesClient.Kubectl.csproj b/src/KubernetesClient.Kubectl/KubernetesClient.Kubectl.csproj index 4265c3545..21e1d2bd4 100644 --- a/src/KubernetesClient.Kubectl/KubernetesClient.Kubectl.csproj +++ b/src/KubernetesClient.Kubectl/KubernetesClient.Kubectl.csproj @@ -1,7 +1,7 @@ - net6.0;net7.0 + net6.0;net7.0 enable enable k8s.kubectl From 141928472b8f65bee3c84f12b5329d16cbd9e560 Mon Sep 17 00:00:00 2001 From: Boshi Lian Date: Tue, 8 Nov 2022 19:30:18 -0800 Subject: [PATCH 04/10] fix versions --- .github/workflows/buildtest.yaml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/buildtest.yaml b/.github/workflows/buildtest.yaml index c1dbe19c3..b3780fbaf 100644 --- a/.github/workflows/buildtest.yaml +++ b/.github/workflows/buildtest.yaml @@ -37,10 +37,10 @@ jobs: fetch-depth: 0 - name: Add msbuild to PATH uses: microsoft/setup-msbuild@v1.1 - - name: Setup dotnet SDK 6 + - name: Setup dotnet SDK 7 uses: actions/setup-dotnet@v3 with: - dotnet-version: '6.0.x' + dotnet-version: '7.0.x' - name: Restore nugets (msbuild) run: msbuild .\src\KubernetesClient.Models\ -t:restore -p:RestorePackagesConfig=true - name: Build (msbuild) @@ -57,8 +57,8 @@ jobs: with: dotnet-version: | 3.1.x - 5.0.x - 6.0.x + 6.0.x + 7.0.x - name: Minikube run: minikube start - name: Test From 1bc590bd008fb93503db9b7f81f96e11d77966e1 Mon Sep 17 00:00:00 2001 From: Boshi Lian Date: Tue, 8 Nov 2022 19:56:08 -0800 Subject: [PATCH 05/10] revert to 10.0 due to ci --- Directory.Build.props | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Directory.Build.props b/Directory.Build.props index db3a195a0..6af780d70 100644 --- a/Directory.Build.props +++ b/Directory.Build.props @@ -26,7 +26,7 @@ snupkg true $(AllowedOutputExtensionsInPackageBuildOutputFolder);.pdb - 11.0 + 10.0 From 19ad524d71866eaa9e52dbaef815efd480595a72 Mon Sep 17 00:00:00 2001 From: Boshi Lian Date: Tue, 29 Nov 2022 05:17:53 -0800 Subject: [PATCH 06/10] fix automapper --- .../KubernetesClient.Models.csproj | 5 ++-- .../Versioning/VersionConverter.cs | 23 ++++++++++++++++--- 2 files changed, 23 insertions(+), 5 deletions(-) diff --git a/src/KubernetesClient.Models/KubernetesClient.Models.csproj b/src/KubernetesClient.Models/KubernetesClient.Models.csproj index a386d903b..159bfae94 100644 --- a/src/KubernetesClient.Models/KubernetesClient.Models.csproj +++ b/src/KubernetesClient.Models/KubernetesClient.Models.csproj @@ -1,6 +1,6 @@ - netstandard2.0 + netstandard2.0;net7.0 k8s.Models @@ -12,7 +12,8 @@ - + + diff --git a/src/KubernetesClient.Models/Versioning/VersionConverter.cs b/src/KubernetesClient.Models/Versioning/VersionConverter.cs index 8c2c5cec1..b0c625051 100644 --- a/src/KubernetesClient.Models/Versioning/VersionConverter.cs +++ b/src/KubernetesClient.Models/Versioning/VersionConverter.cs @@ -1,6 +1,7 @@ // WARNING: DO NOT LEAVE COMMENTED CODE IN THIS FILE. IT GETS SCANNED BY GEN PROJECT SO IT CAN EXCLUDE ANY MANUALLY DEFINED MAPS using AutoMapper; +using AutoMapper.Internal; using k8s.Models; using System.Reflection; @@ -41,8 +42,15 @@ public static void UpdateMappingConfiguration(Action new[] { x.Types.SourceType, x.Types.DestinationType }) .Where(x => x.GetCustomAttribute() != null) @@ -78,7 +86,12 @@ public static object ConvertToVersion(object source, string apiVersion) throw new InvalidOperationException($"Version converter does not have any registered types for Kind `{attr.Kind}`"); } - if (!kindVersions.TryGetValue(apiVersion, out var targetType) || !kindVersions.TryGetValue(attr.ApiVersion, out var sourceType) || MapperConfiguration.FindTypeMapFor(sourceType, targetType) == null) + if (!kindVersions.TryGetValue(apiVersion, out var targetType) || !kindVersions.TryGetValue(attr.ApiVersion, out var sourceType) || + MapperConfiguration +#if NET7_0_OR_GREATER + .Internal() +#endif + .FindTypeMapFor(sourceType, targetType) == null) { throw new InvalidOperationException($"There is no conversion mapping registered for Kind `{attr.Kind}` from ApiVersion {attr.ApiVersion} to {apiVersion}"); } @@ -112,7 +125,11 @@ private static void ManualConfigurations(IMapperConfigurationExpression cfg) { cfg.AllowNullCollections = true; cfg.DisableConstructorMapping(); - cfg.ForAllMaps((typeMap, opt) => + cfg +#if NET7_0_OR_GREATER + .Internal() +#endif + .ForAllMaps((typeMap, opt) => { if (!typeof(IKubernetesObject).IsAssignableFrom(typeMap.Types.DestinationType)) { From a943e5007dc545ebf8ba0dde5c1d4c4e9538ce1c Mon Sep 17 00:00:00 2001 From: Boshi Lian Date: Tue, 29 Nov 2022 05:20:38 -0800 Subject: [PATCH 07/10] update ver matrix --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index 3a060c888..bbfa3aab7 100644 --- a/README.md +++ b/README.md @@ -149,6 +149,7 @@ ${GEN_DIR}/openapi/csharp.sh ${REPO_DIR}/src/KubernetesClient ${REPO_DIR}/csharp | SDK Version | Kubernetes Version | .NET Targeting | |-------------|--------------------|------------------------------------------------------| +| 9.1 | 1.25 | netstandard2.1;net6.0;net7.0;net48*;netstandard2.0* | | 9.0 | 1.25 | netstandard2.1;net5.0;net6.0;net48*;netstandard2.0* | | 8.0 | 1.24 | netstandard2.1;net5.0;net6.0;net48*;netstandard2.0* | | 7.2 | 1.23 | netstandard2.1;net5.0;net6.0;net48*;netstandard2.0* | From 87f5893a2a7292c7c55e74788d9bfab2b7bbbf5f Mon Sep 17 00:00:00 2001 From: Boshi Lian Date: Tue, 29 Nov 2022 05:24:36 -0800 Subject: [PATCH 08/10] fix warning --- src/KubernetesClient.Models/Versioning/VersionConverter.cs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/KubernetesClient.Models/Versioning/VersionConverter.cs b/src/KubernetesClient.Models/Versioning/VersionConverter.cs index b0c625051..73a2c968b 100644 --- a/src/KubernetesClient.Models/Versioning/VersionConverter.cs +++ b/src/KubernetesClient.Models/Versioning/VersionConverter.cs @@ -1,7 +1,9 @@ // WARNING: DO NOT LEAVE COMMENTED CODE IN THIS FILE. IT GETS SCANNED BY GEN PROJECT SO IT CAN EXCLUDE ANY MANUALLY DEFINED MAPS using AutoMapper; +#if NET7_0_OR_GREATER using AutoMapper.Internal; +#endif using k8s.Models; using System.Reflection; From 2423e18cb4c40e568bc90fe13239ace2477fba27 Mon Sep 17 00:00:00 2001 From: Boshi Lian Date: Thu, 1 Dec 2022 12:39:35 +0000 Subject: [PATCH 09/10] fix net7 test err --- src/KubernetesClient/Kubernetes.ConfigInit.cs | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/KubernetesClient/Kubernetes.ConfigInit.cs b/src/KubernetesClient/Kubernetes.ConfigInit.cs index e98678b4d..be9d06285 100644 --- a/src/KubernetesClient/Kubernetes.ConfigInit.cs +++ b/src/KubernetesClient/Kubernetes.ConfigInit.cs @@ -92,6 +92,13 @@ private void InitializeFromConfig(KubernetesClientConfiguration config) { #if NET5_0_OR_GREATER HttpClientHandler.SslOptions.ClientCertificates.Add(clientCert); + + // TODO this is workaround for net7.0, remove it when the issue is fixed + // seems the client certificate is cached and cannot be updated + HttpClientHandler.SslOptions.LocalCertificateSelectionCallback = (sender, targetHost, localCertificates, remoteCertificate, acceptableIssuers) => + { + return clientCert; + }; #else HttpClientHandler.ClientCertificates.Add(clientCert); #endif From 3c64720958cdbc1537928b282df81772ea1eb95a Mon Sep 17 00:00:00 2001 From: Boshi Lian Date: Thu, 1 Dec 2022 04:49:38 -0800 Subject: [PATCH 10/10] more target to basic and model pkg --- .../KubernetesClient.Basic.csproj | 2 +- .../KubernetesClient.Models.csproj | 4 ++-- .../Versioning/VersionConverter.cs | 10 +++++----- .../KubernetesClient.Classic.Tests.csproj | 3 +-- 4 files changed, 9 insertions(+), 10 deletions(-) diff --git a/src/KubernetesClient.Basic/KubernetesClient.Basic.csproj b/src/KubernetesClient.Basic/KubernetesClient.Basic.csproj index 353630c34..e0f9230d8 100644 --- a/src/KubernetesClient.Basic/KubernetesClient.Basic.csproj +++ b/src/KubernetesClient.Basic/KubernetesClient.Basic.csproj @@ -1,7 +1,7 @@ - netstandard2.0 + netstandard2.0;net6.0;net7.0 k8s diff --git a/src/KubernetesClient.Models/KubernetesClient.Models.csproj b/src/KubernetesClient.Models/KubernetesClient.Models.csproj index 231442441..342c017fb 100644 --- a/src/KubernetesClient.Models/KubernetesClient.Models.csproj +++ b/src/KubernetesClient.Models/KubernetesClient.Models.csproj @@ -1,6 +1,6 @@ - netstandard2.0;net7.0 + netstandard2.0;net6.0;net7.0 k8s.Models @@ -12,7 +12,7 @@ - + diff --git a/src/KubernetesClient.Models/Versioning/VersionConverter.cs b/src/KubernetesClient.Models/Versioning/VersionConverter.cs index 73a2c968b..fd064f3a5 100644 --- a/src/KubernetesClient.Models/Versioning/VersionConverter.cs +++ b/src/KubernetesClient.Models/Versioning/VersionConverter.cs @@ -1,7 +1,7 @@ // WARNING: DO NOT LEAVE COMMENTED CODE IN THIS FILE. IT GETS SCANNED BY GEN PROJECT SO IT CAN EXCLUDE ANY MANUALLY DEFINED MAPS using AutoMapper; -#if NET7_0_OR_GREATER +#if NET6_0_OR_GREATER using AutoMapper.Internal; #endif using k8s.Models; @@ -45,12 +45,12 @@ public static void UpdateMappingConfiguration(Action diff --git a/tests/KubernetesClient.Classic.Tests/KubernetesClient.Classic.Tests.csproj b/tests/KubernetesClient.Classic.Tests/KubernetesClient.Classic.Tests.csproj index a9d3a201d..00f53ba24 100644 --- a/tests/KubernetesClient.Classic.Tests/KubernetesClient.Classic.Tests.csproj +++ b/tests/KubernetesClient.Classic.Tests/KubernetesClient.Classic.Tests.csproj @@ -1,4 +1,4 @@ - + false k8s.Tests @@ -14,7 +14,6 @@ -