Skip to content

Commit 4e74fd2

Browse files
authored
generate v1.26 (#1122)
* update swagger * remove unused models in converter * remove netcore3.1 from testr * bump ver * fix convert * remove some unused autorest property * move some clz from autorest to client * fix import * no longer expose SendRequestRaw * make file utils inner * fix build * c# 11
1 parent 93a1f16 commit 4e74fd2

36 files changed

+18241
-13228
lines changed

.github/workflows/buildtest.yaml

-2
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@ jobs:
1515
uses: actions/setup-dotnet@v3
1616
with:
1717
dotnet-version: |
18-
3.1.x
1918
6.0.x
2019
7.0.x
2120
# - name: Check Format
@@ -56,7 +55,6 @@ jobs:
5655
uses: actions/setup-dotnet@v3
5756
with:
5857
dotnet-version: |
59-
3.1.x
6058
6.0.x
6159
7.0.x
6260
- name: Minikube

.github/workflows/docfx.yaml

-1
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,6 @@ jobs:
3333
uses: actions/setup-dotnet@v3
3434
with:
3535
dotnet-version: |
36-
3.1.x
3736
5.0.x
3837
6.0.x
3938

.github/workflows/draft.yaml

-1
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@ jobs:
1818
uses: actions/setup-dotnet@v3
1919
with:
2020
dotnet-version: |
21-
3.1.x
2221
6.0.x
2322
7.0.x
2423

.github/workflows/nuget.yaml

-1
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@ jobs:
1818
uses: actions/setup-dotnet@v3
1919
with:
2020
dotnet-version: |
21-
3.1.x
2221
6.0.x
2322
7.0.x
2423

Directory.Build.props

+1-1
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
<SymbolPackageFormat>snupkg</SymbolPackageFormat>
2727
<EmbedUntrackedSources>true</EmbedUntrackedSources>
2828
<AllowedOutputExtensionsInPackageBuildOutputFolder>$(AllowedOutputExtensionsInPackageBuildOutputFolder);.pdb</AllowedOutputExtensionsInPackageBuildOutputFolder>
29-
<LangVersion>10.0</LangVersion>
29+
<LangVersion>11.0</LangVersion>
3030
</PropertyGroup>
3131

3232
<PropertyGroup Condition="'$(GITHUB_ACTIONS)' == 'true'">

README.md

+1
Original file line numberDiff line numberDiff line change
@@ -149,6 +149,7 @@ ${GEN_DIR}/openapi/csharp.sh ${REPO_DIR}/src/KubernetesClient ${REPO_DIR}/csharp
149149

150150
| SDK Version | Kubernetes Version | .NET Targeting |
151151
|-------------|--------------------|------------------------------------------------------|
152+
| 10.0 | 1.26 | net6.0;net7.0;net48*;netstandard2.0* |
152153
| 9.1 | 1.25 | netstandard2.1;net6.0;net7.0;net48*;netstandard2.0* |
153154
| 9.0 | 1.25 | netstandard2.1;net5.0;net6.0;net48*;netstandard2.0* |
154155
| 8.0 | 1.24 | netstandard2.1;net5.0;net6.0;net48*;netstandard2.0* |

csharp.settings

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
1-
export KUBERNETES_BRANCH=v1.25.0
1+
export KUBERNETES_BRANCH=v1.26.0
22
export CLIENT_VERSION=0.0.1
33
export PACKAGE_NAME=k8s

examples/prometheus/Prometheus.cs

-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
using k8s;
2-
using k8s.Monitoring;
32
using Prometheus;
43
using System;
54
using System.Net.Http;

src/KubernetesClient.Basic/AbstractKubernetes.cs

+6-2
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,13 @@ private static class HttpMethods
1414
public static readonly HttpMethod Post = HttpMethod.Post;
1515
public static readonly HttpMethod Put = HttpMethod.Put;
1616
public static readonly HttpMethod Trace = HttpMethod.Trace;
17+
18+
#if NETSTANDARD2_0
1719
public static readonly HttpMethod Patch = new HttpMethod("PATCH");
20+
#else
21+
public static readonly HttpMethod Patch = HttpMethod.Patch;
22+
#endif
23+
1824
}
1925

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

