-
-
Notifications
You must be signed in to change notification settings - Fork 65
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
14 changed files
with
869 additions
and
869 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,13 @@ | ||
using KubeOps.Abstractions.Finalizer; | ||
|
||
using Operator.Entities; | ||
|
||
namespace Operator.Finalizer; | ||
|
||
public class FinalizerOne : IEntityFinalizer<V1TestEntity> | ||
{ | ||
public Task FinalizeAsync(V1TestEntity entity) | ||
{ | ||
return Task.CompletedTask; | ||
} | ||
} | ||
using KubeOps.Abstractions.Finalizer; | ||
|
||
using Operator.Entities; | ||
|
||
namespace Operator.Finalizer; | ||
|
||
public class FinalizerOne : IEntityFinalizer<V1TestEntity> | ||
{ | ||
public Task FinalizeAsync(V1TestEntity entity) | ||
{ | ||
return Task.CompletedTask; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,13 @@ | ||
using KubeOps.Abstractions.Finalizer; | ||
|
||
using Operator.Entities; | ||
|
||
namespace Operator.Finalizer; | ||
|
||
public class FinalizerTwo : IEntityFinalizer<V1TestEntity> | ||
{ | ||
public Task FinalizeAsync(V1TestEntity entity) | ||
{ | ||
return Task.CompletedTask; | ||
} | ||
} | ||
using KubeOps.Abstractions.Finalizer; | ||
|
||
using Operator.Entities; | ||
|
||
namespace Operator.Finalizer; | ||
|
||
public class FinalizerTwo : IEntityFinalizer<V1TestEntity> | ||
{ | ||
public Task FinalizeAsync(V1TestEntity entity) | ||
{ | ||
return Task.CompletedTask; | ||
} | ||
} |
82 changes: 41 additions & 41 deletions
82
src/KubeOps.Abstractions/Finalizer/EntityFinalizerAttacher.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,41 +1,41 @@ | ||
using k8s; | ||
using k8s.Models; | ||
|
||
namespace KubeOps.Abstractions.Finalizer; | ||
|
||
/// <summary> | ||
/// <para> | ||
/// Injectable delegate for finalizers. This delegate is used to attach a finalizer | ||
/// with its identifier to an entity. When injected, simply call the delegate with | ||
/// the entity to attach the finalizer. | ||
/// </para> | ||
/// <para> | ||
/// As with other (possibly) mutating calls, use the returned entity for further | ||
/// modification and Kubernetes client interactions, since the resource version | ||
/// is updated each time the entity is modified. | ||
/// </para> | ||
/// </summary> | ||
/// <typeparam name="TImplementation">The type of the entity finalizer.</typeparam> | ||
/// <typeparam name="TEntity">The type of the Kubernetes entity.</typeparam> | ||
/// <param name="entity">The instance of the entity, that the finalizer is attached if needed.</param> | ||
/// <returns>A <see cref="Task"/> that resolves when the finalizer was attached.</returns> | ||
/// <example> | ||
/// <code> | ||
/// [EntityRbac(typeof(V1TestEntity), Verbs = RbacVerb.All)] | ||
/// public class V1TestEntityController : IEntityController<V1TestEntity> | ||
/// { | ||
/// private readonly EntityFinalizerAttacher<FinalizerOne, V1TestEntity> _finalizer1; | ||
/// | ||
/// public V1TestEntityController( | ||
/// EntityFinalizerAttacher<FinalizerOne, V1TestEntity> finalizer1) => _finalizer1 = finalizer1; | ||
/// | ||
/// public async Task ReconcileAsync(V1TestEntity entity) | ||
/// { | ||
/// entity = await _finalizer1(entity); | ||
/// } | ||
/// } | ||
/// </code> | ||
/// </example> | ||
public delegate Task<TEntity> EntityFinalizerAttacher<TImplementation, TEntity>(TEntity entity) | ||
where TImplementation : IEntityFinalizer<TEntity> | ||
where TEntity : IKubernetesObject<V1ObjectMeta>; | ||
using k8s; | ||
using k8s.Models; | ||
|
||
namespace KubeOps.Abstractions.Finalizer; | ||
|
||
/// <summary> | ||
/// <para> | ||
/// Injectable delegate for finalizers. This delegate is used to attach a finalizer | ||
/// with its identifier to an entity. When injected, simply call the delegate with | ||
/// the entity to attach the finalizer. | ||
/// </para> | ||
/// <para> | ||
/// As with other (possibly) mutating calls, use the returned entity for further | ||
/// modification and Kubernetes client interactions, since the resource version | ||
/// is updated each time the entity is modified. | ||
/// </para> | ||
/// </summary> | ||
/// <typeparam name="TImplementation">The type of the entity finalizer.</typeparam> | ||
/// <typeparam name="TEntity">The type of the Kubernetes entity.</typeparam> | ||
/// <param name="entity">The instance of the entity, that the finalizer is attached if needed.</param> | ||
/// <returns>A <see cref="Task"/> that resolves when the finalizer was attached.</returns> | ||
/// <example> | ||
/// <code> | ||
/// [EntityRbac(typeof(V1TestEntity), Verbs = RbacVerb.All)] | ||
/// public class V1TestEntityController : IEntityController<V1TestEntity> | ||
/// { | ||
/// private readonly EntityFinalizerAttacher<FinalizerOne, V1TestEntity> _finalizer1; | ||
/// | ||
/// public V1TestEntityController( | ||
/// EntityFinalizerAttacher<FinalizerOne, V1TestEntity> finalizer1) => _finalizer1 = finalizer1; | ||
/// | ||
/// public async Task ReconcileAsync(V1TestEntity entity) | ||
/// { | ||
/// entity = await _finalizer1(entity); | ||
/// } | ||
/// } | ||
/// </code> | ||
/// </example> | ||
public delegate Task<TEntity> EntityFinalizerAttacher<TImplementation, TEntity>(TEntity entity) | ||
where TImplementation : IEntityFinalizer<TEntity> | ||
where TEntity : IKubernetesObject<V1ObjectMeta>; |
38 changes: 19 additions & 19 deletions
38
src/KubeOps.Abstractions/Finalizer/IEntityFinalizer{TEntity}.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,19 +1,19 @@ | ||
using k8s; | ||
using k8s.Models; | ||
|
||
namespace KubeOps.Abstractions.Finalizer; | ||
|
||
/// <summary> | ||
/// Finalizer for an entity. | ||
/// </summary> | ||
/// <typeparam name="TEntity">The type of the entity.</typeparam> | ||
public interface IEntityFinalizer<in TEntity> | ||
where TEntity : IKubernetesObject<V1ObjectMeta> | ||
{ | ||
/// <summary> | ||
/// Finalize an entity that is pending for deletion. | ||
/// </summary> | ||
/// <param name="entity">The kubernetes entity that needs to be finalized.</param> | ||
/// <returns>A task that resolves when the operation is done.</returns> | ||
Task FinalizeAsync(TEntity entity); | ||
} | ||
using k8s; | ||
using k8s.Models; | ||
|
||
namespace KubeOps.Abstractions.Finalizer; | ||
|
||
/// <summary> | ||
/// Finalizer for an entity. | ||
/// </summary> | ||
/// <typeparam name="TEntity">The type of the entity.</typeparam> | ||
public interface IEntityFinalizer<in TEntity> | ||
where TEntity : IKubernetesObject<V1ObjectMeta> | ||
{ | ||
/// <summary> | ||
/// Finalize an entity that is pending for deletion. | ||
/// </summary> | ||
/// <param name="entity">The kubernetes entity that needs to be finalized.</param> | ||
/// <returns>A task that resolves when the operation is done.</returns> | ||
Task FinalizeAsync(TEntity entity); | ||
} |
Oops, something went wrong.