Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Kubediag #1995

Merged
merged 9 commits into from
May 11, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
15 changes: 15 additions & 0 deletions ProtoActor.sln
Original file line number Diff line number Diff line change
Expand Up @@ -272,6 +272,8 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Proto.Cluster.AzureContaine
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Proto.Cluster.SeedNode.Redis", "src\Proto.Cluster.SeedNode.Redis\Proto.Cluster.SeedNode.Redis.csproj", "{BDB67DAB-12F8-4D9F-BF7E-9F5D9E723816}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "KubernetesDiagnostics", "benchmarks\KubernetesDiagnostics\KubernetesDiagnostics.csproj", "{5FECD1A8-A873-4927-81C3-E5C5A37D80C5}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Expand Down Expand Up @@ -1374,6 +1376,18 @@ Global
{BDB67DAB-12F8-4D9F-BF7E-9F5D9E723816}.Release|x64.Build.0 = Release|Any CPU
{BDB67DAB-12F8-4D9F-BF7E-9F5D9E723816}.Release|x86.ActiveCfg = Release|Any CPU
{BDB67DAB-12F8-4D9F-BF7E-9F5D9E723816}.Release|x86.Build.0 = Release|Any CPU
{5FECD1A8-A873-4927-81C3-E5C5A37D80C5}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{5FECD1A8-A873-4927-81C3-E5C5A37D80C5}.Debug|Any CPU.Build.0 = Debug|Any CPU
{5FECD1A8-A873-4927-81C3-E5C5A37D80C5}.Debug|x64.ActiveCfg = Debug|Any CPU
{5FECD1A8-A873-4927-81C3-E5C5A37D80C5}.Debug|x64.Build.0 = Debug|Any CPU
{5FECD1A8-A873-4927-81C3-E5C5A37D80C5}.Debug|x86.ActiveCfg = Debug|Any CPU
{5FECD1A8-A873-4927-81C3-E5C5A37D80C5}.Debug|x86.Build.0 = Debug|Any CPU
{5FECD1A8-A873-4927-81C3-E5C5A37D80C5}.Release|Any CPU.ActiveCfg = Release|Any CPU
{5FECD1A8-A873-4927-81C3-E5C5A37D80C5}.Release|Any CPU.Build.0 = Release|Any CPU
{5FECD1A8-A873-4927-81C3-E5C5A37D80C5}.Release|x64.ActiveCfg = Release|Any CPU
{5FECD1A8-A873-4927-81C3-E5C5A37D80C5}.Release|x64.Build.0 = Release|Any CPU
{5FECD1A8-A873-4927-81C3-E5C5A37D80C5}.Release|x86.ActiveCfg = Release|Any CPU
{5FECD1A8-A873-4927-81C3-E5C5A37D80C5}.Release|x86.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
Expand Down Expand Up @@ -1500,6 +1514,7 @@ Global
{E56413ED-8205-4AC1-A7CE-24A2C1711F54} = {9AA2BCF0-19AB-4DD9-8D91-7D188E463806}
{4DF9BBFF-C480-4550-B2BA-6603DAE6BC6F} = {3D12F5E5-9774-4D7E-8A5B-B1F64544925B}
{BDB67DAB-12F8-4D9F-BF7E-9F5D9E723816} = {3D12F5E5-9774-4D7E-8A5B-B1F64544925B}
{5FECD1A8-A873-4927-81C3-E5C5A37D80C5} = {0F3AB331-C042-4371-A2F0-0AFDFA13DC9F}
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {CD0D1E44-8118-4682-8793-6B20ABFA824C}
Expand Down
25 changes: 0 additions & 25 deletions benchmarks/KubernetesDiagnostics/.dockerignore

This file was deleted.

18 changes: 0 additions & 18 deletions benchmarks/KubernetesDiagnostics/Dockerfile

This file was deleted.

18 changes: 0 additions & 18 deletions benchmarks/KubernetesDiagnostics/Dockerfile-amd64

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

<ItemGroup>
<PackageReference Include="Microsoft.Extensions.Logging.Console" Version="6.0.0" />
<PackageReference Include="Microsoft.NET.Build.Containers" Version="0.1.8" />
<PackageReference Include="Microsoft.NET.Build.Containers" Version="0.4.0" />
</ItemGroup>

<ItemGroup>
Expand Down
29 changes: 11 additions & 18 deletions benchmarks/KubernetesDiagnostics/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ public static async Task Main()
var log = Log.CreateLogger("main");

var identity = new PartitionIdentityLookup(TimeSpan.FromSeconds(2), TimeSpan.FromSeconds(2)
); // new IdentityStorageLookup(GetRedisId("MyCluster"));
);

