Skip to content

Commit 31b2ab0

Browse files
authored
feat(web-operator): Add validation webhooks. (#631)
BREAKING CHANGE: This overhauls the way webhooks worked. Webhooks now run with normal ASP.net ApiControllers. To use a webhook, refer to the documentation. Basically, create a subclass of the validation webhook class and decorate it with the correct validation attribute. Then, the webhook will run. Other elements like automatic install will follow this preview release.
1 parent 0ef92cf commit 31b2ab0

File tree

78 files changed

+3067
-2156
lines changed

Some content is hidden

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

78 files changed

+3067
-2156
lines changed

.config/dotnet-tools.json

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,6 @@
55
"docfx": {
66
"version": "2.71.0",
77
"commands": ["docfx"]
8-
},
9-
"kubeops.cli": {
10-
"version": "8.0.0-pre.19",
11-
"commands": ["kubeops"]
128
}
139
}
1410
}

.github/workflows/dotnet-test.yml

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,20 @@ concurrency:
1010
cancel-in-progress: true
1111

1212
jobs:
13+
build:
14+
name: Building
15+
runs-on: ubuntu-latest
16+
steps:
17+
- uses: actions/checkout@v3
18+
19+
- name: Setup .NET
20+
uses: actions/setup-dotnet@v3
21+
with:
22+
dotnet-version: 7.x
23+
24+
- name: Execute Tests
25+
run: dotnet build --configuration Release
26+
1327
test:
1428
name: Testing
1529
runs-on: ubuntu-latest
@@ -25,4 +39,4 @@ jobs:
2539
uses: helm/[email protected]
2640

2741
- name: Execute Tests
28-
run: dotnet test --configuration Release
42+
run: dotnet test

