Files
OPC/ControlPlane.Core/Models/StackConfig.cs
T
2026-04-25 18:05:57 -04:00

52 lines
2.5 KiB
C#

namespace ControlPlane.Core.Models;
/// <summary>
/// Defines the exact infrastructure composition for a provisioned tenant.
/// Each component is configured independently — the TenantTier gates which
/// ComponentMode values are available in the UI.
///
/// Allowed modes per tier:
///
/// | Trial | Shared | Dedicated | Enterprise |
/// SharedPlatform | ✅ | ✅ | ✅ | ✅ |
/// Bundled | ✅ | ❌ | ❌ | ❌ |
/// OwnContainer | ❌ | ❌ | ✅ | ✅ |
/// VpsDocker | ❌ | ❌ | ❌ | ✅ |
/// VpsBareMetal | ❌ | ❌ | ❌ | ✅ |
/// </summary>
public class StackConfig
{
public ComponentMode Postgres { get; set; } = ComponentMode.SharedPlatform;
public ComponentMode Keycloak { get; set; } = ComponentMode.SharedPlatform;
public ComponentMode Vault { get; set; } = ComponentMode.SharedPlatform;
public ComponentMode Minio { get; set; } = ComponentMode.SharedPlatform;
/// <summary>Returns a default StackConfig for the given tier.</summary>
public static StackConfig DefaultForTier(TenantTier tier) => tier switch
{
TenantTier.Trial => new StackConfig
{
Postgres = ComponentMode.Bundled,
Keycloak = ComponentMode.SharedPlatform,
Vault = ComponentMode.SharedPlatform,
Minio = ComponentMode.SharedPlatform
},
TenantTier.Shared => new StackConfig(),
TenantTier.Dedicated => new StackConfig
{
Postgres = ComponentMode.OwnContainer,
Keycloak = ComponentMode.OwnContainer,
Vault = ComponentMode.OwnContainer,
Minio = ComponentMode.OwnContainer
},
TenantTier.Enterprise => new StackConfig
{
Postgres = ComponentMode.VpsDocker,
Keycloak = ComponentMode.VpsDocker,
Vault = ComponentMode.VpsDocker,
Minio = ComponentMode.VpsDocker
},
_ => new StackConfig()
};
}