Update customResource example + bump nuget packages versions (#720)

Update customResource example nuget packages + update example

Update httpClientFactory example nuget packages

Update nuget packages

Change DateTime to DateTimeOffset

Update tests nuget packages

Make KubernetesClient project reference instead of Nuget package reference

Co-authored-by: Boshi Lian <farmer1992@gmail.com>

Co-authored-by: Boshi Lian <farmer1992@gmail.com>
This commit is contained in:
Bliamoh
2021-10-14 18:02:51 +02:00
committed by GitHub
parent fb553c5c0d
commit 2d8915dff7
11 changed files with 63 additions and 53 deletions

View File

@@ -1,7 +1,7 @@
using System.Collections.Generic;
using k8s;
using k8s.Models;
using Newtonsoft.Json;
using System.Collections.Generic;
[module: System.Diagnostics.CodeAnalysis.SuppressMessage("StyleCop.CSharp.MaintainabilityRules", "CA1724:TypeNamesShouldNotMatchNamespaces", Justification = "This is just an example.")]
[module: System.Diagnostics.CodeAnalysis.SuppressMessage("StyleCop.CSharp.MaintainabilityRules", "SA1402:FileMayOnlyContainASingleClass", Justification = "This is just an example.")]

View File

@@ -1,9 +1,9 @@
using System;
using System.Collections.Generic;
using k8s;
using k8s.Models;
using System.Threading.Tasks;
using Microsoft.AspNetCore.JsonPatch;
using System;
using System.Collections.Generic;
using System.Threading.Tasks;
namespace customResource
@@ -12,7 +12,7 @@ namespace customResource
{
private static async Task Main(string[] args)
{
Console.WriteLine("strating main()...");
Console.WriteLine("starting main()...");
// creating the k8s client
var k8SClientConfig = KubernetesClientConfiguration.BuildConfigFromConfigFile();
@@ -21,7 +21,7 @@ namespace customResource
// creating a K8s client for the CRD
var myCRD = Utils.MakeCRD();
Console.WriteLine("working with CRD: {0}.{1}", myCRD.PluralName, myCRD.Group);
var generic = new GenericClient(k8SClientConfig, myCRD.Group, myCRD.Version, myCRD.PluralName);
var generic = new GenericClient(client, myCRD.Group, myCRD.Version, myCRD.PluralName);
// creating a sample custom resource content
var myCr = Utils.MakeCResource();

View File

@@ -1,6 +1,4 @@
using k8s.Models;
using System.Collections.Generic;
using k8s;
using Newtonsoft.Json;
namespace customResource

View File

@@ -1,11 +1,23 @@
apiVersion: apiextensions.k8s.io/v1beta1
apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
name: customresources.csharp.com
spec:
group: csharp.com
version: v1alpha1
versions:
- name: v1alpha1
storage: true
served: true
schema:
openAPIV3Schema:
type: object
properties:
spec:
type: object
properties:
cityName:
type: string
names:
kind: CResource
plural: customresources
scope: Namespaced
scope: Namespaced

View File

@@ -1,15 +1,15 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net5.0</TargetFramework>
</PropertyGroup>
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net5.0</TargetFramework>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Newtonsoft.Json" Version="12.0.3" />
<PackageReference Include="KubernetesClient" Version="3.0.16" />
<PackageReference Include="Microsoft.Build" Version="16.8.0" />
<PackageReference Include="Microsoft.AspNetCore.JsonPatch" Version="5.0.1" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="Newtonsoft.Json" Version="13.0.1" />
<ProjectReference Include="..\..\src\KubernetesClient\KubernetesClient.csproj" />
<PackageReference Include="Microsoft.Build" Version="16.11.0" />
<PackageReference Include="Microsoft.AspNetCore.JsonPatch" Version="5.0.10" />
</ItemGroup>
</Project>

View File

@@ -1,4 +1,4 @@
<Project Sdk="Microsoft.NET.Sdk">
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
@@ -6,9 +6,9 @@
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Microsoft.Extensions.Http" Version="2.2.0" />
<PackageReference Include="Microsoft.Extensions.Hosting" Version="2.2.0" />
<PackageReference Include="Microsoft.Extensions.Logging.Console" Version="2.2.0" />
<PackageReference Include="Microsoft.Extensions.Http" Version="5.0.0" />
<PackageReference Include="Microsoft.Extensions.Hosting" Version="5.0.0" />
<PackageReference Include="Microsoft.Extensions.Logging.Console" Version="5.0.0" />
</ItemGroup>
<ItemGroup>