Skip to content

Commit 01358bf

Browse files
authored
feat(dotnet new): Add dotnet new templates. (#154)
Closes #133. This adds multiple templates for `dotnet-new`: - Empty operator c-sharp - Empty operator f-sharp - Operator with demo code c-sharp - Operator with demo code f-sharp Signed-off-by: Christoph Bühler <[email protected]>
1 parent 569ea17 commit 01358bf

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

43 files changed

+1084
-0
lines changed

DotnetOperatorSdk.sln

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,10 @@ EndProjectSection
3636
EndProject
3737
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "KubeOps.Testing", "src\KubeOps.Testing\KubeOps.Testing.csproj", "{4A6D1BEB-CB4C-495A-A20D-D8728F6BBC93}"
3838
EndProject
39+
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "KubeOps.Templates", "src\KubeOps.Templates\KubeOps.Templates.csproj", "{210EF3DD-151D-4547-9A35-39C97B887CD0}"
40+
EndProject
41+
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "KubeOps.Templates.Test", "tests\KubeOps.Templates.Test\KubeOps.Templates.Test.csproj", "{B88CFB69-709B-4B7D-A1F6-BD8200609770}"
42+
EndProject
3943
Global
4044
GlobalSection(SolutionConfigurationPlatforms) = preSolution
4145
Debug|Any CPU = Debug|Any CPU
@@ -64,6 +68,14 @@ Global
6468
{4A6D1BEB-CB4C-495A-A20D-D8728F6BBC93}.Debug|Any CPU.Build.0 = Debug|Any CPU
6569
{4A6D1BEB-CB4C-495A-A20D-D8728F6BBC93}.Release|Any CPU.ActiveCfg = Release|Any CPU
6670
{4A6D1BEB-CB4C-495A-A20D-D8728F6BBC93}.Release|Any CPU.Build.0 = Release|Any CPU
71+
{210EF3DD-151D-4547-9A35-39C97B887CD0}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
72+
{210EF3DD-151D-4547-9A35-39C97B887CD0}.Debug|Any CPU.Build.0 = Debug|Any CPU
73+
{210EF3DD-151D-4547-9A35-39C97B887CD0}.Release|Any CPU.ActiveCfg = Release|Any CPU
74+
{210EF3DD-151D-4547-9A35-39C97B887CD0}.Release|Any CPU.Build.0 = Release|Any CPU
75+
{B88CFB69-709B-4B7D-A1F6-BD8200609770}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
76+
{B88CFB69-709B-4B7D-A1F6-BD8200609770}.Debug|Any CPU.Build.0 = Debug|Any CPU
77+
{B88CFB69-709B-4B7D-A1F6-BD8200609770}.Release|Any CPU.ActiveCfg = Release|Any CPU
78+
{B88CFB69-709B-4B7D-A1F6-BD8200609770}.Release|Any CPU.Build.0 = Release|Any CPU
6779
EndGlobalSection
6880
GlobalSection(SolutionProperties) = preSolution
6981
HideSolutionNode = FALSE
@@ -75,6 +87,8 @@ Global
7587
{751BDC14-D75F-4DDE-9C45-2432041FBCAC} = {50E9B964-68F7-4B9F-BEA8-165CE45BC5C6}
7688
{B374D7E4-E9BA-47F8-B1A4-440DECD376E4} = {50E9B964-68F7-4B9F-BEA8-165CE45BC5C6}
7789
{4A6D1BEB-CB4C-495A-A20D-D8728F6BBC93} = {95F3A6DD-B421-441D-B263-1B34A1465FF5}
90+
{210EF3DD-151D-4547-9A35-39C97B887CD0} = {95F3A6DD-B421-441D-B263-1B34A1465FF5}
91+
{B88CFB69-709B-4B7D-A1F6-BD8200609770} = {50E9B964-68F7-4B9F-BEA8-165CE45BC5C6}
7892
EndGlobalSection
7993
GlobalSection(ExtensibilityGlobals) = postSolution
8094
SolutionGuid = {ADAA5DFB-A7E5-490C-88EF-48D67C715F24}
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
<Project Sdk="Microsoft.NET.Sdk">
2+
3+
<Import Project="..\..\config\Common.targets"/>
4+
<Import Project="..\..\config\CodeAnalysis.targets"/>
5+
6+
<PropertyGroup>
7+
<IsPackable>true</IsPackable>
8+
<PackageType>Template</PackageType>
9+
<PackageId>KubeOps.Templates</PackageId>
10+
<Title>KubeOps Templates</Title>
11+
<PackageTags>dotnet-new templates Kubernetes Operator Sdk KubeOps</PackageTags>
12+
<PackageProjectUrl>https://buehler.github.io/dotnet-operator-sdk/</PackageProjectUrl>
13+
<RepositoryUrl>https://github.com/buehler/dotnet-operator-sdk.git</RepositoryUrl>
14+
<RepositoryType>git</RepositoryType>
15+
<PackageLicense>Unlicense</PackageLicense>
16+
<PackageDescription>dotnet new templates for KubeOps operator sdk.</PackageDescription>
17+
18+
<TargetFramework>netstandard2.0</TargetFramework>
19+
20+
<IncludeContentInPack>true</IncludeContentInPack>
21+
<IncludeBuildOutput>false</IncludeBuildOutput>
22+
<ContentTargetFolders>content</ContentTargetFolders>
23+
<NoWarn>$(NoWarn);NU5128</NoWarn>
24+
</PropertyGroup>
25+
26+
<ItemGroup>
27+
<Content Include="Templates\**\*" Exclude="Templates\**\bin\**;Templates\**\obj\**"/>
28+
<Compile Remove="**\*"/>
29+
</ItemGroup>
30+
31+
</Project>
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
{
2+
"$schema": "http://json.schemastore.org/template",
3+
"author": "Christoph Bühler",
4+
"classifications": [
5+
"Kubernetes",
6+
"Operator",
7+
"Empty"
8+
],
9+
"identity": "KubeOps.Templates.EmptyOperator.CSharp",
10+
"groupIdentity": "KubeOps.Templates.EmptyOperator",
11+
"name": "Kubernetes Operator Empty",
12+
"description": "Create an empty kubernetes operator with the KubeOps SDK",
13+
"shortName": "operator-empty",
14+
"tags": {
15+
"language": "C#",
16+
"type": "project"
17+
},
18+
"sourceName": "GeneratedOperatorProject",
19+
"defaultName": "Operator",
20+
"preferNameDirectory": true,
21+
"postActions": [
22+
{
23+
"actionId": "B17581D1-C5C9-4489-8F0A-004BE667B814",
24+
"description": "Add KubeOps SDK reference",
25+
"continueOnError": false,
26+
"manualInstructions": [
27+
{
28+
"text": "Add the KubeOps package to your project via nuget"
29+
}
30+
],
31+
"args": {
32+
"referenceType": "package",
33+
"reference": "KubeOps",
34+
"projectFileExtensions": ".csproj"
35+
}
36+
}
37+
]
38+
}
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
<Project Sdk="Microsoft.NET.Sdk.Web">
2+
3+
<PropertyGroup>
4+
<TargetFramework>net5.0</TargetFramework>
5+
<LangVersion>9.0</LangVersion>
6+
<Nullable>enable</Nullable>
7+
</PropertyGroup>
8+
9+
</Project>
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
using KubeOps.Operator;
2+
using Microsoft.AspNetCore.Hosting;
3+
using Microsoft.Extensions.Hosting;
4+
using GeneratedOperatorProject;
5+
6+
static IHostBuilder CreateHostBuilder(string[] args) =>
7+
Host.CreateDefaultBuilder(args)
8+
.ConfigureWebHostDefaults(webBuilder => { webBuilder.UseStartup<Startup>(); });
9+
10+
await CreateHostBuilder(args).Build().RunOperatorAsync(args);
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
using KubeOps.Operator;
2+
using Microsoft.AspNetCore.Builder;
3+
using Microsoft.Extensions.DependencyInjection;
4+
5+
namespace GeneratedOperatorProject
6+
{
7+
public class Startup
8+
{
9+
public void ConfigureServices(IServiceCollection services)
10+
{
11+
services.AddKubernetesOperator();
12+
}
13+
14+
public void Configure(IApplicationBuilder app)
15+
{
16+
app.UseKubernetesOperator();
17+
}
18+
}
19+
}
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
{
2+
"Logging": {
3+
"LogLevel": {
4+
"Default": "Information",
5+
"Microsoft": "Warning",
6+
"Microsoft.Hosting.Lifetime": "Information"
7+
}
8+
}
9+
}
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
{
2+
"Logging": {
3+
"LogLevel": {
4+
"Default": "Information",
5+
"Microsoft": "Warning",
6+
"Microsoft.Hosting.Lifetime": "Information"
7+
}
8+
},
9+
"AllowedHosts": "*"
10+
}
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
{
2+
"$schema": "http://json.schemastore.org/template",
3+
"author": "Christoph Bühler",
4+
"classifications": [
5+
"Kubernetes",
6+
"Operator",
7+
"Empty"
8+
],
9+
"identity": "KubeOps.Templates.EmptyOperator.FSharp",
10+
"groupIdentity": "KubeOps.Templates.EmptyOperator",
11+
"name": "Kubernetes Operator Empty",
12+
"description": "Create an empty kubernetes operator with the KubeOps SDK",
13+
"shortName": "operator-empty",
14+
"tags": {
15+
"language": "F#",
16+
"type": "project"
17+
},
18+
"sourceName": "GeneratedOperatorProject",
19+
"defaultName": "Operator",
20+
"preferNameDirectory": true,
21+
"postActions": [
22+
{
23+
"actionId": "B17581D1-C5C9-4489-8F0A-004BE667B814",
24+
"description": "Add KubeOps SDK reference",
25+
"continueOnError": false,
26+
"manualInstructions": [
27+
{
28+
"text": "Add the KubeOps package to your project via nuget"
29+
}
30+
],
31+
"args": {
32+
"referenceType": "package",
33+
"reference": "KubeOps",
34+
"projectFileExtensions": ".fsproj"
35+
}
36+
}
37+
]
38+
}
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
<Project Sdk="Microsoft.NET.Sdk.Web">
2+
3+
<PropertyGroup>
4+
<TargetFramework>net5.0</TargetFramework>
5+
</PropertyGroup>
6+
7+
<ItemGroup>
8+
<Compile Include="Startup.fs" />
9+
<Compile Include="Program.fs" />
10+
</ItemGroup>
11+
12+
</Project>

0 commit comments

Comments
 (0)