98104
protected abstract Task<HttpResponseMessage> SendRequest<T>(string relativeUri, HttpMethod method, IReadOnlyDictionary<string, IReadOnlyList<string>> customHeaders, T body, CancellationToken cancellationToken);
99-
100-
protected abstract Task<HttpResponseMessage> SendRequestRaw(string requestContent, HttpRequestMessage httpRequest, CancellationToken cancellationToken);
101105
}

src/KubernetesClient.Basic/Autorest/HttpOperationException.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ namespace k8s.Autorest
99
/// Exception thrown for an invalid response with custom error information.
1010
/// </summary>
1111
[Serializable]
12-
public class HttpOperationException : RestException
12+
public class HttpOperationException : Exception
1313
{
1414
/// <summary>
1515
/// Gets information about the associated HTTP request.

src/KubernetesClient.Basic/Autorest/HttpRequestMessageWrapper.cs

+5-18
Original file line numberDiff line numberDiff line change
@@ -24,20 +24,12 @@ public HttpRequestMessageWrapper(HttpRequestMessage httpRequest, string content)
2424
throw new ArgumentNullException("httpRequest");
2525
}
2626

27-
this.CopyHeaders(httpRequest.Headers);
28-
this.CopyHeaders(httpRequest.GetContentHeaders());
27+
CopyHeaders(httpRequest.Headers);
28+
CopyHeaders(httpRequest.GetContentHeaders());
2929

30-
this.Content = content;
31-
this.Method = httpRequest.Method;
32-
this.RequestUri = httpRequest.RequestUri;
33-
if (httpRequest.Properties != null)
34-
{
35-
Properties = new Dictionary<string, object>();
36-
foreach (KeyValuePair<string, object> pair in httpRequest.Properties)
37-
{
38-
this.Properties[pair.Key] = pair.Value;
39-
}
40-
}
30+
Content = content;
31+
Method = httpRequest.Method;
32+
RequestUri = httpRequest.RequestUri;
4133
}
4234

4335
/// <summary>
@@ -49,10 +41,5 @@ public HttpRequestMessageWrapper(HttpRequestMessage httpRequest, string content)
4941
/// Gets or sets the Uri used for the HTTP request.
5042
/// </summary>
5143
public Uri RequestUri { get; protected set; }
52-
53-
/// <summary>
54-
/// Gets a set of properties for the HTTP request.
55-
/// </summary>
56-
public IDictionary<string, object> Properties { get; private set; }
5744
}
5845
}

src/KubernetesClient.Basic/Autorest/HttpResponseMessageWrapper.cs

+5-5
Original file line numberDiff line numberDiff line change
@@ -25,12 +25,12 @@ public HttpResponseMessageWrapper(HttpResponseMessage httpResponse, string conte
2525
throw new ArgumentNullException("httpResponse");
2626
}
2727

28-
this.CopyHeaders(httpResponse.Headers);
29-
this.CopyHeaders(httpResponse.GetContentHeaders());
28+
CopyHeaders(httpResponse.Headers);
29+
CopyHeaders(httpResponse.GetContentHeaders());
3030

31-
this.Content = content;
32-
this.StatusCode = httpResponse.StatusCode;
33-
this.ReasonPhrase = httpResponse.ReasonPhrase;
31+
Content = content;
32+
StatusCode = httpResponse.StatusCode;
33+
ReasonPhrase = httpResponse.ReasonPhrase;
3434
}
3535

3636
/// <summary>

src/KubernetesClient.Basic/Autorest/RestException.cs

-50
This file was deleted.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
using System.Runtime.CompilerServices;
2+
3+
[assembly: InternalsVisibleTo("KubernetesClient.Tests")]

src/KubernetesClient.Classic/KubernetesClient.Classic.csproj

+5
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,11 @@
5050
<Compile Include="..\KubernetesClient\Authentication\GcpTokenProvider.cs" />
5151
<Compile Include="..\KubernetesClient\Authentication\OidcTokenProvider.cs" />
5252
<Compile Include="..\KubernetesClient\Authentication\TokenFileAuth.cs" />
53+
<Compile Include="..\KubernetesClient\Authentication\BasicAuthenticationCredentials.cs" />
54+
<Compile Include="..\KubernetesClient\Authentication\ITokenProvider.cs" />
55+
<Compile Include="..\KubernetesClient\Authentication\ServiceClientCredentials.cs" />
56+
<Compile Include="..\KubernetesClient\Authentication\StringTokenProvider.cs" />
57+
<Compile Include="..\KubernetesClient\Authentication\TokenCredentials.cs" />
5358
</ItemGroup>
5459

