Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
56 commits
Select commit Hold shift + click to select a range
0d6cb04
Added connect/ca/roots endpoint, added the endpoint to IAgentEndpoint…
IvanKolchanov Jun 11, 2024
879d813
Merge branch 'master' into add-connect-ca-roots
marcin-krystianc Jun 12, 2024
f483dd4
Added more test assertions to check all the values of the new added C…
IvanKolchanov Jun 12, 2024
4e1846d
Merge branch 'add-connect-ca-roots' of https://github.com/IvanKolchan…
IvanKolchanov Jun 12, 2024
aeccb69
Added AgentVersion check for values CreateIndex, ModifyIndex and Seri…
IvanKolchanov Jun 12, 2024
d252f6e
style: fix whitespaces
octocat Jun 12, 2024
eae745b
Added PrivateKeyBits to test only if AgentVersion greater or equal th…
IvanKolchanov Jun 12, 2024
c89a375
Merge branch 'master' into add-connect-ca-roots
marcin-krystianc Jun 13, 2024
861c857
Merge branch 'master' into add-connect-ca-roots
marcin-krystianc Jun 13, 2024
bca8337
Merge pull request #1 from IvanKolchanov/add-connect-ca-roots
IvanKolchanov Jun 17, 2024
bf727b0
Added <summary> to GetCARoots, added GetCARoots with QueryOptions par…
IvanKolchanov Jun 19, 2024
07c9b31
Minor fix to GetCaRoots
IvanKolchanov Jun 19, 2024
cc328c9
Merge branch 'master' into fix-connect-ca-roots
IvanKolchanov Jun 19, 2024
ae41386
Merge pull request #2 from IvanKolchanov/fix-connect-ca-roots
IvanKolchanov Jun 19, 2024
34a3ccd
Added GetCALeaf endpoint, added tests for the endpoint in AgentTest.c…
IvanKolchanov Jun 19, 2024
67962c3
Merge branch 'master' into add-connect-ca-leaf
IvanKolchanov Jun 19, 2024
ca745f3
style: fix whitespaces
octocat Jun 19, 2024
185b2e3
Merge branch 'G-Research:master' into add-connect-ca-leaf
IvanKolchanov Jun 20, 2024
326b546
Merge branch 'master' into add-connect-ca-leaf
IvanKolchanov Jun 26, 2024
f32d8a1
Bug fix, repeated code
IvanKolchanov Jun 26, 2024
a3dff95
Merge pull request #3 from IvanKolchanov/add-connect-ca-leaf
IvanKolchanov Jun 26, 2024
eca5c0e
Added POST ConnectAuthorize endpoint, added test for the endpoint, me…
IvanKolchanov Jun 26, 2024
b0d1623
Changed name AgentAuthorizeParams to AgentAuthorizeParameters, added …
IvanKolchanov Jul 1, 2024
6cd9a15
Merge pull request #4 from IvanKolchanov/add-connect-authorize
IvanKolchanov Jul 2, 2024
afd02b7
Added GET GatewayService endpoint, added tests for it
IvanKolchanov Jul 12, 2024
8d8b471
style: fix whitespaces
octocat Jul 12, 2024
b50c8b9
Merge branch 'master' into add-gateaway-services
marcin-krystianc Jul 15, 2024
e70153c
Deleted custom Termintaing and Ingress gateway config entries. Modifi…
IvanKolchanov Jul 15, 2024
4ad25b5
Added GET Update LAN Coordinates endpoints, added tests for it
IvanKolchanov Jul 15, 2024
82627a7
style: fix whitespaces
octocat Jul 15, 2024
69e27fb
Minor changes to time breaks
IvanKolchanov Jul 15, 2024
fb98725
Merge branch 'add-update-lan-coordinates' of https://github.com/IvanK…
IvanKolchanov Jul 15, 2024
cac8204
Possible bug fix
IvanKolchanov Jul 15, 2024
c9305bd
Modified test for List Gateway Services, skippable for versions 1.7.1…
IvanKolchanov Jul 16, 2024
954dbf7
Using non-standard name for the testing gateway services
IvanKolchanov Jul 16, 2024
ed68a0d
Update Consul.Test/CoordinateTest.cs
IvanKolchanov Jul 16, 2024
86209c9
Update Consul.Test/CoordinateTest.cs
IvanKolchanov Jul 16, 2024
cc4be02
style: fix whitespaces
octocat Jul 16, 2024
500040c
Some test fixes, a version of Update with WriteOptions
IvanKolchanov Jul 16, 2024
c010c25
Merge branch 'add-update-lan-coordinates' of https://github.com/IvanK…
IvanKolchanov Jul 16, 2024
f85e68f
style: fix whitespaces
octocat Jul 16, 2024
c4b1cd5
Merge branch 'master' into add-update-lan-coordinates
marcin-krystianc Jul 16, 2024
51a1e9b
Dummy changes to merge
IvanKolchanov Jul 16, 2024
fa04eef
Merge branch 'master' into add-gateaway-services
marcin-krystianc Jul 16, 2024
a80f67f
Some field checks for GatewayService results
IvanKolchanov Jul 16, 2024
1161a9e
Merge branch 'add-gateaway-services' of https://github.com/IvanKolcha…
IvanKolchanov Jul 16, 2024
7705e0a
Minor test change
IvanKolchanov Jul 17, 2024
1484b9f
Merge pull request #5 from IvanKolchanov/add-update-lan-coordinates
IvanKolchanov Jul 17, 2024
c3ee821
Merge pull request #6 from IvanKolchanov/add-gateaway-services
IvanKolchanov Jul 17, 2024
683bafb
Merge pull request #7 from IvanKolchanov/master
IvanKolchanov Jul 17, 2024
0c93a32
Added GET List Ingress Health for Service
IvanKolchanov Jul 17, 2024
75b950b
Skip test for outdated server versions
IvanKolchanov Jul 17, 2024
3bab63d
Import Versioning into HealthTest.cs to skip a test in some versions
IvanKolchanov Jul 17, 2024
4420fb7
Merge branch 'master' into add-list-ingress-health
marcin-krystianc Jul 18, 2024
0f9a6c5
Little fixes
IvanKolchanov Jul 18, 2024
2dca0cb
Merge branch 'add-list-ingress-health' of https://github.com/IvanKolc…
IvanKolchanov Jul 18, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
49 changes: 49 additions & 0 deletions Consul.Test/HealthTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
using System.Collections.Generic;
using System.Threading.Tasks;
using Consul.Filtering;
using NuGet.Versioning;
using Xunit;

