Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

generate v1.26 #1122

Merged
merged 12 commits into from
Dec 16, 2022
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
2 changes: 0 additions & 2 deletions .github/workflows/buildtest.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ jobs:
uses: actions/setup-dotnet@v3
with:
dotnet-version: |
3.1.x
6.0.x
7.0.x
# - name: Check Format
Expand Down Expand Up @@ -56,7 +55,6 @@ jobs:
uses: actions/setup-dotnet@v3
with:
dotnet-version: |
3.1.x
6.0.x
7.0.x
- name: Minikube
Expand Down
1 change: 0 additions & 1 deletion .github/workflows/docfx.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@ jobs:
uses: actions/setup-dotnet@v3
with:
dotnet-version: |
3.1.x
5.0.x
6.0.x

Expand Down
1 change: 0 additions & 1 deletion .github/workflows/draft.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ jobs:
uses: actions/setup-dotnet@v3
with:
dotnet-version: |
3.1.x
6.0.x
7.0.x

Expand Down
1 change: 0 additions & 1 deletion .github/workflows/nuget.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ jobs:
uses: actions/setup-dotnet@v3
with:
dotnet-version: |
3.1.x
6.0.x
7.0.x

Expand Down
2 changes: 1 addition & 1 deletion Directory.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
<SymbolPackageFormat>snupkg</SymbolPackageFormat>
<EmbedUntrackedSources>true</EmbedUntrackedSources>
<AllowedOutputExtensionsInPackageBuildOutputFolder>$(AllowedOutputExtensionsInPackageBuildOutputFolder);.pdb</AllowedOutputExtensionsInPackageBuildOutputFolder>
<LangVersion>10.0</LangVersion>
<LangVersion>11.0</LangVersion>
</PropertyGroup>

<PropertyGroup Condition="'$(GITHUB_ACTIONS)' == 'true'">
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 |
|-------------|--------------------|------------------------------------------------------|
| 10.0 | 1.26 | net6.0;net7.0;net48*;netstandard2.0* |
| 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* |
Expand Down
2 changes: 1 addition & 1 deletion csharp.settings
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
export KUBERNETES_BRANCH=v1.25.0
export KUBERNETES_BRANCH=v1.26.0
export CLIENT_VERSION=0.0.1
export PACKAGE_NAME=k8s
1 change: 0 additions & 1 deletion examples/prometheus/Prometheus.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
using k8s;
using k8s.Monitoring;
using Prometheus;
using System;
using System.Net.Http;
Expand Down
8 changes: 6 additions & 2 deletions src/KubernetesClient.Basic/AbstractKubernetes.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,13 @@ private static class HttpMethods
public static readonly HttpMethod Post = HttpMethod.Post;
public static readonly HttpMethod Put = HttpMethod.Put;
public static readonly HttpMethod Trace = HttpMethod.Trace;

#if NETSTANDARD2_0
public static readonly HttpMethod Patch = new HttpMethod("PATCH");
#else
public static readonly HttpMethod Patch = HttpMethod.Patch;
#endif

}

private sealed class QueryBuilder
Expand Down Expand Up @@ -96,6 +102,4 @@ private MediaTypeHeaderValue GetHeader(V1Patch body)
protected abstract Task<HttpOperationResponse<T>> CreateResultAsync<T>(HttpRequestMessage httpRequest, HttpResponseMessage httpResponse, bool? watch, CancellationToken cancellationToken);

protected abstract Task<HttpResponseMessage> SendRequest<T>(string relativeUri, HttpMethod method, IReadOnlyDictionary<string, IReadOnlyList<string>> customHeaders, T body, CancellationToken cancellationToken);

protected abstract Task<HttpResponseMessage> SendRequestRaw(string requestContent, HttpRequestMessage httpRequest, CancellationToken cancellationToken);
}
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ namespace k8s.Autorest
/// Exception thrown for an invalid response with custom error information.
/// </summary>
[Serializable]
public class HttpOperationException : RestException
public class HttpOperationException : Exception
{
/// <summary>
/// Gets information about the associated HTTP request.
Expand Down
23 changes: 5 additions & 18 deletions src/KubernetesClient.Basic/Autorest/HttpRequestMessageWrapper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -24,20 +24,12 @@ public HttpRequestMessageWrapper(HttpRequestMessage httpRequest, string content)
throw new ArgumentNullException("httpRequest");
}

this.CopyHeaders(httpRequest.Headers);
this.CopyHeaders(httpRequest.GetContentHeaders());
CopyHeaders(httpRequest.Headers);
CopyHeaders(httpRequest.GetContentHeaders());