KubeOps.sln

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -45,15 +45,15 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "KubeOps.Operator.Web", "src
4545
EndProject
4646
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "KubeOps.Operator.Web.Test", "test\KubeOps.Operator.Web.Test\KubeOps.Operator.Web.Test.csproj", "{BC6E6D3C-6404-4B01-9D72-AA16FEEBFF5C}"
4747
EndProject
48-
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "KubeOps.Transpiler.Test", "test\KubeOps.Transpiler.Test\KubeOps.Transpiler.Test.csproj", "{47914451-147D-427E-B150-9C47DBF28F2C}"
49-
EndProject
50-
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "KubeOps.Transpiler", "src\KubeOps.Transpiler\KubeOps.Transpiler.csproj", "{A793FC08-E76C-448B-BE93-88C137D2C7AB}"
51-
EndProject
5248
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "KubeOps.KubernetesClient", "src\KubeOps.KubernetesClient\KubeOps.KubernetesClient.csproj", "{C2C6FF06-2B9D-4FAC-A039-3DC1E007DE3B}"
5349
EndProject
5450
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "KubeOps.KubernetesClient.Test", "test\KubeOps.KubernetesClient.Test\KubeOps.KubernetesClient.Test.csproj", "{25F767E5-7A74-459B-83CC-39519461F38B}"
5551
EndProject
56-
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "UserConfigOperator", "examples\UserConfigOperator\UserConfigOperator.csproj", "{032A7FE0-EDFD-4959-9618-B3A911B163F0}"
52+
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "WebhookOperator", "examples\WebhookOperator\WebhookOperator.csproj", "{4AD46831-1326-4711-83D0-6D7B4AF403DB}"
53+
EndProject
54+
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "KubeOps.Transpiler", "src\KubeOps.Transpiler\KubeOps.Transpiler.csproj", "{7229B71C-C5A5-41E0-85DB-A331A945703C}"
55+
EndProject
56+
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "KubeOps.Transpiler.Test", "test\KubeOps.Transpiler.Test\KubeOps.Transpiler.Test.csproj", "{7F7744B2-CF3F-4309-9C2D-037278017D49}"
5757
EndProject
5858
Global
5959
GlobalSection(SolutionConfigurationPlatforms) = preSolution
@@ -74,11 +74,11 @@ Global
7474
{162EE2A9-F8BA-4D52-9D65-67CCDB76EAC9} = {C587731F-8191-4A19-8662-B89A60FE79A1}
7575
{E5012C55-B34E-4672-AF4C-C233B45E8EA2} = {4DB01062-6DC5-4028-BB72-C0619C2F5F2E}
7676
{BC6E6D3C-6404-4B01-9D72-AA16FEEBFF5C} = {C587731F-8191-4A19-8662-B89A60FE79A1}
77-
{47914451-147D-427E-B150-9C47DBF28F2C} = {C587731F-8191-4A19-8662-B89A60FE79A1}
78-
{A793FC08-E76C-448B-BE93-88C137D2C7AB} = {4DB01062-6DC5-4028-BB72-C0619C2F5F2E}
7977
{C2C6FF06-2B9D-4FAC-A039-3DC1E007DE3B} = {4DB01062-6DC5-4028-BB72-C0619C2F5F2E}
8078
{25F767E5-7A74-459B-83CC-39519461F38B} = {C587731F-8191-4A19-8662-B89A60FE79A1}
81-
{032A7FE0-EDFD-4959-9618-B3A911B163F0} = {DC760E69-D0EA-417F-AE38-B12D0B04DE39}
79+
{4AD46831-1326-4711-83D0-6D7B4AF403DB} = {DC760E69-D0EA-417F-AE38-B12D0B04DE39}
80+
{7229B71C-C5A5-41E0-85DB-A331A945703C} = {4DB01062-6DC5-4028-BB72-C0619C2F5F2E}
81+
{7F7744B2-CF3F-4309-9C2D-037278017D49} = {C587731F-8191-4A19-8662-B89A60FE79A1}
8282
EndGlobalSection
8383
GlobalSection(ProjectConfigurationPlatforms) = postSolution
8484
{E9A0B04E-D90E-4B94-90E0-DD3666B098FF}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
@@ -121,14 +121,6 @@ Global
121121
{BC6E6D3C-6404-4B01-9D72-AA16FEEBFF5C}.Debug|Any CPU.Build.0 = Debug|Any CPU
122122
{BC6E6D3C-6404-4B01-9D72-AA16FEEBFF5C}.Release|Any CPU.ActiveCfg = Release|Any CPU
123123
{BC6E6D3C-6404-4B01-9D72-AA16FEEBFF5C}.Release|Any CPU.Build.0 = Release|Any CPU
124-
{47914451-147D-427E-B150-9C47DBF28F2C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
125-
{47914451-147D-427E-B150-9C47DBF28F2C}.Debug|Any CPU.Build.0 = Debug|Any CPU
126-
{47914451-147D-427E-B150-9C47DBF28F2C}.Release|Any CPU.ActiveCfg = Release|Any CPU
127-
{47914451-147D-427E-B150-9C47DBF28F2C}.Release|Any CPU.Build.0 = Release|Any CPU
128-
{A793FC08-E76C-448B-BE93-88C137D2C7AB}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
129-
{A793FC08-E76C-448B-BE93-88C137D2C7AB}.Debug|Any CPU.Build.0 = Debug|Any CPU
130-
{A793FC08-E76C-448B-BE93-88C137D2C7AB}.Release|Any CPU.ActiveCfg = Release|Any CPU
131-
{A793FC08-E76C-448B-BE93-88C137D2C7AB}.Release|Any CPU.Build.0 = Release|Any CPU
132124
{C2C6FF06-2B9D-4FAC-A039-3DC1E007DE3B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
133125
{C2C6FF06-2B9D-4FAC-A039-3DC1E007DE3B}.Debug|Any CPU.Build.0 = Debug|Any CPU
134126
{C2C6FF06-2B9D-4FAC-A039-3DC1E007DE3B}.Release|Any CPU.ActiveCfg = Release|Any CPU
@@ -137,9 +129,17 @@ Global
137129
{25F767E5-7A74-459B-83CC-39519461F38B}.Debug|Any CPU.Build.0 = Debug|Any CPU
138130
{25F767E5-7A74-459B-83CC-39519461F38B}.Release|Any CPU.ActiveCfg = Release|Any CPU
139131
{25F767E5-7A74-459B-83CC-39519461F38B}.Release|Any CPU.Build.0 = Release|Any CPU
140-
{032A7FE0-EDFD-4959-9618-B3A911B163F0}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
141-
{032A7FE0-EDFD-4959-9618-B3A911B163F0}.Debug|Any CPU.Build.0 = Debug|Any CPU
142-
{032A7FE0-EDFD-4959-9618-B3A911B163F0}.Release|Any CPU.ActiveCfg = Release|Any CPU
143-
{032A7FE0-EDFD-4959-9618-B3A911B163F0}.Release|Any CPU.Build.0 = Release|Any CPU
132+
{4AD46831-1326-4711-83D0-6D7B4AF403DB}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
133+
{4AD46831-1326-4711-83D0-6D7B4AF403DB}.Debug|Any CPU.Build.0 = Debug|Any CPU
134+
{4AD46831-1326-4711-83D0-6D7B4AF403DB}.Release|Any CPU.ActiveCfg = Release|Any CPU
135+
{4AD46831-1326-4711-83D0-6D7B4AF403DB}.Release|Any CPU.Build.0 = Release|Any CPU
136+
{7229B71C-C5A5-41E0-85DB-A331A945703C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
137+
{7229B71C-C5A5-41E0-85DB-A331A945703C}.Debug|Any CPU.Build.0 = Debug|Any CPU
138+
{7229B71C-C5A5-41E0-85DB-A331A945703C}.Release|Any CPU.ActiveCfg = Release|Any CPU
139+
{7229B71C-C5A5-41E0-85DB-A331A945703C}.Release|Any CPU.Build.0 = Release|Any CPU
140+
{7F7744B2-CF3F-4309-9C2D-037278017D49}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
141+
{7F7744B2-CF3F-4309-9C2D-037278017D49}.Debug|Any CPU.Build.0 = Debug|Any CPU
142+
{7F7744B2-CF3F-4309-9C2D-037278017D49}.Release|Any CPU.ActiveCfg = Release|Any CPU
143+
{7F7744B2-CF3F-4309-9C2D-037278017D49}.Release|Any CPU.Build.0 = Release|Any CPU
144144
EndGlobalSection
145145
EndGlobal

examples/Operator/Entities/V1TestEntity.cs

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
namespace Operator.Entities;
66

77
[KubernetesEntity(Group = "testing.dev", ApiVersion = "v1", Kind = "TestEntity")]
8-
public partial class V1TestEntity : CustomKubernetesEntity<V1TestEntity.EntitySpec, V1TestEntity.EntityStatus>
8+
public partial class V1TestEntity : CustomKubernetesEntity<V1TestEntity.EntitySpec>
99
{
1010
public override string ToString() => $"Test Entity ({Metadata.Name}): {Spec.Username} ({Spec.Email})";
1111

@@ -15,9 +15,4 @@ public class EntitySpec
1515

1616
public string Email { get; set; } = string.Empty;
1717
}
18-
19-
public class EntityStatus
20-
{
21-
public string Status { get; set; } = string.Empty;
22-
}
2318
}

examples/Operator/Operator.csproj

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,10 @@
1010
</PropertyGroup>
1111

1212
<ItemGroup>
13-
<ProjectReference Include="..\..\src\KubeOps.Operator\KubeOps.Operator.csproj"/>
1413
<ProjectReference Include="..\..\src\KubeOps.Generator\KubeOps.Generator.csproj"
1514
OutputItemType="Analyzer"
16-
ReferenceOutputAssembly="false"/>
15+
ReferenceOutputAssembly="false" />
16+
<ProjectReference Include="..\..\src\KubeOps.Operator\KubeOps.Operator.csproj" />
1717
</ItemGroup>
1818

1919
</Project>

examples/Operator/todos.txt

Lines changed: 0 additions & 3 deletions
This file was deleted.

examples/UserConfigOperator/Controller/V1UserConfigController.cs

Lines changed: 0 additions & 47 deletions
This file was deleted.

examples/UserConfigOperator/Entities/V1UserConfig.cs

Lines changed: 0 additions & 16 deletions
This file was deleted.

examples/UserConfigOperator/Program.cs

Lines changed: 0 additions & 23 deletions
This file was deleted.

examples/UserConfigOperator/Properties/launchSettings.json

Lines changed: 0 additions & 8 deletions
This file was deleted.

0 commit comments

Comments
 (0)