Skip to content

Commit

Permalink
Update KubernetesAgent to KubernetesTentacle (#795)
Browse files Browse the repository at this point in the history
* Update KubernetesAgent to KubernetesTentacle

* Fix assent tests
  • Loading branch information
scme0 authored Nov 1, 2023
1 parent 749ddb1 commit e5aa597
Show file tree
Hide file tree
Showing 7 changed files with 32 additions and 32 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ public void SetUp()
}

[Test]
public async Task ShouldCreateNewListeningKubernetesAgent()
public async Task ShouldCreateNewListeningKubernetesTentacle()
{
var machineResources = new List<MachineResource>();
await client.Create("/api/machines", Arg.Do<MachineResource>(m => machineResources.Add(m)), Arg.Any<object>(), Arg.Any<CancellationToken>());
Expand All @@ -77,11 +77,11 @@ public async Task ShouldCreateNewListeningKubernetesAgent()

await operation.ExecuteAsync(serverEndpoint).ConfigureAwait(false);

machineResources.Should().ContainSingle().Which.Endpoint.Should().BeOfType<KubernetesAgentEndpointResource>().Which.ShouldBeEquivalentTo(new KubernetesAgentEndpointResource(new ListeningTentacleEndpointConfigurationResource("ABCDEF", "https://mymachine.test.com:10930/")));
machineResources.Should().ContainSingle().Which.Endpoint.Should().BeOfType<KubernetesTentacleEndpointResource>().Which.ShouldBeEquivalentTo(new KubernetesTentacleEndpointResource(new ListeningTentacleEndpointConfigurationResource("ABCDEF", "https://mymachine.test.com:10930/")));
}

[Test]
public async Task ShouldCreateNewPollingKubernetesAgent()
public async Task ShouldCreateNewPollingKubernetesTentacle()
{
var machineResources = new List<MachineResource>();
await client.Create("/api/machines", Arg.Do<MachineResource>(m => machineResources.Add(m)), Arg.Any<object>(), Arg.Any<CancellationToken>());
Expand All @@ -99,7 +99,7 @@ public async Task ShouldCreateNewPollingKubernetesAgent()

await operation.ExecuteAsync(serverEndpoint).ConfigureAwait(false);

machineResources.Should().ContainSingle().Which.Endpoint.Should().BeOfType<KubernetesAgentEndpointResource>().Which.ShouldBeEquivalentTo(new KubernetesAgentEndpointResource(new PollingTentacleEndpointConfigurationResource("ABCDEF", "poll://ckyhfyfkcbmzjl8sfgch/")));
machineResources.Should().ContainSingle().Which.Endpoint.Should().BeOfType<KubernetesTentacleEndpointResource>().Which.ShouldBeEquivalentTo(new KubernetesTentacleEndpointResource(new PollingTentacleEndpointConfigurationResource("ABCDEF", "poll://ckyhfyfkcbmzjl8sfgch/")));
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -2392,7 +2392,7 @@ Octopus.Client.Model
AzureServiceFabricCluster = 8
Kubernetes = 9
StepPackage = 10
KubernetesAgent = 11
KubernetesTentacle = 11
}
class CommunityActionTemplateResource
Octopus.Client.Extensibility.IResource
Expand Down Expand Up @@ -6484,15 +6484,6 @@ Octopus.Client.Model.Endpoints
String Thumbprint { get; set; }
String Uri { get; set; }
}
class KubernetesAgentEndpointResource
Octopus.Client.Extensibility.IResource
Octopus.Client.Model.IAuditedResource
Octopus.Client.Model.Endpoints.EndpointResource
{
.ctor(Octopus.Client.Model.Endpoints.TentacleEndpointConfigurationResource)
Octopus.Client.Model.CommunicationStyle CommunicationStyle { get; }
Octopus.Client.Model.Endpoints.TentacleEndpointConfigurationResource TentacleEndpointConfiguration { get; set; }
}
class KubernetesAwsAuthenticationResource
Octopus.Client.Model.Endpoints.IEndpointWithMultipleAuthenticationResource
Octopus.Client.Model.Endpoints.KubernetesStandardAccountAuthenticationResource
Expand Down Expand Up @@ -6568,6 +6559,15 @@ Octopus.Client.Model.Endpoints
String AccountId { get; set; }
String AuthenticationType { get; }
}
class KubernetesTentacleEndpointResource
Octopus.Client.Extensibility.IResource
Octopus.Client.Model.IAuditedResource
Octopus.Client.Model.Endpoints.EndpointResource
{
.ctor(Octopus.Client.Model.Endpoints.TentacleEndpointConfigurationResource)
Octopus.Client.Model.CommunicationStyle CommunicationStyle { get; }
Octopus.Client.Model.Endpoints.TentacleEndpointConfigurationResource TentacleEndpointConfiguration { get; set; }
}
class ListeningTentacleEndpointConfigurationResource
Octopus.Client.Model.Endpoints.ITentacleEndpointResource
Octopus.Client.Model.Endpoints.IListeningTentacleEndpointResource
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2409,7 +2409,7 @@ Octopus.Client.Model
AzureServiceFabricCluster = 8
Kubernetes = 9
StepPackage = 10
KubernetesAgent = 11
KubernetesTentacle = 11
}
class CommunityActionTemplateResource
Octopus.Client.Extensibility.IResource
Expand Down Expand Up @@ -6508,15 +6508,6 @@ Octopus.Client.Model.Endpoints
String Thumbprint { get; set; }
String Uri { get; set; }
}
class KubernetesAgentEndpointResource
Octopus.Client.Extensibility.IResource
Octopus.Client.Model.IAuditedResource
Octopus.Client.Model.Endpoints.EndpointResource
{
.ctor(Octopus.Client.Model.Endpoints.TentacleEndpointConfigurationResource)
Octopus.Client.Model.CommunicationStyle CommunicationStyle { get; }
Octopus.Client.Model.Endpoints.TentacleEndpointConfigurationResource TentacleEndpointConfiguration { get; set; }
}
class KubernetesAwsAuthenticationResource
Octopus.Client.Model.Endpoints.IEndpointWithMultipleAuthenticationResource
Octopus.Client.Model.Endpoints.KubernetesStandardAccountAuthenticationResource
Expand Down Expand Up @@ -6592,6 +6583,15 @@ Octopus.Client.Model.Endpoints
String AccountId { get; set; }
String AuthenticationType { get; }
}
class KubernetesTentacleEndpointResource
Octopus.Client.Extensibility.IResource
Octopus.Client.Model.IAuditedResource
Octopus.Client.Model.Endpoints.EndpointResource
{
.ctor(Octopus.Client.Model.Endpoints.TentacleEndpointConfigurationResource)
Octopus.Client.Model.CommunicationStyle CommunicationStyle { get; }
Octopus.Client.Model.Endpoints.TentacleEndpointConfigurationResource TentacleEndpointConfiguration { get; set; }
}
class ListeningTentacleEndpointConfigurationResource
Octopus.Client.Model.Endpoints.ITentacleEndpointResource
Octopus.Client.Model.Endpoints.IListeningTentacleEndpointResource
Expand Down
2 changes: 1 addition & 1 deletion source/Octopus.Server.Client/Model/CommunicationStyle.cs
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,6 @@ [ScriptConsoleSupported] [SupportedAccountTypes(AccountType.SshKeyPair, AccountT

StepPackage = 10,

[ScriptConsoleSupported] KubernetesAgent = 11
[ScriptConsoleSupported] KubernetesTentacle = 11
}
}
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
namespace Octopus.Client.Model.Endpoints;