5560
<ItemGroup>

src/KubernetesClient.Models/Versioning/VersionConverter.cs

+12-12
Original file line numberDiff line numberDiff line change
@@ -148,37 +148,37 @@ private static void ManualConfigurations(IMapperConfigurationExpression cfg)
148148
obj.Kind = metadata.Kind;
149149
});
150150
});
151-
cfg.CreateMap<V1Subject, V1beta1Subject>()
151+
152+
cfg.CreateMap<V1Subject, V1beta2Subject>()
152153
.ForMember(dest => dest.Group, opt => opt.Ignore())
153154
.ForMember(dest => dest.ServiceAccount, opt => opt.Ignore())
154155
.ForMember(dest => dest.User, opt => opt.Ignore())
155156
.ReverseMap();
156-
cfg.CreateMap<V1Subject, V1beta2Subject>()
157+
158+
cfg.CreateMap<V1Subject, V1beta3Subject>()
157159
.ForMember(dest => dest.Group, opt => opt.Ignore())
158160
.ForMember(dest => dest.ServiceAccount, opt => opt.Ignore())
159161
.ForMember(dest => dest.User, opt => opt.Ignore())
160162
.ReverseMap();
161163

162-
163-
cfg.CreateMap<V1HorizontalPodAutoscalerSpec, V2beta2HorizontalPodAutoscalerSpec>()
164-
.ForMember(dest => dest.Metrics, opt => opt.Ignore())
165-
.ForMember(dest => dest.Behavior, opt => opt.Ignore())
166-
.ReverseMap();
167-
168164
cfg.CreateMap<V1HorizontalPodAutoscalerSpec, V2HorizontalPodAutoscalerSpec>()
169165
.ForMember(dest => dest.Metrics, opt => opt.Ignore())
170166
.ForMember(dest => dest.Behavior, opt => opt.Ignore())
171167
.ReverseMap();
172168

173169

174-
cfg.CreateMap<V1HorizontalPodAutoscalerStatus, V2beta2HorizontalPodAutoscalerStatus>()
175-
.ForMember(dest => dest.Conditions, opt => opt.Ignore())
176-
.ForMember(dest => dest.CurrentMetrics, opt => opt.Ignore())
177-
.ReverseMap();
178170
cfg.CreateMap<V1HorizontalPodAutoscalerStatus, V2HorizontalPodAutoscalerStatus>()
179171
.ForMember(dest => dest.Conditions, opt => opt.Ignore())
180172
.ForMember(dest => dest.CurrentMetrics, opt => opt.Ignore())
181173
.ReverseMap();
174+
175+
cfg.CreateMap<V1alpha1ResourceClaim, V1ResourceClaim>()
176+
.ForMember(dest => dest.Name, opt => opt.Ignore())
177+
.ReverseMap();
178+
179+
cfg.CreateMap<V1beta2LimitedPriorityLevelConfiguration, V1beta3LimitedPriorityLevelConfiguration>()
180+
.ForMember(dest => dest.NominalConcurrencyShares, opt => opt.Ignore())
181+
.ReverseMap();
182182
}
183183
}
184184
}

src/KubernetesClient.Basic/Autorest/BasicAuthenticationCredentials.cs src/KubernetesClient/Authentication/BasicAuthenticationCredentials.cs

+3-1
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,10 @@
55
using System.Net.Http;
66
using System.Net.Http.Headers;
77
using System.Text;
8+
using System.Threading;
9+
using System.Threading.Tasks;
810

