-
Notifications
You must be signed in to change notification settings - Fork 5
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
1 parent
5e2e6a1
commit 165b436
Showing
5 changed files
with
112 additions
and
1 deletion.
There are no files selected for viewing
21 changes: 21 additions & 0 deletions
21
src/Contrast.K8s.AgentOperator/Controllers/RolloutController.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 |
---|---|---|
@@ -0,0 +1,21 @@ | ||
// Contrast Security, Inc licenses this file to you under the Apache 2.0 License. | ||
// See the LICENSE file in the project root for more information. | ||
|
||
using Contrast.K8s.AgentOperator.Core.Kube; | ||
using Contrast.K8s.AgentOperator.Core.State; | ||
using Contrast.K8s.AgentOperator.Entities; | ||
using JetBrains.Annotations; | ||
using k8s.Models; | ||
using KubeOps.Operator.Controller; | ||
using KubeOps.Operator.Rbac; | ||
|
||
namespace Contrast.K8s.AgentOperator.Controllers | ||
{ | ||
//[EntityRbac(typeof(V1alpha1Rollout), Verbs = VerbConstants.ReadAndPatch), UsedImplicitly] | ||
public class RolloutController : GenericController<V1alpha1Rollout> //IResourceController<V1alpha1Rollout> | ||
{ | ||
public RolloutController(IEventStream eventStream) : base(eventStream) | ||
{ | ||
} | ||
} | ||
} |
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
34 changes: 34 additions & 0 deletions
34
src/Contrast.K8s.AgentOperator/Core/State/Appliers/RolloutApplier.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 |
---|---|---|
@@ -0,0 +1,34 @@ | ||
// Contrast Security, Inc licenses this file to you under the Apache 2.0 License. | ||
// See the LICENSE file in the project root for more information. | ||
|
||
using System.Threading; | ||
using System.Threading.Tasks; | ||
using Contrast.K8s.AgentOperator.Core.Kube; | ||
using Contrast.K8s.AgentOperator.Core.State.Resources; | ||
using Contrast.K8s.AgentOperator.Entities; | ||
using JetBrains.Annotations; | ||
using k8s.Models; | ||
using MediatR; | ||
|
||
namespace Contrast.K8s.AgentOperator.Core.State.Appliers | ||
{ | ||
[UsedImplicitly] | ||
public class RolloutApplier : BaseApplier<V1alpha1Rollout, RolloutResource> | ||
{ | ||
public RolloutApplier(IStateContainer stateContainer, IMediator mediator) : base(stateContainer, mediator) | ||
{ | ||
} | ||
|
||
public override ValueTask<RolloutResource> CreateFrom(V1alpha1Rollout entity, CancellationToken cancellationToken = default) | ||
{ | ||
var resource = new RolloutResource( | ||
entity.Uid(), | ||
entity. Metadata.GetLabels(), | ||
entity.Spec.Template.GetPod(), | ||
entity.Spec.Selector.ToPodSelector() | ||
); | ||
|
||
return ValueTask.FromResult(resource); | ||
} | ||
} | ||
} |
20 changes: 20 additions & 0 deletions
20
src/Contrast.K8s.AgentOperator/Core/State/Resources/RolloutResource.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 |
---|---|---|
@@ -0,0 +1,20 @@ | ||
// Contrast Security, Inc licenses this file to you under the Apache 2.0 License. | ||
// See the LICENSE file in the project root for more information. | ||
|
||
using System.Collections.Generic; | ||
using Contrast.K8s.AgentOperator.Core.State.Resources.Interfaces; | ||
using Contrast.K8s.AgentOperator.Core.State.Resources.Primitives; | ||
|
||
|
||
namespace Contrast.K8s.AgentOperator.Core.State.Resources | ||
{ | ||
|
||
public record RolloutResource(string Uid, | ||
IReadOnlyCollection<MetadataLabel> Labels, | ||
PodTemplate PodTemplate, | ||
PodSelector Selector) | ||
: IResourceWithPodTemplate; | ||
|
||
} | ||
|
||
|
30 changes: 30 additions & 0 deletions
30
src/Contrast.K8s.AgentOperator/Entities/V1Alpha1ArgoRollout.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 |
---|---|---|
@@ -0,0 +1,30 @@ | ||
// Contrast Security, Inc licenses this file to you under the Apache 2.0 License. | ||
// See the LICENSE file in the project root for more information. | ||
|
||
using k8s.Models; | ||
using k8s; | ||
using System.Collections.Generic; | ||
using System.Text.Json.Serialization; | ||
using KubeOps.Operator.Entities.Annotations; | ||
using KubeOps.Operator.Entities; | ||
using Contrast.K8s.AgentOperator.Core.Kube; | ||
using JetBrains.Annotations; | ||
using KubeOps.Operator.Rbac; | ||
|
||
namespace Contrast.K8s.AgentOperator.Entities | ||
{ | ||
|
||
|
||
|
||
[IgnoreEntity] | ||
[EntityRbac(typeof(V1alpha1Rollout), Verbs = VerbConstants.ReadAndPatch), UsedImplicitly] | ||
[KubernetesEntity(Group = "argoproj.io", ApiVersion = "v1alpha1", Kind = "Rollout", PluralName = "rollouts")] | ||
public class V1alpha1Rollout : CustomKubernetesEntity<V1alpha1Rollout.V1alpha1rolloutSpec> | ||
{ | ||
public class V1alpha1rolloutSpec : V1DeploymentSpec | ||
{ | ||
//public string Host { get; set; } | ||
} | ||
} | ||
|
||
} |