cleanup folders (#792)

* unify folders

* move dep and target outside
This commit is contained in:
Boshi Lian
2022-03-07 10:06:55 -08:00
committed by GitHub
parent c11e205a01
commit 01b2aa832c
48 changed files with 98 additions and 132 deletions

View File

@@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<TargetFramework>net6</TargetFramework>
</PropertyGroup>
</Project>

View File

@@ -0,0 +1,5 @@
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup>
<ProjectReference Include="$(MSBuildThisFileDirectory)\..\src\KubernetesClient\KubernetesClient.csproj" />
</ItemGroup>
</Project>

View File

@@ -2,11 +2,6 @@
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net5.0</TargetFramework>
</PropertyGroup>
<ItemGroup>
<ProjectReference Include="..\..\src\KubernetesClient\KubernetesClient.csproj" />
</ItemGroup>
</Project>

View File

@@ -1,12 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">
<ItemGroup>
<ProjectReference Include="..\..\src\KubernetesClient\KubernetesClient.csproj" />
</ItemGroup>
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net5</TargetFramework>
</PropertyGroup>
</Project>

View File

@@ -1,7 +1,7 @@
using k8s;
using k8s.Models;
using Newtonsoft.Json;
using System.Collections.Generic;
using System.Text.Json.Serialization;
[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.")]
@@ -23,16 +23,16 @@ namespace customResource
public abstract class CustomResource : KubernetesObject
{
[JsonProperty(PropertyName = "metadata")]
[JsonPropertyName("metadata")]
public V1ObjectMeta Metadata { get; set; }
}
public abstract class CustomResource<TSpec, TStatus> : CustomResource
{
[JsonProperty(PropertyName = "spec")]
[JsonPropertyName("spec")]
public TSpec Spec { get; set; }
[JsonProperty(PropertyName = "CStatus")]
[JsonPropertyName("CStatus")]
public TStatus CStatus { get; set; }
}

View File

@@ -1,9 +1,10 @@
using Json.Patch;
using k8s;
using k8s.Autorest;
using k8s.Models;
using Microsoft.AspNetCore.JsonPatch;
using System;
using System.Collections.Generic;
using System.Text.Json;
using System.Threading.Tasks;
@@ -55,11 +56,13 @@ namespace customResource
Console.WriteLine("- CR Item {0} = {1}", crs.Items.IndexOf(cr), cr.Metadata.Name);
}
// updating the custom resource
var old = JsonSerializer.SerializeToDocument(myCr);
myCr.Metadata.Labels.TryAdd("newKey", "newValue");
var patch = new JsonPatchDocument<CResource>();
patch.Replace(x => x.Metadata.Labels, myCr.Metadata.Labels);
patch.Operations.ForEach(x => x.path = x.path.ToLower());
var expected = JsonSerializer.SerializeToDocument(myCr);
var patch = old.CreatePatch(expected);
// updating the custom resource
var crPatch = new V1Patch(patch, V1Patch.PatchType.JsonPatch);
try
{

View File

@@ -1,5 +1,5 @@
using k8s.Models;
using Newtonsoft.Json;
using System.Text.Json.Serialization;
namespace customResource
{
@@ -21,13 +21,13 @@ namespace customResource
public class CResourceSpec
{
[JsonProperty(PropertyName = "cityName")]
[JsonPropertyName("cityName")]
public string CityName { get; set; }
}
public class CResourceStatus : V1Status
{
[JsonProperty(PropertyName = "temperature", NullValueHandling = NullValueHandling.Ignore)]
[JsonPropertyName("temperature")]
public string Temperature { get; set; }
}
}

View File

@@ -2,14 +2,10 @@
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net5.0</TargetFramework>
</PropertyGroup>
<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" />
<PackageReference Include="JsonPatch.Net" Version="1.1.2" />
</ItemGroup>
</Project>

View File

@@ -1,12 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">
<ItemGroup>
<ProjectReference Include="..\..\src\KubernetesClient\KubernetesClient.csproj" />
</ItemGroup>
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net5</TargetFramework>
</PropertyGroup>
</Project>

View File

@@ -1,13 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">
<ItemGroup>
<ProjectReference Include="..\..\src\KubernetesClient\KubernetesClient.csproj" />
</ItemGroup>
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net5</TargetFramework>
<LangVersion>7.1</LangVersion>
</PropertyGroup>
</Project>

View File

@@ -1,12 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">
<ItemGroup>
<ProjectReference Include="..\..\src\KubernetesClient\KubernetesClient.csproj" />
</ItemGroup>
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net5</TargetFramework>
</PropertyGroup>
</Project>

View File

@@ -1,12 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">
<ItemGroup>
<ProjectReference Include="..\..\src\KubernetesClient\KubernetesClient.csproj" />
</ItemGroup>
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net5</TargetFramework>
</PropertyGroup>
</Project>

View File

@@ -1,13 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net5</TargetFramework>
</PropertyGroup>
<ItemGroup>
<ProjectReference Include="..\..\src\KubernetesClient\KubernetesClient.csproj" />
</ItemGroup>
</Project>

View File

@@ -1,12 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">
<ItemGroup>
<ProjectReference Include="..\..\src\KubernetesClient\KubernetesClient.csproj" />
</ItemGroup>
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net5</TargetFramework>
</PropertyGroup>
</Project>

View File

@@ -1,10 +0,0 @@
apiVersion: v1
kind: Pod
metadata:
name: nginx
spec:
containers:
- name: nginx
image: nginx:1.7.9
ports:
- containerPort: 80

View File

@@ -1,12 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net5</TargetFramework>
</PropertyGroup>
<ItemGroup>
<ProjectReference Include="..\..\src\KubernetesClient\KubernetesClient.csproj" />
</ItemGroup>
</Project>

View File

@@ -1,13 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">
<ItemGroup>
<ProjectReference Include="..\..\src\KubernetesClient\KubernetesClient.csproj" />
</ItemGroup>
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>netcoreapp2.1</TargetFramework>
<LangVersion>7.1</LangVersion>
</PropertyGroup>
</Project>

View File

@@ -1,12 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">
<ItemGroup>
<ProjectReference Include="..\..\src\KubernetesClient\KubernetesClient.csproj" />
</ItemGroup>
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net5</TargetFramework>
</PropertyGroup>
</Project>

View File

@@ -1,12 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">
<ItemGroup>
<ProjectReference Include="..\..\src\KubernetesClient\KubernetesClient.csproj" />
</ItemGroup>
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net5</TargetFramework>
</PropertyGroup>
</Project>

View File

@@ -1,12 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net5</TargetFramework>
</PropertyGroup>
<ItemGroup>
<ProjectReference Include="..\..\src\KubernetesClient\KubernetesClient.csproj" />
</ItemGroup>
</Project>

View File

@@ -14,7 +14,7 @@ namespace yaml
var typeMap = new Dictionary<String, Type>();
typeMap.Add("v1/Pod", typeof(V1Pod));
typeMap.Add("v1/Service", typeof(V1Service));
typeMap.Add("apps/v1beta1/Deployment", typeof(Appsv1beta1Deployment));
typeMap.Add("apps/v1/Deployment", typeof(V1Deployment));
var objects = await Yaml.LoadAllFromFileAsync(args[0], typeMap);

View File

@@ -1,12 +1,5 @@
<Project Sdk="Microsoft.NET.Sdk">
<ItemGroup>
<ProjectReference Include="..\..\src\KubernetesClient\KubernetesClient.csproj" />
</ItemGroup>
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>netcoreapp2.0</TargetFramework>
</PropertyGroup>
</Project>