9-
namespace k8s.Autorest
11+
namespace k8s.Authentication
1012
{
1113
/// <summary>
1214
/// Basic Auth credentials for use with a REST Service Client.

src/KubernetesClient/Authentication/ExecTokenProvider.cs

-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
using k8s.Autorest;
21
using k8s.KubeConfigModels;
32
using System.Net.Http.Headers;
43
using System.Threading;

src/KubernetesClient/Authentication/GcpTokenProvider.cs

-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
using k8s.Autorest;
21
using k8s.Exceptions;
32
using System.Diagnostics;
43
using System.Net.Http.Headers;

src/KubernetesClient.Basic/Autorest/ITokenProvider.cs src/KubernetesClient/Authentication/ITokenProvider.cs

+3-1
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,12 @@
22
// Licensed under the MIT License. See License.txt in the project root for license information.
33

44
using System.Net.Http.Headers;
5+
using System.Threading;
6+
using System.Threading.Tasks;
57

68
#pragma warning disable SA1606
79
#pragma warning disable SA1614
8-
namespace k8s.Autorest
10+
namespace k8s.Authentication
911
{
1012
/// <summary>
1113
/// Interface to a source of access tokens.

src/KubernetesClient/Authentication/OidcTokenProvider.cs

-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
using IdentityModel.OidcClient;
2-
using k8s.Autorest;
32
using k8s.Exceptions;
43
using System.IdentityModel.Tokens.Jwt;
54
using System.Net.Http.Headers;

src/KubernetesClient.Basic/Autorest/ServiceClientCredentials.cs src/KubernetesClient/Authentication/ServiceClientCredentials.cs

+3-1
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,10 @@
22
// Licensed under the MIT License. See License.txt in the project root for license information.
33

44
using System.Net.Http;
5+
using System.Threading;
6+
using System.Threading.Tasks;
57

6-
namespace k8s.Autorest
8+
namespace k8s.Authentication
79
{
810
/// <summary>
911
/// ServiceClientCredentials is the abstraction for credentials used by ServiceClients accessing REST services.

src/KubernetesClient.Basic/Autorest/StringTokenProvider.cs src/KubernetesClient/Authentication/StringTokenProvider.cs

+3-1
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,10 @@
22
// Licensed under the MIT License. See License.txt in the project root for license information.
33

44
using System.Net.Http.Headers;
5+
using System.Threading;
6+
using System.Threading.Tasks;
57

6-
namespace k8s.Autorest
8+
namespace k8s.Authentication
79
{
810
/// <summary>
911
/// A simple token provider that always provides a static access token.

src/KubernetesClient.Basic/Autorest/TokenCredentials.cs src/KubernetesClient/Authentication/TokenCredentials.cs

+6-4
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,10 @@
22
// Licensed under the MIT License. See License.txt in the project root for license information.
33

44
using System.Net.Http;
5+
using System.Threading;
6+
using System.Threading.Tasks;
57

6-
namespace k8s.Autorest
8+
namespace k8s.Authentication
79
{
810
/// <summary>
911
/// Token based credentials for use with a REST Service Client.
@@ -73,7 +75,7 @@ public TokenCredentials(ITokenProvider tokenProvider)
7375
throw new ArgumentNullException("tokenProvider");
7476
}
7577

76-
this.TokenProvider = tokenProvider;
78+
TokenProvider = tokenProvider;
7779
}
7880

7981
/// <summary>
@@ -86,8 +88,8 @@ public TokenCredentials(ITokenProvider tokenProvider)
8688
public TokenCredentials(ITokenProvider tokenProvider, string tenantId, string callerId)
8789
: this(tokenProvider)
8890
{
89-
this.TenantId = tenantId;
90-
this.CallerId = callerId;
91+
TenantId = tenantId;
92+
CallerId = callerId;
9193
}
9294

9395
/// <summary>

src/KubernetesClient/Authentication/TokenFileAuth.cs

-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
using k8s.Autorest;
21
using System.IO;
32
using System.Net.Http.Headers;
43
using System.Threading;

src/KubernetesClient/FileUtils.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
namespace k8s
44
{
5-
public static class FileUtils
5+
internal static class FileUtils
66
{
77
private static readonly IFileSystem RealFileSystem = new FileSystem();
88
private static IFileSystem currentFileSystem = null;

src/KubernetesClient/Kubernetes.ConfigInit.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
using k8s.Autorest;
1+
using k8s.Authentication;
22
using k8s.Exceptions;
33
using System.Net.Http;
44
using System.Net.Security;

0 commit comments

Comments
 (0)