this.Content = content;
this.Method = httpRequest.Method;
this.RequestUri = httpRequest.RequestUri;
if (httpRequest.Properties != null)
{
Properties = new Dictionary<string, object>();
foreach (KeyValuePair<string, object> pair in httpRequest.Properties)
{
this.Properties[pair.Key] = pair.Value;
}
}
Content = content;
Method = httpRequest.Method;
RequestUri = httpRequest.RequestUri;
}

/// <summary>
Expand All @@ -49,10 +41,5 @@ public HttpRequestMessageWrapper(HttpRequestMessage httpRequest, string content)
/// Gets or sets the Uri used for the HTTP request.
/// </summary>
public Uri RequestUri { get; protected set; }

/// <summary>
/// Gets a set of properties for the HTTP request.
/// </summary>
public IDictionary<string, object> Properties { get; private set; }
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -25,12 +25,12 @@ public HttpResponseMessageWrapper(HttpResponseMessage httpResponse, string conte
throw new ArgumentNullException("httpResponse");
}

this.CopyHeaders(httpResponse.Headers);
this.CopyHeaders(httpResponse.GetContentHeaders());
CopyHeaders(httpResponse.Headers);
CopyHeaders(httpResponse.GetContentHeaders());

this.Content = content;
this.StatusCode = httpResponse.StatusCode;
this.ReasonPhrase = httpResponse.ReasonPhrase;
Content = content;
StatusCode = httpResponse.StatusCode;
ReasonPhrase = httpResponse.ReasonPhrase;
}

/// <summary>
Expand Down
50 changes: 0 additions & 50 deletions src/KubernetesClient.Basic/Autorest/RestException.cs

This file was deleted.

3 changes: 3 additions & 0 deletions src/KubernetesClient.Classic/AssemblyInfo.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
using System.Runtime.CompilerServices;

[assembly: InternalsVisibleTo("KubernetesClient.Tests")]
5 changes: 5 additions & 0 deletions src/KubernetesClient.Classic/KubernetesClient.Classic.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,11 @@
<Compile Include="..\KubernetesClient\Authentication\GcpTokenProvider.cs" />
<Compile Include="..\KubernetesClient\Authentication\OidcTokenProvider.cs" />
<Compile Include="..\KubernetesClient\Authentication\TokenFileAuth.cs" />
<Compile Include="..\KubernetesClient\Authentication\BasicAuthenticationCredentials.cs" />
<Compile Include="..\KubernetesClient\Authentication\ITokenProvider.cs" />
<Compile Include="..\KubernetesClient\Authentication\ServiceClientCredentials.cs" />
<Compile Include="..\KubernetesClient\Authentication\StringTokenProvider.cs" />
<Compile Include="..\KubernetesClient\Authentication\TokenCredentials.cs" />
</ItemGroup>

<ItemGroup>
Expand Down
24 changes: 12 additions & 12 deletions src/KubernetesClient.Models/Versioning/VersionConverter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -148,37 +148,37 @@ private static void ManualConfigurations(IMapperConfigurationExpression cfg)
obj.Kind = metadata.Kind;
});
});
cfg.CreateMap<V1Subject, V1beta1Subject>()

cfg.CreateMap<V1Subject, V1beta2Subject>()
.ForMember(dest => dest.Group, opt => opt.Ignore())
.ForMember(dest => dest.ServiceAccount, opt => opt.Ignore())
.ForMember(dest => dest.User, opt => opt.Ignore())
.ReverseMap();
cfg.CreateMap<V1Subject, V1beta2Subject>()

cfg.CreateMap<V1Subject, V1beta3Subject>()
.ForMember(dest => dest.Group, opt => opt.Ignore())
.ForMember(dest => dest.ServiceAccount, opt => opt.Ignore())
.ForMember(dest => dest.User, opt => opt.Ignore())
.ReverseMap();


cfg.CreateMap<V1HorizontalPodAutoscalerSpec, V2beta2HorizontalPodAutoscalerSpec>()
.ForMember(dest => dest.Metrics, opt => opt.Ignore())
.ForMember(dest => dest.Behavior, opt => opt.Ignore())
.ReverseMap();

cfg.CreateMap<V1HorizontalPodAutoscalerSpec, V2HorizontalPodAutoscalerSpec>()
.ForMember(dest => dest.Metrics, opt => opt.Ignore())
.ForMember(dest => dest.Behavior, opt => opt.Ignore())
.ReverseMap();