/*
- name: "REDIS"
Expand All @@ -57,10 +57,7 @@ public static async Task Main()

var noOpsProps = Props.FromFunc(ctx => Task.CompletedTask);
var echoKind = new ClusterKind("echo", noOpsProps);
var system = new ActorSystem(new ActorSystemConfig()
// .WithDeveloperReceiveLogging(TimeSpan.FromSeconds(1))
// .WithDeveloperSupervisionLogging(true)
)
var system = new ActorSystem(new ActorSystemConfig())
.WithRemote(GrpcNetRemoteConfig
.BindTo(host, port)
.WithAdvertisedHost(advertisedHost)
Expand All @@ -72,21 +69,13 @@ public static async Task Main()
.WithClusterKind(echoKind)
);

system.EventStream.Subscribe<GossipUpdate>(e => { Console.WriteLine($"{DateTime.Now:O} Gossip update Member {e.MemberId} Key {e.Key}"); }
);
// system.EventStream.Subscribe<GossipUpdate>(e => { Console.WriteLine($"{DateTime.Now:O} Gossip update Member {e.MemberId} Key {e.Key}"); });

system.EventStream.Subscribe<ClusterTopology>(e => {
var members = e.Members;
var x = members.Select(m => m.Id).OrderBy(i => i).ToArray();
var key = string.Join("", x);
var hash = MurmurHash2.Hash(key);

Console.WriteLine($"{DateTime.Now:O} My members {hash}");
var hash = e.TopologyHash;

// foreach (var member in members.OrderBy(m => m.Id))
// {
// Console.WriteLine(member.Id + "\t" + member.Address + "\t" + member.Kinds);
// }
Console.WriteLine($"{DateTime.Now:O} My members {hash}");
}
);

Expand All @@ -97,6 +86,12 @@ public static async Task Main()
await system
.Cluster()
.StartMemberAsync();

system.Shutdown.Register(() =>
{
Console.WriteLine("Shutting down...");
Environment.Exit(0);
});

var props = Props.FromFunc(ctx => Task.CompletedTask);
system.Root.SpawnNamed(props, "dummy");
Expand All @@ -105,8 +100,6 @@ await system

while (!cts.IsCancellationRequested)
{
// var res = await system.Cluster().MemberList.TopologyConsensus(CancellationTokens.FromSeconds(5));

var m = system.Cluster().MemberList.GetAllMembers();
var hash = Member.TopologyHash(m);

Expand Down
4 changes: 0 additions & 4 deletions benchmarks/KubernetesDiagnostics/build-amd64.sh

This file was deleted.

5 changes: 4 additions & 1 deletion benchmarks/KubernetesDiagnostics/build.sh
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
docker login
kubectl delete --filename service.yaml
dotnet publish --os linux -c Release --arch x64 -p:PublishProfile=DefaultContainer
dotnet publish --os linux -c Release --arch arm64 -p:PublishProfile=DefaultContainer
docker tag kubernetesdiagnostics:1.0.0 rogeralsing/kubediag
docker push rogeralsing/kubediag
kubectl apply --filename service.yaml
86 changes: 0 additions & 86 deletions benchmarks/KubernetesDiagnostics/service-amd64.yaml

This file was deleted.

36 changes: 20 additions & 16 deletions benchmarks/KubernetesDiagnostics/service.yaml
Original file line number Diff line number Diff line change
@@ -1,22 +1,24 @@
apiVersion: v1
kind: Namespace
metadata:
name: my-namespace
---
apiVersion: v1
kind: ServiceAccount
metadata:
name: proto-cluster
namespace: my-namespace
---
apiVersion: rbac.authorization.k8s.io/v1
kind: Role
metadata:
name: proto-cluster
labels:
app: kubdiag
namespace: my-namespace
rules:
- apiGroups:
- ""
resources:
- endpoints
- pods
- services
- services/status
verbs:
- get
- list
Expand All @@ -28,7 +30,8 @@ kind: RoleBinding
metadata:
name: proto-cluster
labels:
app: kubdiag
app: kubediag
namespace: my-namespace
roleRef:
apiGroup: rbac.authorization.k8s.io
kind: Role
Expand All @@ -40,37 +43,38 @@ subjects:
apiVersion: v1
kind: Service
metadata:
name: testing
name: kubediag
labels:
app: kubdiag
app: kubediag
namespace: my-namespace
spec:
ports:
- port: 8080
name: protoactor
selector:
app: kubdiag
app: kubediag
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: diagapp
name: kubediag
namespace: my-namespace
spec:
replicas: 3
selector:
matchLabels:
app: kubdiag
app: kubediag
template:
metadata:
labels:
app: kubdiag
app: kubediag
version: v1
spec:
serviceAccountName: proto-cluster
containers:
- name: kubdiag
# there is nothing sensitive in here, its just a diagnostics app
image: rogeralsing/kubdiagg:default2
imagePullPolicy: Never
- name: kubediag
image: rogeralsing/kubediag:latest
imagePullPolicy: Always
ports:
- containerPort: 8080
env:
Expand Down
4 changes: 0 additions & 4 deletions service.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,6 @@ spec:
value: "8080"
- name: PROTOHOST
value: "0.0.0.0"
- name: "MONGO"
value: "mongodb://mongo"
- name: "PROTOHOSTPUBLIC"
valueFrom:
fieldRef:
Expand Down Expand Up @@ -70,8 +68,6 @@ spec:
value: "8080"
- name: PROTOHOST
value: "0.0.0.0"
- name: "MONGO"
value: "mongodb://mongo"
- name: "PROTOHOSTPUBLIC"
valueFrom:
fieldRef:
Expand Down
Loading