Add WAL file for database and log instance deployment failures
Some checks failed
Build and Publish Docker Image / build-and-push (push) Has been cancelled
Some checks failed
Build and Publish Docker Image / build-and-push (push) Has been cancelled
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
using Microsoft.Extensions.Logging;
|
||||
using OTSSignsOrchestrator.Core.Configuration;
|
||||
using YamlDotNet.RepresentationModel;
|
||||
|
||||
namespace OTSSignsOrchestrator.Core.Services;
|
||||
@@ -91,6 +92,11 @@ public class ComposeValidationService
|
||||
|
||||
if (HasKey(root, "secrets") && root.Children[new YamlScalarNode("secrets")] is YamlMappingNode secretsNode)
|
||||
{
|
||||
var presentSecrets = secretsNode.Children.Keys
|
||||
.OfType<YamlScalarNode>()
|
||||
.Select(k => k.Value!)
|
||||
.ToHashSet(StringComparer.OrdinalIgnoreCase);
|
||||
|
||||
foreach (var (key, value) in secretsNode.Children)
|
||||
{
|
||||
if (value is YamlMappingNode secretNode)
|
||||
@@ -99,6 +105,23 @@ public class ComposeValidationService
|
||||
warnings.Add($"Secret '{(key as YamlScalarNode)?.Value}' is not external.");
|
||||
}
|
||||
}
|
||||
|
||||
// Validate that all required MySQL secrets are declared
|
||||
if (!string.IsNullOrEmpty(customerAbbrev))
|
||||
{
|
||||
var requiredSecrets = new[]
|
||||
{
|
||||
AppConstants.CustomerMysqlPasswordSecretName(customerAbbrev),
|
||||
AppConstants.CustomerMysqlUserSecretName(customerAbbrev),
|
||||
AppConstants.GlobalMysqlHostSecretName,
|
||||
AppConstants.GlobalMysqlPortSecretName,
|
||||
};
|
||||
foreach (var required in requiredSecrets)
|
||||
{
|
||||
if (!presentSecrets.Contains(required))
|
||||
errors.Add($"Missing required secret: '{required}'.");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return new ValidationResult { Errors = errors, Warnings = warnings };
|
||||
|
||||
Reference in New Issue
Block a user