Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
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
12 changes: 6 additions & 6 deletions .github/workflows/buildtest.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@ jobs:
with:
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'
Expand All @@ -37,10 +37,10 @@ jobs:
fetch-depth: 0
- name: Add msbuild to PATH
uses: microsoft/[email protected]
- 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)
Expand All @@ -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
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/codeql-analysis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,8 @@ jobs:
with:
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
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/draft.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@ jobs:
with:
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
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/nuget.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@ jobs:
with:
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
Expand Down
2 changes: 1 addition & 1 deletion Directory.Build.targets
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup>
<PackageReference Include="StyleCop.Analyzers" Version="1.1.118" PrivateAssets="all" />
<PackageReference Include="Microsoft.CodeAnalysis.NetAnalyzers" Version="6.0.0" PrivateAssets="all" />
<PackageReference Include="Microsoft.CodeAnalysis.NetAnalyzers" Version="7.0.0-preview1.22518.1" PrivateAssets="all" />
<PackageReference Include="Nerdbank.GitVersioning" Version="3.5.119" PrivateAssets="all" />
<PackageReference Include="Microsoft.SourceLink.GitHub" Version="1.1.1" PrivateAssets="All" />
</ItemGroup>
Expand Down
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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* |
Expand Down
2 changes: 1 addition & 1 deletion examples/Directory.Build.props
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
<TargetFramework>net7.0</TargetFramework>
</PropertyGroup>
</Project>
2 changes: 1 addition & 1 deletion global.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@

{
"sdk": {
"version": "6.0.400",
"version": "7.0.100",
"rollForward": "latestMajor"
},
"msbuild-sdks": {
Expand Down
2 changes: 1 addition & 1 deletion src/KubernetesClient.Basic/KubernetesClient.Basic.csproj
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>netstandard2.0</TargetFramework>
<TargetFrameworks>netstandard2.0;net6.0;net7.0</TargetFrameworks>
<RootNamespace>k8s</RootNamespace>
</PropertyGroup>

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
<TargetFrameworks>net6.0;net7.0</TargetFrameworks>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<RootNamespace>k8s.kubectl</RootNamespace>
Expand Down
5 changes: 3 additions & 2 deletions src/KubernetesClient.Models/KubernetesClient.Models.csproj
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>netstandard2.0</TargetFramework>
<TargetFrameworks>netstandard2.0;net6.0;net7.0</TargetFrameworks>
<RootNamespace>k8s.Models</RootNamespace>
</PropertyGroup>

Expand All @@ -12,7 +12,8 @@

<ItemGroup>
<PackageReference Include="System.Text.Json" Version="6.0.6" />
<PackageReference Include="AutoMapper" Version="10.1.1" />
<PackageReference Include="AutoMapper" Version="12.0.0" Condition="'$(TargetFramework)' != 'netstandard2.0'" />
<PackageReference Include="AutoMapper" Version="10.1.1" Condition="'$(TargetFramework)' == 'netstandard2.0'" />
<PackageReference Include="Fractions" Version="7.2.0" />
<PackageReference Include="YamlDotNet" Version="12.0.2" />
</ItemGroup>
Expand Down
25 changes: 22 additions & 3 deletions src/KubernetesClient.Models/Versioning/VersionConverter.cs
Original file line number Diff line number Diff line change
@@ -1,6 +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 NET6_0_OR_GREATER
using AutoMapper.Internal;
#endif
using k8s.Models;
using System.Reflection;

Expand Down Expand Up @@ -41,8 +44,15 @@ public static void UpdateMappingConfiguration(Action<IMapperConfigurationExpress
GetConfigurations(cfg);
configuration(cfg);
});
Mapper = MapperConfiguration.CreateMapper();
Mapper = MapperConfiguration
#if NET6_0_OR_GREATER
.Internal()
#endif
.CreateMapper();
KindVersionsMap = MapperConfiguration
#if NET6_0_OR_GREATER
.Internal()
#endif
.GetAllTypeMaps()
.SelectMany(x => new[] { x.Types.SourceType, x.Types.DestinationType })
.Where(x => x.GetCustomAttribute<KubernetesEntityAttribute>() != null)
Expand Down Expand Up @@ -78,7 +88,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 NET6_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}");
}
Expand Down Expand Up @@ -112,7 +127,11 @@ private static void ManualConfigurations(IMapperConfigurationExpression cfg)
{
cfg.AllowNullCollections = true;
cfg.DisableConstructorMapping();
cfg.ForAllMaps((typeMap, opt) =>
cfg
#if NET6_0_OR_GREATER
.Internal()
#endif
.ForAllMaps((typeMap, opt) =>
{
if (!typeof(IKubernetesObject).IsAssignableFrom(typeMap.Types.DestinationType))
{
Expand Down
7 changes: 7 additions & 0 deletions src/KubernetesClient/Kubernetes.ConfigInit.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion src/KubernetesClient/KubernetesClient.csproj
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFrameworks>netstandard2.1;net5.0;net6.0</TargetFrameworks>
<TargetFrameworks>netstandard2.1;net6.0;net7.0</TargetFrameworks>
<RootNamespace>k8s</RootNamespace>
</PropertyGroup>

Expand Down
2 changes: 1 addition & 1 deletion tests/E2E.Tests/E2E.Tests.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<IsPackable>false</IsPackable>
<SignAssembly>true</SignAssembly>
<RootNamespace>k8s.E2E</RootNamespace>
<TargetFrameworks>netcoreapp3.1;net5.0;net6.0</TargetFrameworks>
<TargetFrameworks>netcoreapp3.1;net6.0;net7.0</TargetFrameworks>
</PropertyGroup>

<ItemGroup>
Expand Down
2 changes: 1 addition & 1 deletion tests/Kubectl.Tests/Kubectl.Tests.csproj
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
<TargetFrameworks>net6.0;net7.0</TargetFrameworks>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<IsPackable>false</IsPackable>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<Project Sdk="Microsoft.NET.Sdk">
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<IsPackable>false</IsPackable>
<RootNamespace>k8s.Tests</RootNamespace>
Expand All @@ -14,7 +14,6 @@
<PackageReference Include="System.Reactive" Version="5.0.0" />
<PackageReference Include="Nito.AsyncEx" Version="5.1.2" />
<PackageReference Include="Portable.BouncyCastle" Version="1.9.0" />
<PackageReference Include="AutoMapper" Version="10.1.1" />
</ItemGroup>

<ItemGroup>
Expand Down
2 changes: 1 addition & 1 deletion tests/KubernetesClient.Tests/KubernetesClient.Tests.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<PropertyGroup>
<IsPackable>false</IsPackable>
<RootNamespace>k8s.Tests</RootNamespace>
<TargetFrameworks>netcoreapp3.1;net5.0;net6.0</TargetFrameworks>
<TargetFrameworks>netcoreapp3.1;net6.0;net7.0</TargetFrameworks>
</PropertyGroup>

<ItemGroup>
Expand Down
2 changes: 1 addition & 1 deletion version.json
Original file line number Diff line number Diff line change
@@ -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+"
Expand Down