Skip to content

Commit

Permalink
Unused Partition, Circuit Breaker, and Quota Options removed (microso…
Browse files Browse the repository at this point in the history
…ft#581)

Unused Partition, Circuit Breaker, and Quota Options removed.
  • Loading branch information
alnikola authored Nov 27, 2020
1 parent c81cf0b commit 5291514
Show file tree
Hide file tree
Showing 13 changed files with 2 additions and 612 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
using System.Linq;
using System.Text.RegularExpressions;
using Microsoft.ReverseProxy.Abstractions;
using Microsoft.ReverseProxy.ServiceFabric.Utilities;

namespace Microsoft.ReverseProxy.ServiceFabric
{
Expand All @@ -19,13 +18,6 @@ internal static class LabelsParser
{
// TODO: decide which labels are needed and which default table (and to what values)
// Also probably move these defaults to the corresponding config entities.
internal static readonly int DefaultCircuitbreakerMaxConcurrentRequests = 0;
internal static readonly int DefaultCircuitbreakerMaxConcurrentRetries = 0;
internal static readonly double DefaultQuotaAverage = 0;
internal static readonly double DefaultQuotaBurst = 0;
internal static readonly int DefaultPartitionCount = 0;
internal static readonly string DefaultPartitionKeyExtractor = null;
internal static readonly string DefaultPartitioningAlgorithm = "SHA256";
internal static readonly int? DefaultRouteOrder = null;

private static readonly Regex _allowedRouteNamesRegex = new Regex("^[a-zA-Z0-9_-]+$");
Expand Down

This file was deleted.

21 changes: 0 additions & 21 deletions src/ReverseProxy/Abstractions/ClusterDiscovery/Contract/Cluster.cs
Original file line number Diff line number Diff line change
Expand Up @@ -20,21 +20,6 @@ public sealed class Cluster : IDeepCloneable<Cluster>
/// </summary>
public string Id { get; set; }

/// <summary>
/// Circuit breaker options.
/// </summary>
public CircuitBreakerOptions CircuitBreaker { get; set; }

/// <summary>
/// Quota options.
/// </summary>
public QuotaOptions Quota { get; set; }

/// <summary>
/// Partitioning options.
/// </summary>
public ClusterPartitioningOptions Partitioning { get; set; }

/// <summary>
/// Load balancing options.
/// </summary>
Expand Down Expand Up @@ -76,9 +61,6 @@ Cluster IDeepCloneable<Cluster>.DeepClone()
return new Cluster
{
Id = Id,
CircuitBreaker = CircuitBreaker?.DeepClone(),
Quota = Quota?.DeepClone(),
Partitioning = Partitioning?.DeepClone(),
LoadBalancing = LoadBalancing?.DeepClone(),
SessionAffinity = SessionAffinity?.DeepClone(),
HealthCheck = HealthCheck?.DeepClone(),
Expand All @@ -102,9 +84,6 @@ internal static bool Equals(Cluster cluster1, Cluster cluster2)
}

return string.Equals(cluster1.Id, cluster2.Id, StringComparison.OrdinalIgnoreCase)
&& CircuitBreakerOptions.Equals(cluster1.CircuitBreaker, cluster2.CircuitBreaker)
&& QuotaOptions.Equals(cluster1.Quota, cluster2.Quota)
&& ClusterPartitioningOptions.Equals(cluster1.Partitioning, cluster2.Partitioning)
&& LoadBalancingOptions.Equals(cluster1.LoadBalancing, cluster2.LoadBalancing)
&& SessionAffinityOptions.Equals(cluster1.SessionAffinity, cluster2.SessionAffinity)
&& HealthCheckOptions.Equals(cluster1.HealthCheck, cluster2.HealthCheck)
Expand Down

This file was deleted.

This file was deleted.

46 changes: 0 additions & 46 deletions src/ReverseProxy/Configuration/ConfigurationConfigProvider.cs
Original file line number Diff line number Diff line change
Expand Up @@ -146,9 +146,6 @@ private Cluster CreateCluster(IConfigurationSection section)
var cluster = new Cluster
{
Id = section.Key,
CircuitBreaker = CreateCircuitBreakerOptions(section.GetSection(nameof(Cluster.CircuitBreaker))),
Quota = CreateQuotaOptions(section.GetSection(nameof(Cluster.Quota))),
Partitioning = CreateClusterPartitioningOptions(section.GetSection(nameof(Cluster.Partitioning))),
LoadBalancing = CreateLoadBalancingOptions(section.GetSection(nameof(Cluster.LoadBalancing))),
SessionAffinity = CreateSessionAffinityOptions(section.GetSection(nameof(Cluster.SessionAffinity))),
HealthCheck = CreateHealthCheckOptions(section.GetSection(nameof(Cluster.HealthCheck))),
Expand Down Expand Up @@ -227,49 +224,6 @@ private static RouteHeader CreateRouteHeader(IConfigurationSection section)
return routeHeader;
}

private static CircuitBreakerOptions CreateCircuitBreakerOptions(IConfigurationSection section)
{
if (!section.Exists())
{
return null;
}

return new CircuitBreakerOptions
{
MaxConcurrentRequests = section.ReadInt32(nameof(CircuitBreakerOptions.MaxConcurrentRequests)) ?? 0,
MaxConcurrentRetries = section.ReadInt32(nameof(CircuitBreakerOptions.MaxConcurrentRetries)) ?? 0,
};
}

private static QuotaOptions CreateQuotaOptions(IConfigurationSection section)
{
if (!section.Exists())
{
return null;
}

return new QuotaOptions
{
Average = section.ReadDouble(nameof(QuotaOptions.Average)) ?? 0,
Burst = section.ReadDouble(nameof(QuotaOptions.Burst)) ?? 0,
};
}

private static ClusterPartitioningOptions CreateClusterPartitioningOptions(IConfigurationSection section)
{
if (!section.Exists())
{
return null;
}

return new ClusterPartitioningOptions
{
PartitionCount = section.ReadInt32(nameof(ClusterPartitioningOptions.PartitionCount)) ?? 0,
PartitionKeyExtractor = section[nameof(ClusterPartitioningOptions.PartitionKeyExtractor)],
PartitioningAlgorithm = section[nameof(ClusterPartitioningOptions.PartitioningAlgorithm)],
};
}

private static LoadBalancingOptions CreateLoadBalancingOptions(IConfigurationSection section)
{
if (!section.Exists())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,13 +58,6 @@ internal static Dictionary<string, string> DummyLabels(string backendId, bool en
{
{ "YARP.Enable", enableGateway ? "true" : "false" },
{ "YARP.Backend.BackendId", backendId },
{ "YARP.Backend.CircuitBreaker.MaxConcurrentRequests", "42" },
{ "YARP.Backend.CircuitBreaker.MaxConcurrentRetries", "5" },
{ "YARP.Backend.Quota.Average", "1.2" },
{ "YARP.Backend.Quota.Burst", "2.3" },
{ "YARP.Backend.Partitioning.Count", "5" },
{ "YARP.Backend.Partitioning.KeyExtractor", "Header('x-ms-organization-id')" },
{ "YARP.Backend.Partitioning.Algorithm", "SHA256" },
{ "YARP.Backend.Healthcheck.Active.Enabled", activeHealthChecks ? "true" : "false" },
{ "YARP.Backend.Healthcheck.Active.Interval", "5" },
{ "YARP.Backend.Healthcheck.Active.Timeout", "5" },
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,13 +22,6 @@ public void BuildCluster_CompleteLabels_Works()
{
{ "YARP.Enable", "true" },
{ "YARP.Backend.BackendId", "MyCoolClusterId" },
{ "YARP.Backend.CircuitBreaker.MaxConcurrentRequests", "42" },
{ "YARP.Backend.CircuitBreaker.MaxConcurrentRetries", "5" },
{ "YARP.Backend.Quota.Average", "1.2" },
{ "YARP.Backend.Quota.Burst", "2.3" },
{ "YARP.Backend.Partitioning.Count", "5" },
{ "YARP.Backend.Partitioning.KeyExtractor", "Header('x-ms-organization-id')" },
{ "YARP.Backend.Partitioning.Algorithm", "SHA256" },
{ "YARP.Backend.Healthcheck.Active.Enabled", "true" },
{ "YARP.Backend.Healthcheck.Active.Interval", "5" },
{ "YARP.Backend.Healthcheck.Active.Timeout", "5" },
Expand Down
Loading

0 comments on commit 5291514

Please sign in to comment.