public class KubernetesAgentEndpointResource : EndpointResource
public class KubernetesTentacleEndpointResource : EndpointResource
{
public override CommunicationStyle CommunicationStyle => CommunicationStyle.KubernetesAgent;
public override CommunicationStyle CommunicationStyle => CommunicationStyle.KubernetesTentacle;

protected KubernetesAgentEndpointResource()
protected KubernetesTentacleEndpointResource()
{
}

public KubernetesAgentEndpointResource(TentacleEndpointConfigurationResource tentacleEndpointConfiguration)
public KubernetesTentacleEndpointResource(TentacleEndpointConfigurationResource tentacleEndpointConfiguration)
{
TentacleEndpointConfiguration = tentacleEndpointConfiguration;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,9 @@ protected override EndpointResource GenerateEndpoint(string proxyId)
{
return CommunicationStyle switch
{
CommunicationStyle.TentaclePassive => new KubernetesAgentEndpointResource(
CommunicationStyle.TentaclePassive => new KubernetesTentacleEndpointResource(
new ListeningTentacleEndpointConfigurationResource(TentacleThumbprint, GetListeningUri()) { ProxyId = proxyId }),
CommunicationStyle.TentacleActive => new KubernetesAgentEndpointResource(
CommunicationStyle.TentacleActive => new KubernetesTentacleEndpointResource(
new PollingTentacleEndpointConfigurationResource(TentacleThumbprint, SubscriptionId.ToString())),
_ => null
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ public class EndpointConverter : InheritedClassConverter<EndpointResource, Commu
{CommunicationStyle.Kubernetes, typeof (KubernetesEndpointResource)},
{CommunicationStyle.AzureServiceFabricCluster, typeof(ServiceFabricEndpointResource)},
{CommunicationStyle.StepPackage, typeof(StepPackageEndpointResource)},
{CommunicationStyle.KubernetesAgent, typeof(KubernetesEndpointResource)}
{CommunicationStyle.KubernetesTentacle, typeof(KubernetesEndpointResource)}
};

protected override IDictionary<CommunicationStyle, Type> DerivedTypeMappings => EndpointTypes;
Expand Down

0 comments on commit e5aa597

Please sign in to comment.