cfg.CreateMap<V1HorizontalPodAutoscalerStatus, V2beta2HorizontalPodAutoscalerStatus>()
.ForMember(dest => dest.Conditions, opt => opt.Ignore())
.ForMember(dest => dest.CurrentMetrics, opt => opt.Ignore())
.ReverseMap();
cfg.CreateMap<V1HorizontalPodAutoscalerStatus, V2HorizontalPodAutoscalerStatus>()
.ForMember(dest => dest.Conditions, opt => opt.Ignore())
.ForMember(dest => dest.CurrentMetrics, opt => opt.Ignore())
.ReverseMap();

cfg.CreateMap<V1alpha1ResourceClaim, V1ResourceClaim>()
.ForMember(dest => dest.Name, opt => opt.Ignore())
.ReverseMap();

cfg.CreateMap<V1beta2LimitedPriorityLevelConfiguration, V1beta3LimitedPriorityLevelConfiguration>()
.ForMember(dest => dest.NominalConcurrencyShares, opt => opt.Ignore())
.ReverseMap();
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,10 @@
using System.Net.Http;
using System.Net.Http.Headers;
using System.Text;
using System.Threading;
using System.Threading.Tasks;

namespace k8s.Autorest
namespace k8s.Authentication
{
/// <summary>
/// Basic Auth credentials for use with a REST Service Client.
Expand Down
1 change: 0 additions & 1 deletion src/KubernetesClient/Authentication/ExecTokenProvider.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
using k8s.Autorest;
using k8s.KubeConfigModels;
using System.Net.Http.Headers;
using System.Threading;
Expand Down
1 change: 0 additions & 1 deletion src/KubernetesClient/Authentication/GcpTokenProvider.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
using k8s.Autorest;
using k8s.Exceptions;
using System.Diagnostics;
using System.Net.Http.Headers;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,12 @@
// Licensed under the MIT License. See License.txt in the project root for license information.

using System.Net.Http.Headers;
using System.Threading;
using System.Threading.Tasks;

#pragma warning disable SA1606
#pragma warning disable SA1614
namespace k8s.Autorest
namespace k8s.Authentication
{
/// <summary>
/// Interface to a source of access tokens.
Expand Down
1 change: 0 additions & 1 deletion src/KubernetesClient/Authentication/OidcTokenProvider.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
using IdentityModel.OidcClient;
using k8s.Autorest;
using k8s.Exceptions;
using System.IdentityModel.Tokens.Jwt;
using System.Net.Http.Headers;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,10 @@
// Licensed under the MIT License. See License.txt in the project root for license information.

using System.Net.Http;
using System.Threading;
using System.Threading.Tasks;

namespace k8s.Autorest
namespace k8s.Authentication
{
/// <summary>
/// ServiceClientCredentials is the abstraction for credentials used by ServiceClients accessing REST services.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,10 @@
// Licensed under the MIT License. See License.txt in the project root for license information.

using System.Net.Http.Headers;
using System.Threading;
using System.Threading.Tasks;

namespace k8s.Autorest
namespace k8s.Authentication
{
/// <summary>
/// A simple token provider that always provides a static access token.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,10 @@
// Licensed under the MIT License. See License.txt in the project root for license information.

using System.Net.Http;
using System.Threading;
using System.Threading.Tasks;

namespace k8s.Autorest
namespace k8s.Authentication
{
/// <summary>
/// Token based credentials for use with a REST Service Client.
Expand Down Expand Up @@ -73,7 +75,7 @@ public TokenCredentials(ITokenProvider tokenProvider)
throw new ArgumentNullException("tokenProvider");
}

this.TokenProvider = tokenProvider;
TokenProvider = tokenProvider;
}

/// <summary>
Expand All @@ -86,8 +88,8 @@ public TokenCredentials(ITokenProvider tokenProvider)
public TokenCredentials(ITokenProvider tokenProvider, string tenantId, string callerId)
: this(tokenProvider)
{
this.TenantId = tenantId;
this.CallerId = callerId;
TenantId = tenantId;
CallerId = callerId;
}

/// <summary>
Expand Down
1 change: 0 additions & 1 deletion src/KubernetesClient/Authentication/TokenFileAuth.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
using k8s.Autorest;
using System.IO;
using System.Net.Http.Headers;
using System.Threading;
Expand Down
2 changes: 1 addition & 1 deletion src/KubernetesClient/FileUtils.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

namespace k8s
{
public static class FileUtils
internal static class FileUtils
{
private static readonly IFileSystem RealFileSystem = new FileSystem();
private static IFileSystem currentFileSystem = null;
Expand Down
2 changes: 1 addition & 1 deletion src/KubernetesClient/Kubernetes.ConfigInit.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
using k8s.Autorest;
using k8s.Authentication;
using k8s.Exceptions;
using System.Net.Http;
using System.Net.Security;
Expand Down
Loading