|
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
using YamlDotNet.Serialization;
namespace Aspire.Hosting.Kubernetes.Resources;
/// <summary>
/// Defines the specification for a Kubernetes ReplicaSet.
/// </summary>
/// <remarks>
/// A ReplicaSet ensures that a specified number of pod replicas are running at any given time.
/// This specification provides the desired state for a ReplicaSet, including pod templates, replica count, and label selectors.
/// </remarks>
[YamlSerializable]
public sealed class ReplicaSetSpecV1
{
/// <summary>
/// Gets or sets the template that defines the specification of the pods to be created.
/// </summary>
/// <remarks>
/// The template is a PodTemplateSpec object that includes the pod-specific metadata and desired state configuration.
/// It is used to define the settings for pods generated by the ReplicaSet.
/// </remarks>
[YamlMember(Alias = "template")]
public PodTemplateSpecV1 Template { get; set; } = new();
/// <summary>
/// Gets or sets the label selector for this ReplicaSet specification.
/// This selector is used to identify and target which set of Pods the ReplicaSet will manage.
/// </summary>
/// <remarks>
/// The selector contains criteria for filtering resources based on their labels. It may include:
/// - MatchLabels: Specifies the labels that must explicitly match.
/// - MatchExpressions: Allows defining complex rules for label matching.
/// Both components can be used together to create comprehensive selection criteria.
/// </remarks>
[YamlMember(Alias = "selector")]
public LabelSelectorV1 Selector { get; set; } = new();
/// <summary>
/// Specifies the minimum time, in seconds, a pod should remain in the Ready state before it is considered available.
/// </summary>
/// <remarks>
/// This property is used to define a stabilization period for newly created pods in a ReplicaSet.
/// Pods must remain in the Ready state for at least the specified number of seconds before being considered available for scaling decisions or readiness.
/// A value of null or 0 indicates no stabilization period is required.
/// </remarks>
[YamlMember(Alias = "minReadySeconds")]
public int? MinReadySeconds { get; set; }
/// <summary>
/// Gets or sets the desired number of replicas for the ReplicaSet.
/// </summary>
/// <remarks>
/// This property specifies the number of pod replicas that should be maintained by the ReplicaSet.
/// If not specified, the default value is determined by the Kubernetes control plane.
/// </remarks>
[YamlMember(Alias = "replicas")]
public int? Replicas { get; set; }
}
|