KubeOps.Operator.Web
8.0.0
See the version list below for details.
dotnet add package KubeOps.Operator.Web --version 8.0.0
NuGet\Install-Package KubeOps.Operator.Web -Version 8.0.0
<PackageReference Include="KubeOps.Operator.Web" Version="8.0.0" />
paket add KubeOps.Operator.Web --version 8.0.0
#r "nuget: KubeOps.Operator.Web, 8.0.0"
// Install KubeOps.Operator.Web as a Cake Addin #addin nuget:?package=KubeOps.Operator.Web&version=8.0.0 // Install KubeOps.Operator.Web as a Cake Tool #tool nuget:?package=KubeOps.Operator.Web&version=8.0.0
KubeOps Operator Web
The KubeOps Operator Web package provides a webserver to enable webhooks for your Kubernetes operator.
Usage
To enable webhooks and external access to your operator, you need to
use ASP.net. The project file needs to reference Microsoft.NET.Sdk.Web
instead of Microsoft.NET.Sdk
and the Program.cs
needs to be changed.
To allow webhooks, the MVC controllers need to be registered and mapped.
The basic Program.cs
setup looks like this:
using KubeOps.Operator;
var builder = WebApplication.CreateBuilder(args);
builder.Services
.AddKubernetesOperator()
.RegisterComponents();
builder.Services
.AddControllers();
var app = builder.Build();
app.UseRouting();
app.MapControllers();
await app.RunAsync();
Note the .AddControllers
and .MapControllers
call.
Without them, your webhooks will not be reachable.
Validation Hooks
To create a validation webhook, first create a new class
that implements the ValidationWebhook<T>
base class.
Then decorate the webhook with the ValidationWebhookAttribute
to set the route correctly.
After that setup, you may overwrite any of the following methods:
- Create
- CreateAsync
- Update
- UpdateAsync
- Delete
- DeleteAsync
The async methods take precedence over the sync methods.
An example of such a validation webhook looks like:
[ValidationWebhook(typeof(V1TestEntity))]
public class TestValidationWebhook : ValidationWebhook<V1TestEntity>
{
public override ValidationResult Create(V1TestEntity entity, bool dryRun)
{
if (entity.Spec.Username == "forbidden")
{
return Fail("name may not be 'forbidden'.", 422);
}
return Success();
}
public override ValidationResult Update(V1TestEntity oldEntity, V1TestEntity newEntity, bool dryRun)
{
if (newEntity.Spec.Username == "forbidden")
{
return Fail("name may not be 'forbidden'.");
}
return Success();
}
}
To create the validation results, use the protected
methods (Success
and Fail
)
like "normal" IActionResult
creation methods.
Mutation Hooks
To create a mutation webhook, first create a new class
that implements the MutationWebhook<T>
base class.
Then decorate the webhook with the MutationWebhookAttribute
to set the route correctly.
After that setup, you may overwrite any of the following methods:
- Create
- CreateAsync
- Update
- UpdateAsync
- Delete
- DeleteAsync
The async methods take precedence over the sync methods.
An example of such a mutation webhook looks like:
[MutationWebhook(typeof(V1TestEntity))]
public class TestMutationWebhook : MutationWebhook<V1TestEntity>
{
public override MutationResult<V1TestEntity> Create(V1TestEntity entity, bool dryRun)
{
if (entity.Spec.Username == "overwrite")
{
entity.Spec.Username = "random overwritten";
return Modified(entity);
}
return NoChanges();
}
}
To create the mutation results, use the protected
methods (NoChanges
, Modified
, and Fail
)
like "normal" IActionResult
creation methods.
Conversion Hooks
[!CAUTION] Conversion webhooks are not stable yet. The API may change in the future without a new major version. All code related to conversion webhooks are attributed with the
RequiresPreviewFeatures
attribute. To use the features, you need to enable the preview features in your project file with the<EnablePreviewFeatures>true</EnablePreviewFeatures>
property.
A conversion webhook is a special kind of webhook that allows you to convert Kubernetes resources between versions. The webhooks are installed in CRDs and are called for all objects that need conversion (i.e. to achieve the stored version state).
A conversion webhook is separated to the webhook itself (the MVC controller that registers its route within ASP.NET) and the conversion logic.
The following example has two versions of the "TestEntity" (v1 and v2) and implements a conversion webhook to convert from v1 to v2 and vice versa.
// The Kubernetes resources
[KubernetesEntity(Group = "webhook.dev", ApiVersion = "v1", Kind = "TestEntity")]
public partial class V1TestEntity : CustomKubernetesEntity<V1TestEntity.EntitySpec>
{
public override string ToString() => $"Test Entity v1 ({Metadata.Name}): {Spec.Name}";
public class EntitySpec
{
public string Name { get; set; } = string.Empty;
}
}
[KubernetesEntity(Group = "webhook.dev", ApiVersion = "v2", Kind = "TestEntity")]
public partial class V2TestEntity : CustomKubernetesEntity<V2TestEntity.EntitySpec>
{
public override string ToString() => $"Test Entity v2 ({Metadata.Name}): {Spec.Firstname} {Spec.Lastname}";
public class EntitySpec
{
public string Firstname { get; set; } = string.Empty;
public string Lastname { get; set; } = string.Empty;
}
}
The v1 of the resource has first and lastname in the same field, while the v2 has them separated.
public class V1ToV2 : IEntityConverter<V1TestEntity, V2TestEntity>
{
public V2TestEntity Convert(V1TestEntity from)
{
var nameSplit = from.Spec.Name.Split(' ');
var result = new V2TestEntity { Metadata = from.Metadata };
result.Spec.Firstname = nameSplit[0];
result.Spec.Lastname = string.Join(' ', nameSplit[1..]);
return result;
}
public V1TestEntity Revert(V2TestEntity to)
{
var result = new V1TestEntity { Metadata = to.Metadata };
result.Spec.Name = $"{to.Spec.Firstname} {to.Spec.Lastname}";
return result;
}
}
The conversion logic is implemented in the IEntityConverter
interface.
Each converter has a "convert" (from → to) and a "revert" (to → from) method.
[ConversionWebhook(typeof(V2TestEntity))]
public class TestConversionWebhook : ConversionWebhook<V2TestEntity>
{
protected override IEnumerable<IEntityConverter<V2TestEntity>> Converters => new IEntityConverter<V2TestEntity>[]
{
new V1ToV2(), // other versions...
};
}
The webhook the registers the list of possible converters and calls the converter upon request.
[!NOTE] There needs to be a conversion between ALL versions to the stored version (newest version). If there is no conversion, the webhook will fail and the resource is not stored. So if there exist a v1, v2, and v3, there needs to be a converter for v1 → v3 and v2 → v3 (when v3 is the stored version).
Installing In The Cluster
When creating an operator with webhooks, certain special resources must be provided
to run in the cluster. When this package is referenced and KubeOps.Cli is installed,
these resources should be generated automatically. Basically, instead of
generating a dockerfile with dotnet:runtime
as final image, you'll need
dotnet:aspnet
and the operator needs a service and the certificates
for the HTTPS connection since webhooks only operate over HTTPS.
With the KubeOps.Cli package you can generate the required resources or let the customized Build targets do it for you.
The targets create a CA certificate and a server certificate (with respective keys), a service, and the webhook registrations required for you.
[!WARNING] The generated certificate has a validity of 5 years. After that time, the certificate needs to be renewed. For now, there is no automatic renewal process.
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net6.0 is compatible. net6.0-android was computed. net6.0-ios was computed. net6.0-maccatalyst was computed. net6.0-macos was computed. net6.0-tvos was computed. net6.0-windows was computed. net7.0 is compatible. net7.0-android was computed. net7.0-ios was computed. net7.0-maccatalyst was computed. net7.0-macos was computed. net7.0-tvos was computed. net7.0-windows was computed. net8.0 is compatible. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. |
-
net6.0
- KubeOps.Operator (>= 8.0.0)
- Localtunnel (>= 2.0.0-preview.1)
- SystemTextJson.JsonDiffPatch (>= 1.3.1)
-
net7.0
- KubeOps.Operator (>= 8.0.0)
- Localtunnel (>= 2.0.0-preview.1)
- SystemTextJson.JsonDiffPatch (>= 1.3.1)
-
net8.0
- KubeOps.Operator (>= 8.0.0)
- Localtunnel (>= 2.0.0-preview.1)
- SystemTextJson.JsonDiffPatch (>= 1.3.1)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
Version | Downloads | Last updated |
---|---|---|
9.1.5 | 7,323 | 9/10/2024 |
9.1.4 | 503 | 8/26/2024 |
9.1.3 | 5,037 | 6/28/2024 |
9.1.2 | 2,231 | 6/20/2024 |
9.1.1 | 2,299 | 5/22/2024 |
9.1.0 | 1,773 | 5/15/2024 |
9.0.2 | 108 | 5/13/2024 |
9.0.0 | 5,527 | 3/13/2024 |
9.0.0-pre.4 | 58 | 4/19/2024 |
9.0.0-pre.3 | 56 | 3/21/2024 |
9.0.0-pre.2 | 58 | 3/13/2024 |
9.0.0-pre.1 | 72 | 3/7/2024 |
8.0.2-pre.2 | 68 | 2/21/2024 |
8.0.2-pre.1 | 48 | 2/19/2024 |
8.0.1 | 3,974 | 2/13/2024 |
8.0.1-pre.7 | 70 | 2/12/2024 |
8.0.1-pre.6 | 67 | 2/7/2024 |
8.0.1-pre.5 | 74 | 2/5/2024 |
8.0.1-pre.4 | 59 | 1/31/2024 |
8.0.1-pre.3 | 60 | 1/26/2024 |
8.0.1-pre.2 | 55 | 1/25/2024 |
8.0.1-pre.1 | 66 | 1/18/2024 |
8.0.0 | 381 | 1/17/2024 |
8.0.0-pre.45 | 54 | 1/17/2024 |
8.0.0-pre.44 | 72 | 1/16/2024 |
8.0.0-pre.43 | 62 | 1/16/2024 |
8.0.0-pre.42 | 196 | 1/10/2024 |
8.0.0-pre.41 | 140 | 1/2/2024 |
8.0.0-pre.40 | 119 | 12/27/2023 |
8.0.0-pre.39 | 70 | 12/21/2023 |
8.0.0-pre.38 | 156 | 12/6/2023 |
8.0.0-pre.37 | 63 | 12/6/2023 |
8.0.0-pre.36 | 68 | 12/3/2023 |
8.0.0-pre.35 | 70 | 11/28/2023 |
8.0.0-pre.34 | 94 | 11/24/2023 |
8.0.0-pre.33 | 66 | 11/24/2023 |
8.0.0-pre.32 | 56 | 11/23/2023 |
8.0.0-pre.31 | 72 | 11/23/2023 |
8.0.0-pre.30 | 64 | 11/23/2023 |
8.0.0-pre.29 | 152 | 11/11/2023 |
8.0.0-pre.28 | 68 | 11/8/2023 |
8.0.0-pre.27 | 168 | 10/23/2023 |
8.0.0-pre.26 | 77 | 10/19/2023 |
8.0.0-pre.25 | 67 | 10/18/2023 |
8.0.0-pre.24 | 81 | 10/13/2023 |
8.0.0-pre.23 | 73 | 10/13/2023 |
8.0.0-pre.22 | 78 | 10/13/2023 |
8.0.0-pre.21 | 69 | 10/12/2023 |
8.0.0-pre.20 | 74 | 10/11/2023 |
8.0.0-pre.19 | 73 | 10/9/2023 |
8.0.0-pre.18 | 71 | 10/9/2023 |
8.0.0-pre.17 | 75 | 10/7/2023 |
8.0.0-pre.16 | 72 | 10/6/2023 |
8.0.0-pre.15 | 73 | 10/6/2023 |
8.0.0-pre.14 | 72 | 10/5/2023 |
8.0.0-pre.13 | 62 | 10/5/2023 |
8.0.0-pre.12 | 66 | 10/4/2023 |
8.0.0-pre.11 | 65 | 10/3/2023 |
8.0.0-pre.10 | 73 | 10/3/2023 |
8.0.0-pre.9 | 76 | 10/3/2023 |
8.0.0-pre.8 | 72 | 10/2/2023 |
8.0.0-pre.7 | 70 | 10/2/2023 |
8.0.0-pre.6 | 78 | 9/29/2023 |
8.0.0-pre.5 | 73 | 9/28/2023 |
8.0.0-pre.4 | 69 | 9/28/2023 |
8.0.0-pre.3 | 68 | 9/27/2023 |
8.0.0-pre.2 | 52 | 9/26/2023 |
8.0.0-pre.1 | 71 | 9/22/2023 |
'# [8.0.0](https://github.com/buehler/dotnet-operator-sdk/compare/v7.6.1...v8.0.0) (2024-01-17)
### Bug Fixes
* add entity UID into event name to generate relation. ([8c1848f](https://github.com/buehler/dotnet-operator-sdk/commit/8c1848fb2a7f813bd1ff0ad1b0c8d12977acb264)), closes [#681](https://github.com/buehler/dotnet-operator-sdk/issues/681)
* allow the CLI to be used in NET6 and NET7 ([0b4aa96](https://github.com/buehler/dotnet-operator-sdk/commit/0b4aa969033f73115c54ad54d6f803189bb8effe))
* **cli:** readd c# support. ([a508b12](https://github.com/buehler/dotnet-operator-sdk/commit/a508b128b3c81ab1363b3aa4a68263d7019e7b4b))
* correct dependency ([7768870](https://github.com/buehler/dotnet-operator-sdk/commit/7768870b85a8242029572ffff86dee013d71ee16))
* **deps:** update dependencies to v0.48.0 ([#667](https://github.com/buehler/dotnet-operator-sdk/issues/667)) ([270cb94](https://github.com/buehler/dotnet-operator-sdk/commit/270cb94621c1275ce3889c04e90dbf06777fedac))
* **deps:** update dependency roslynator.analyzers to v4.6.0 ([8430f7a](https://github.com/buehler/dotnet-operator-sdk/commit/8430f7ae80b46582b8f6216a2ca20d821b572724))
* **deps:** update dependency roslynator.analyzers to v4.6.1 ([c5b1ccf](https://github.com/buehler/dotnet-operator-sdk/commit/c5b1ccf58790a002d792e5bb6e0852620ddadc39))
* **deps:** update dependency roslynator.analyzers to v4.6.2 ([b6ffb31](https://github.com/buehler/dotnet-operator-sdk/commit/b6ffb311cec1070cba47bf92f5646f4119ca11c2))
* **deps:** update dependency roslynator.analyzers to v4.6.4 ([4c802d6](https://github.com/buehler/dotnet-operator-sdk/commit/4c802d6cfa4c7841f7b2c7d7bd8e7428e195de2a))
* **deps:** update dependency roslynator.analyzers to v4.7.0 ([c0a78f5](https://github.com/buehler/dotnet-operator-sdk/commit/c0a78f51e3edb9f44800d9c1ef988f99ed0a15b4))
* **deps:** update dependency roslynator.analyzers to v4.8.0 ([93c562e](https://github.com/buehler/dotnet-operator-sdk/commit/93c562ee27dc295b43819dca80f2ab50764b2a43))
* **deps:** update dependency roslynator.analyzers to v4.9.0 ([db38a6a](https://github.com/buehler/dotnet-operator-sdk/commit/db38a6a63745cf9f19dcd6df7d30702f3ceced53))
* **deps:** update dependency sonaranalyzer.csharp to v9.12.0.78982 ([c3c2443](https://github.com/buehler/dotnet-operator-sdk/commit/c3c2443a389a2f8a300831d2d5200a857f180fc7))
* **deps:** update dependency sonaranalyzer.csharp to v9.14.0.81108 ([c64c094](https://github.com/buehler/dotnet-operator-sdk/commit/c64c094585352a1526448cf5b046b4775b3b7691))
* **deps:** update dependency sonaranalyzer.csharp to v9.15.0.81779 ([fceda09](https://github.com/buehler/dotnet-operator-sdk/commit/fceda094ff20540af37b74ddb71a9b3233c28fab))
* **deps:** update dependency sonaranalyzer.csharp to v9.16.0.82469 ([14ddb86](https://github.com/buehler/dotnet-operator-sdk/commit/14ddb8630052286b610ad92df02caad5c9aee401))
* **generator:** correctly build nuget package ([f9f14d8](https://github.com/buehler/dotnet-operator-sdk/commit/f9f14d8c14a1fb177b61d3275f2bd1249b23ab6c))
* include build output in generator package ([014a7a4](https://github.com/buehler/dotnet-operator-sdk/commit/014a7a4b8d63c7377a2fb27bc5f1371f34a2c475))
* make JsonDiffer thread safe ([#683](https://github.com/buehler/dotnet-operator-sdk/issues/683)) ([5379ee3](https://github.com/buehler/dotnet-operator-sdk/commit/5379ee3de13705ece8a3d30f8831ca21ce734de0))
* **rbac:** do not mix apigroups. ([0b8cbab](https://github.com/buehler/dotnet-operator-sdk/commit/0b8cbab6057ee5233fd9c6bee8df8f5aaa11a6d8)), closes [#583](https://github.com/buehler/dotnet-operator-sdk/issues/583)
* ToExpression(this IEnumerable<LabelSelector> selectors) extension method returns wrong result ([d13cadf](https://github.com/buehler/dotnet-operator-sdk/commit/d13cadf281b229329ded43f67af1d52a666388d5))
* Transpiler inconsistencies for CRDs ([#688](https://github.com/buehler/dotnet-operator-sdk/issues/688)) ([39f5a29](https://github.com/buehler/dotnet-operator-sdk/commit/39f5a29cf7dc3711077a2f3bd2d6682f8322e405))
* use correct targets file ([5b934d0](https://github.com/buehler/dotnet-operator-sdk/commit/5b934d069d2b30caac080f41f2dd91fb37c3b807))
* use get instead of list in kubernetes client. ([83c9210](https://github.com/buehler/dotnet-operator-sdk/commit/83c9210e142486e1da226876f728d4a4d4d6e86c)), closes [#647](https://github.com/buehler/dotnet-operator-sdk/issues/647)
* use resource version in watcher to get newest events from API. ([dd94ff8](https://github.com/buehler/dotnet-operator-sdk/commit/dd94ff8faa0aced6862470d9a78fdac080e2c151)), closes [#675](https://github.com/buehler/dotnet-operator-sdk/issues/675)
### Code Refactoring
* CLI Argument parsing ([#615](https://github.com/buehler/dotnet-operator-sdk/issues/615)) ([02576f4](https://github.com/buehler/dotnet-operator-sdk/commit/02576f44d1b4a214d22cfd87ffa3e4cf5b6be76d))
* **finalizer:** Rework finalizer in controllers ([#625](https://github.com/buehler/dotnet-operator-sdk/issues/625)) ([5e39484](https://github.com/buehler/dotnet-operator-sdk/commit/5e394841aea8325e0bd4237e7a60bd415706af37))
* **operator:** rework event publishing ([#626](https://github.com/buehler/dotnet-operator-sdk/issues/626)) ([d99c7ba](https://github.com/buehler/dotnet-operator-sdk/commit/d99c7ba7259aaa19c22339e7e0c49b0ff8279b1d))
* Split Operator in several packages ([#605](https://github.com/buehler/dotnet-operator-sdk/issues/605)) ([e706f3a](https://github.com/buehler/dotnet-operator-sdk/commit/e706f3a19793f9be9f5ca0da08ce2b1731106da2))
* Transpilation and conversion of objects ([#614](https://github.com/buehler/dotnet-operator-sdk/issues/614)) ([e17cd8c](https://github.com/buehler/dotnet-operator-sdk/commit/e17cd8c1aaa5bf4736e9249121adbb3bab8a8187))
### Features
* **abstractions:** add custom kubernetes entity helper ([c62619f](https://github.com/buehler/dotnet-operator-sdk/commit/c62619fa4d2996fda991b687606e64b70692d0cc))
* add .net8 and allow .net6 in generator ([#670](https://github.com/buehler/dotnet-operator-sdk/issues/670)) ([ec43825](https://github.com/buehler/dotnet-operator-sdk/commit/ec43825c0957e163a17637e89e15d4c61c6c9edc)), closes [#641](https://github.com/buehler/dotnet-operator-sdk/issues/641) [#659](https://github.com/buehler/dotnet-operator-sdk/issues/659) [#633](https://github.com/buehler/dotnet-operator-sdk/issues/633)
* add runtime generated entity clients ([3b48147](https://github.com/buehler/dotnet-operator-sdk/commit/3b481478176eb05e22fd1a4fb7e4cf6734be05e9))
* **cli:** add certificate generator command ([#620](https://github.com/buehler/dotnet-operator-sdk/issues/620)) ([895a8d0](https://github.com/buehler/dotnet-operator-sdk/commit/895a8d012190396a08a172b5fd7350b31eedcb20))
* **cli:** add generate docker file command and optimize it ([fb06960](https://github.com/buehler/dotnet-operator-sdk/commit/fb06960f40cfd1c1779727c91e59333cf31b589b))
* **cli:** add generate operator command ([407d01a](https://github.com/buehler/dotnet-operator-sdk/commit/407d01a558bfc539076bbba61ed0f831ef39f1c2))
* **cli:** add operator role and role binding for rbac ([9a8c28c](https://github.com/buehler/dotnet-operator-sdk/commit/9a8c28c9a854a86a1cfdb6004a618ec3ce73eadd))
* **client:** add async/sync variants ([44df7e3](https://github.com/buehler/dotnet-operator-sdk/commit/44df7e3f9ca3939673ccbef1b4a426a35cb05e92))
* **client:** add create, update, delete methods for enumerable entities ([88cc35f](https://github.com/buehler/dotnet-operator-sdk/commit/88cc35f5d362251d5e5ec57718eabcd00433edd0))
* **client:** Add Kubernetes Client package ([0629746](https://github.com/buehler/dotnet-operator-sdk/commit/06297464bb721b17a3dfd220098074eb0f1965eb))
* **client:** Use true generics again ([#640](https://github.com/buehler/dotnet-operator-sdk/issues/640)) ([2154240](https://github.com/buehler/dotnet-operator-sdk/commit/2154240bd498d626e3605a5f65e7ca6055dd9831))
* **cli:** management install/uninstall commands ([#618](https://github.com/buehler/dotnet-operator-sdk/issues/618)) ([03cd894](https://github.com/buehler/dotnet-operator-sdk/commit/03cd894951e4726a29716d40e49cc1d126a07fee))
* **generator:** add controller registrations ([#623](https://github.com/buehler/dotnet-operator-sdk/issues/623)) ([1697d26](https://github.com/buehler/dotnet-operator-sdk/commit/1697d2616d21a7a0a94dd10f62e9890ce8415bf8))
* **generator:** generate entity initializer (static and partial) ([77458b6](https://github.com/buehler/dotnet-operator-sdk/commit/77458b60f95f14e18091af2ee8bbd52b4776b50d))
* **operator:** add better error handling and reconnection logic ([318541c](https://github.com/buehler/dotnet-operator-sdk/commit/318541c7d83184efb5988ad137b9eb564515cbbb))
* **operator:** add build targets extension for automatic resource generation ([7df5d48](https://github.com/buehler/dotnet-operator-sdk/commit/7df5d48dd345f1b6231817cffee15b51163bfc9d))
* **operator:** add leader election via KubernetesClient ([#627](https://github.com/buehler/dotnet-operator-sdk/issues/627)) ([d07ad0d](https://github.com/buehler/dotnet-operator-sdk/commit/d07ad0daa25fc31783fe6b96916137c8523494fe))
* **operator:** add namespaced operators ([b967f37](https://github.com/buehler/dotnet-operator-sdk/commit/b967f37bed582797490125c52d0f22d930534f3c))
* **operator:** register kubernetes client as transient ([154ba67](https://github.com/buehler/dotnet-operator-sdk/commit/154ba6774f5a4bad1448d866b7f808ba12eefc34))
* **operator:** reworked entity requeue logic ([3f6b862](https://github.com/buehler/dotnet-operator-sdk/commit/3f6b862e310fdf02254aadf9b1d15436572b4695))
* **transpiler:** allow metadata to be created from actual types. ([ef91bd1](https://github.com/buehler/dotnet-operator-sdk/commit/ef91bd17d6bc5725748f7d818a8624da66e8d6e4))
* upgrade KubernetesClient ([6896435](https://github.com/buehler/dotnet-operator-sdk/commit/6896435a6ee071ed42a5ef86f8dea6339a92625d))
* **web operator:** add localtunnel feature for easy webhook development. ([dbb3f85](https://github.com/buehler/dotnet-operator-sdk/commit/dbb3f858fc4cb5c12b5c2c9e58f9161b9645a803))
* **web-operator:** add conversion webhooks ([#639](https://github.com/buehler/dotnet-operator-sdk/issues/639)) ([6383a15](https://github.com/buehler/dotnet-operator-sdk/commit/6383a156a6ea8d0a6b67a84573554903694faf99)), closes [#137](https://github.com/buehler/dotnet-operator-sdk/issues/137)
* **web-operator:** Add validation webhooks. ([#631](https://github.com/buehler/dotnet-operator-sdk/issues/631)) ([92af569](https://github.com/buehler/dotnet-operator-sdk/commit/92af56992484806323d3963ee8a083d5807e7097))
* **webhook-generator:** add mutation webhook configs. ([c1e82d6](https://github.com/buehler/dotnet-operator-sdk/commit/c1e82d6be7d8585e443007e3e91b54f655788362))
* **webhook-generator:** only use operations that are overwritten. ([ad1e7ae](https://github.com/buehler/dotnet-operator-sdk/commit/ad1e7ae1db9b22f3f668cb699fc5bdb74e1cf383))
* **webhooks:** add mutation webhooks. ([5441d1e](https://github.com/buehler/dotnet-operator-sdk/commit/5441d1e75f9db34f686b940e1a68c7f12f686d60))
* **webhooks:** automatic installer generation for webhook operators ([#632](https://github.com/buehler/dotnet-operator-sdk/issues/632)) ([6ce343d](https://github.com/buehler/dotnet-operator-sdk/commit/6ce343d4117cc4a056e9709d8d9e2f37d317dd66))
### BREAKING CHANGES
* **web-operator:** The CLI (which broke anyway...) does now
generate everyting together and determines based on the
project if there are webhooks or not. This results in one
config folder instead of separate folders for CRD, RBAC, etc.
With this, conversion webhooks can inject their configuration
into the CRDs. Otherwise, this would be a cumbersome process.
If the need for single topic generation arises again (for example only CRDs),
then these generators can be added again.
* **webhooks:** This overhauls the mutation webhooks.
Use the documentation to see how they work.
It is similar to validation webhooks, but with
changed results.
Signed-off-by: Christoph Bühler <cbuehler@rootd.ch>
* **webhooks:** Webhooks are not generated
via the custom command for webhooks, nor are they
automatically installed at runtime. For now, webhook
definitions, certificates, and services are created
at buildtime.
* **webhooks:** This removes the runtime exeuction
of the webhook registrar magic.
* **web-operator:** 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.
* **operator:** The targets file contains
other properties than before. Refer to the
documentation for explicit details.
* **operator:** the `IEventManager` is not part
of the operator anymore. To publish events, inject the
`EventPublisher` delegate and use it to publish
events on entities with reason and message.
The name of the events are not base32 encoded but
hex encoded sha512 values now.
* **operator:** controllers do not have
return values anymore. To requeue an entity,
use the `EntityRequeue<_>` delegate. When
an entity is requeued, the reconcile loop
is called after the timeout. If - during this
timeout - the entity is modified or deleted,
the timeout will be cancelled.
* **client:** all calls that were
async before are now sync. There are
async variants of all calls with the
Async suffix.
Signed-off-by: Christoph Bühler <cbuehler@rootd.ch>
* **finalizer:** Finalizers are registered
with an identifier now. The identifier is
generated by the KubeOps.Generator when used.
Finalizers are attached via EntityFinalizerAttacher<>
delegates that attach the finalizer to an entity.
* **client:** The IKubernetesClient interface
and implementation now require the TEntity typeparam
instead of each method providing one. The implementation
is instanced with EntityMetadata to allow the operator
to inject the clients for each entity.
* **cli:** This allows the operator
to create a valid selfsigned CA and server
certificate ad-hoc in the cluster when using
webhooks. Instead of generating the certificates
locally and using them as config-map in kustomize,
the operator can run the cli to generate the service
certificate.
* **cli:** The install / uninstall commands
now search for a project or solution file to parse the
CRDs from a solution or a project.
* generator commands
may define a csproj or sln file on where the
entities or other elements are located.
If no file is provided, the current directory
is searched and the command fails if none is found.
* This removes the entity and rbac conversion
from the operator package and extracts them into their own
`KubeOps.Transpiler` package. All static methods there
are used for transpilation of the entities and rbac attributes.
Additional logic for Lease, events and such will reside
in the CLI.
* This removes several features from the
7.x version. Required / missing features will
be added to the v8 again. As for the first
pre release, only the simple watcher and
reconciliation loop is present. No finalizer, events, leadership,
whatsoever is present in the library. The initial pre.0
release is meant to be the base for further implementations.
V8 will - hopefully - contain all required features again.
* The operator does not have commands
and command line executions packaged into the library.
A new dotnet tool is required for CRD generation and
other generators.
* All abstractions are extracted into
a KubeOps.Abstractions package.
* The operator is not required to have
ASP.net as default, it works with a normal console
host application as well.
* `master` is renamed to `main` and
maintenance and release branches are added.
'