initial setup of a grafana container

This commit is contained in:
benbierens 2023-08-11 09:37:30 +02:00
parent 5d92b99926
commit 9037ddab6e
No known key found for this signature in database
GPG Key ID: FE44815D96D0A1AA
4 changed files with 35 additions and 0 deletions

View File

@ -0,0 +1,19 @@
using KubernetesWorkflow;
namespace DistTestCore.Metrics
{
public class GrafanaContainerRecipe : ContainerRecipeFactory
{
public override string AppName => "grafana";
public override string Image => "grafana/grafana-oss:10.0.3";
protected override void Initialize(StartupConfig startupConfig)
{
//var config = startupConfig.Get<PrometheusStartupConfig>();
//AddExposedPortAndVar("PROM_PORT");
AddExposedPort(3000);
//AddEnvVar("PROM_CONFIG", config.PrometheusConfigBase64);
}
}
}

View File

@ -22,6 +22,10 @@ namespace DistTestCore
var runningContainers = workflow.Start(1, Location.Unspecified, new PrometheusContainerRecipe(), startupConfig);
if (runningContainers.Containers.Length != 1) throw new InvalidOperationException("Expected only 1 Prometheus container to be created.");
workflow = lifecycle.WorkflowCreator.CreateWorkflow();
var grafanaContainers = workflow.Start(1, Location.Unspecified, new GrafanaContainerRecipe(), startupConfig);
if (grafanaContainers.Containers.Length != 1) throw new InvalidOperationException("should be 1");
LogEnd("Metrics server started.");
return runningContainers;

View File

@ -40,6 +40,13 @@
return p;
}
protected Port AddExposedPort(int number, string tag = "")
{
var p = factory.CreatePort(number, tag);
exposedPorts.Add(p);
return p;
}
protected Port AddInternalPort(string tag = "")
{
var p = factory.CreatePort(tag);

View File

@ -7,6 +7,11 @@ namespace KubernetesWorkflow
{
private NumberSource portNumberSource = new NumberSource(8080);
public Port CreatePort(int number, string tag)
{
return new Port(number, tag);
}
public Port CreatePort(string tag)
{
return new Port(portNumberSource.GetNextNumber(), tag);