forked from man-group/dapr-sidekick-dotnet
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDaprPlacementOptions.cs
97 lines (80 loc) · 3.31 KB
/
DaprPlacementOptions.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
using System;
namespace Man.Dapr.Sidekick
{
public class DaprPlacementOptions : Options.DaprProcessOptions
{
/// <summary>
/// Gets or sets the path to the credentials directory holding the issuer data.
/// If not specified this will default to a directory called "certs" under the runtime folder.
/// </summary>
public string CertsDirectory { get; set; }
/// <summary>
/// Gets or sets custom arguments for the process. These will be appended "as-is" after all other arguments specified through these options.
/// </summary>
public string CustomArguments { get; set; }
/// <summary>
/// Gets or sets a value that determines if Prometheus metrics are enabled in the Placement service (default true).
/// </summary>
public bool? EnableMetrics { get; set; }
/// <summary>
/// Gets or sets the HTTP port for the health server (default 8081).
/// </summary>
public int? HealthPort { get; set; }
/// <summary>
/// Gets or sets the placement server ID (default "dapr-placement-0").
/// </summary>
public string Id { get; set; }
/// <summary>
/// Gets or sets the raft cluster peers (default "dapr-placement-0=127.0.0.1:8201").
/// </summary>
public string InitialCluster { get; set; }
/// <summary>
/// Gets or sets a value that determines if in-memory log and snapshot store is enabled, unless raft-logstore-path is set (default true).
/// </summary>
public bool? InmemStoreEnabled { get; set; }
/// <summary>
/// Gets or sets the port for the metrics server (default 9091).
/// </summary>
public int? MetricsPort { get; set; }
/// <summary>
/// Gets or sets a value that determines if TLS should be enabled for the placement gRPC server.
/// </summary>
public bool? Mtls { get; set; }
/// <summary>
/// Gets or sets the gRPC port for the placement service (defaults to 6050 on Windows and 50005 on other platforms).
/// </summary>
public int? Port { get; set; }
/// <summary>
/// Gets or sets the path to the raft log store.
/// </summary>
public string RaftLogstorePath { get; set; }
/// <summary>
/// Gets or sets the replication factor for actor distribution on vnodes (default 100).
/// </summary>
public int? ReplicationFactor { get; set; }
/// <summary>
/// Creates a deep clone of this instance.
/// </summary>
/// <returns>A deep clone of this insteance.</returns>
public new DaprPlacementOptions Clone() => (DaprPlacementOptions)base.Clone();
protected override bool AddHealthUri(UriBuilder builder)
{
if (!HealthPort.HasValue)
{
return false;
}
builder.Port = HealthPort.Value;
builder.Path = "healthz";
return true;
}
protected override bool AddMetricsUri(UriBuilder builder)
{
if (!MetricsPort.HasValue || EnableMetrics == false)
{
return false;
}
builder.Port = MetricsPort.Value;
return true;
}
}
}