Skip to content

Commit

Permalink
Hmm.
Browse files Browse the repository at this point in the history
  • Loading branch information
wasabii committed Jan 6, 2025
1 parent 20baf81 commit f99fc88
Showing 1 changed file with 4 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -85,14 +85,14 @@ public V1TenantEntityController(IMemoryCache cache, IKubernetesClient kube, ILog
protected override async Task Reconcile(TEntity entity, CancellationToken cancellationToken)
{
if (entity.Spec.TenantRef == null)
throw new InvalidOperationException($"{EntityTypeName} {entity.Namespace()}:{entity.Name()}: missing a tenant reference.");
throw new InvalidOperationException($"{EntityTypeName} {entity.Namespace()}/{entity.Name()}: missing a tenant reference.");

if (entity.Spec.Conf == null)
throw new InvalidOperationException($"{EntityTypeName} {entity.Namespace()}:{entity.Name()}: missing configuration.");
throw new InvalidOperationException($"{EntityTypeName} {entity.Namespace()}/{entity.Name()}: missing configuration.");

var api = await GetTenantApiClientAsync(entity.Spec.TenantRef, entity.Namespace(), cancellationToken);
if (api == null)
throw new InvalidOperationException($"{EntityTypeName} {entity.Namespace()}:{entity.Name()}: failed to retrieve API client.");
throw new InvalidOperationException($"{EntityTypeName} {entity.Namespace()}/{entity.Name()}: failed to retrieve API client.");

// discover entity by name, or create
if (string.IsNullOrWhiteSpace(entity.Status.Id))
Expand All @@ -104,7 +104,7 @@ protected override async Task Reconcile(TEntity entity, CancellationToken cancel

// check for validation before create
if (ValidateCreateConf(entity.Spec.Conf) is string msg)
throw new InvalidOperationException($"{EntityTypeName} {entity.Namespace()}:{entity.Name()} is invalid: {msg}");
throw new InvalidOperationException($"{EntityTypeName} {entity.Namespace()}/{entity.Name()} is invalid: {msg}");

entity.Status.Id = await CreateApi(api, entity.Spec.Conf, cancellationToken);
Logger.LogInformation("{EntityTypeName} {Namespace}/{Name}: created with {Id}", EntityTypeName, entity.Namespace(), entity.Name(), entity.Status.Id);
Expand Down

0 comments on commit f99fc88

Please sign in to comment.