Skip to content
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
7 changes: 5 additions & 2 deletions internal/controller/reconcile-domain.go
Original file line number Diff line number Diff line change
Expand Up @@ -134,10 +134,13 @@ func reconcileDomainEntity[T v1alpha1.DomainEntity](ctx context.Context, c *Cont
return handleDomainResourceDeletion(ctx, c, dom)
}

if dom.GetStatus().State != v1alpha1.DomainStateProcessing {
// set processing status
if dom.GetStatus().State == "" {
// When no status state is set, we set it to processing state first and requeue for processing.
dom.SetStatusWithReadyCondition(v1alpha1.DomainStateProcessing, metav1.ConditionFalse, "Processing", "Processing domain resources")
return NewReconcileResultWithResource(getResourceKeyFromKind(dom), dom.GetName(), dom.GetNamespace(), 0), nil
} else if dom.GetStatus().State != v1alpha1.DomainStateProcessing {
// If not in processing state, we set it to processing state first and continue without requeuing. This ensures Error scenarios (if any) stay rate limited.
dom.SetStatusWithReadyCondition(v1alpha1.DomainStateProcessing, metav1.ConditionFalse, "Processing", "Processing domain resources")
}

defer func() {
Expand Down
19 changes: 19 additions & 0 deletions internal/controller/reconcile-domain_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,25 @@ func TestDomain_InitialState(t *testing.T) {
)
}

func TestDomain_ProcessingWithError(t *testing.T) {
err := reconcileTestItem(
context.TODO(), t,
QueueItem{Key: ResourceDomain, ResourceKey: NamespacedResourceKey{Namespace: "default", Name: "test-cap-01-primary"}},
TestData{
description: "Processing with ingress error",
initialResources: []string{
"testdata/domain/domain-no-ingress-error.yaml",
},
expectedResources: "testdata/domain/domain-no-ingress-error.yaml",
expectError: true,
},
)

if err.Error() != "failed to get ingress information for Domain.default.test-cap-01-primary: no matching ingress gateway pods found matching selector from Domain.default.test-cap-01-primary" {
t.Error("Wrong error message")
}
}

func TestDomain_ProcessingWithoutIngress(t *testing.T) {
err := reconcileTestItem(
context.TODO(), t,
Expand Down