namespace Consul.Test
Expand Down Expand Up @@ -157,6 +158,54 @@ public async Task Health_Connect()
}
}

[SkippableFact]
public async void Health_Ingress()
{
var cutOffVersion = SemanticVersion.Parse("1.8.0");
Skip.If(AgentVersion < cutOffVersion, $"Current version is {AgentVersion}, but Terminating and Ingress GatewayEntrys are different since {cutOffVersion}");

var registration = new AgentServiceRegistration
{
Name = "foo-ingress",
Port = 8000
};
await _client.Agent.ServiceRegister(registration);

var gatewayRegistration = new AgentServiceRegistration
{
Name = "foo-ingress-gateway",
Port = 8001,
Kind = ServiceKind.IngressGateway
};
await _client.Agent.ServiceRegister(gatewayRegistration);

var ingressGatewayConfigEntry = new IngressGatewayEntry
{
Name = "foo-ingress-gateway",
Listeners = new List<GatewayListener>
{
new GatewayListener
{
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Odd formatting, should be:

                Listeners = new List<GatewayListener>
                {
                ...

Port = 2222,
Protocol = "tcp",
Services = new List<ExternalService>
{
new ExternalService
{
Name = "foo-ingress"
}
}
}
}
};
await _client.Configuration.ApplyConfig(ingressGatewayConfigEntry);

var services = await _client.Health.Ingress("foo-ingress", "", false);
Assert.Single(services.Response);
Assert.NotEmpty(services.Response[0].Node.Datacenter);
Assert.Equal(gatewayRegistration.Name, services.Response[0].Service.Service);
}

[Fact]
public void Health_GetAggregatedStatus()
{
Expand Down
1 change: 1 addition & 0 deletions Consul/Catalog.cs
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ public class Node
[JsonProperty(PropertyName = "Node")]
public string Name { get; set; }
public string Address { get; set; }
public string Datacenter { get; set; }
public Dictionary<string, string> TaggedAddresses { get; set; }
}

Expand Down
48 changes: 48 additions & 0 deletions Consul/Health.cs
Original file line number Diff line number Diff line change
Expand Up @@ -337,6 +337,54 @@ public Task<QueryResult<ServiceEntry[]>> Connect(string service, string tag, boo
return Connect(service, tag, passingOnly, q, null, ct);
}

/// <summary>
/// Ingress is equivalent to Service and Connect, except that it will only return ingress services
/// <param name="service">The service ID</param>
/// <param name="tag">The service member tag</param>
/// <param name="passingOnly">Only return if the health check is in the Passing state</param>
/// <param name="q">Customized query options</param>
/// <param name="filter">Specifies the expression used to filter the queries results prior to returning the data</param>
/// <param name="ct">Cancellation token for long poll request. If set, OperationCanceledException will be thrown if the request is cancelled before completing</param>
/// <returns>This endpoint returns the nodes providing an ingress service in a given datacenter, or a query result with a null response</returns>
public Task<QueryResult<ServiceEntry[]>> Ingress(string service, string tag, bool passingOnly, QueryOptions q, Filter filter, CancellationToken ct = default)
{
var req = _client.Get<ServiceEntry[]>(string.Format("/v1/health/ingress/{0}", service), q, filter);
if (!string.IsNullOrEmpty(tag))
{
req.Params["tag"] = tag;
}
if (passingOnly)
{
req.Params["passing"] = "1";
}
return req.Execute(ct);
}

/// <summary>
/// Ingress is equivalent to Service and Connect, except that it will only return ingress services
/// <param name="service">The service ID</param>
/// <param name="tag">The service member tag</param>
/// <param name="passingOnly">Only return if the health check is in the Passing state</param>
/// <param name="q">Customized query options</param>
/// <param name="ct">Cancellation token for long poll request. If set, OperationCanceledException will be thrown if the request is cancelled before completing</param>
/// <returns>This endpoint returns the nodes providing an ingress service in a given datacenter, or a query result with a null response</returns>
public Task<QueryResult<ServiceEntry[]>> Ingress(string service, string tag, bool passingOnly, QueryOptions q, CancellationToken ct = default)
{
return Ingress(service, tag, passingOnly, q, null, ct);
}

/// <summary>
/// Ingress is equivalent to Service and Connect, except that it will only return ingress services
/// <param name="service">The service ID</param>
/// <param name="tag">The service member tag</param>
/// <param name="passingOnly">Only return if the health check is in the Passing state</param>
/// <param name="ct">Cancellation token for long poll request. If set, OperationCanceledException will be thrown if the request is cancelled before completing</param>
/// <returns>This endpoint returns the nodes providing an ingress service in a given datacenter, or a query result with a null response</returns>
public Task<QueryResult<ServiceEntry[]>> Ingress(string service, string tag, bool passingOnly, CancellationToken ct = default)
{
return Ingress(service, tag, passingOnly, QueryOptions.Default, null, ct);
}

/// <summary>
/// State is used to retrieve all the checks in a given state. The wildcard "any" state can also be used for all checks.
/// </summary>
Expand Down
3 changes: 3 additions & 0 deletions Consul/Interfaces/IHealthEndpoint.cs
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,9 @@ public interface IHealthEndpoint
Task<QueryResult<ServiceEntry[]>> Service(string service, string tag, bool passingOnly, QueryOptions q, Filter filter, CancellationToken ct = default);
Task<QueryResult<ServiceEntry[]>> Connect(string service, string tag, bool passingOnly, QueryOptions q, Filter filter, CancellationToken ct = default);
Task<QueryResult<ServiceEntry[]>> Connect(string service, string tag, bool passingOnly, QueryOptions q, CancellationToken ct = default);
Task<QueryResult<ServiceEntry[]>> Ingress(string service, string tag, bool passingOnly, QueryOptions q, Filter filter, CancellationToken ct = default);
Task<QueryResult<ServiceEntry[]>> Ingress(string service, string tag, bool passingOnly, QueryOptions q, CancellationToken ct = default);
Task<QueryResult<ServiceEntry[]>> Ingress(string service, string tag, bool passingOnly, CancellationToken ct = default);
Task<QueryResult<HealthCheck[]>> State(HealthStatus status, CancellationToken ct = default);
Task<QueryResult<HealthCheck[]>> State(HealthStatus status, QueryOptions q, CancellationToken ct = default);
}
Expand Down