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
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ controller-gen: ## Download controller-gen locally if necessary.
GOLANGCI_LINT = $(GOBIN)/golangci-lint
.PHONY: golangci-lint
golangci-lint: ## Download golint locally if necessary
$(call go-install-tool,$(GOLANGCI_LINT),github.com/golangci/golangci-lint/v2/cmd/golangci-lint@v2.1.2)
$(call go-install-tool,$(GOLANGCI_LINT),github.com/golangci/golangci-lint/v2/cmd/golangci-lint@v2.13.2)

KUSTOMIZE = $(GOBIN)/kustomize
.PHONY: kustomize
Expand Down
2 changes: 1 addition & 1 deletion internal/controllers/subgraph_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ func (r *SubGraphReconciler) Reconcile(ctx context.Context, req ctrl.Request) (c
// Update status after reconciliation.
if err := r.patchStatus(ctx, &subgraph); err != nil {
logger.Error(err, "unable to update status after reconciliation")
return ctrl.Result{Requeue: true}, err
return ctrl.Result{}, err
}

if err != nil {
Expand Down
11 changes: 6 additions & 5 deletions internal/controllers/supergraphschema_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ import (
"io"
"net/http"
"slices"
"time"

"github.com/go-logr/logr"
"github.com/goccy/go-yaml"
Expand Down Expand Up @@ -265,22 +266,22 @@ func (r *SuperGraphSchemaReconciler) reconcile(ctx context.Context, schema infra
if apierrors.IsNotFound(podErr) {
conditions.Delete(&schema, infrav1beta1.ConditionReconciling)
schema.Status.Reconciler.Name = ""
return schema, ctrl.Result{Requeue: true}, nil
return schema, ctrl.Result{RequeueAfter: time.Millisecond}, nil
}

// cleanup reconciler pod if stale
if needUpdate {
conditions.Delete(&schema, infrav1beta1.ConditionReconciling)
logger.V(1).Info("schema checksum changed, delete stale reconciler", "pod-name", schema.Status.Reconciler)
return schema, ctrl.Result{Requeue: true}, cleanup()
return schema, ctrl.Result{RequeueAfter: time.Millisecond}, cleanup()
}

// garbage collect reconciler pod
readyCondition := conditions.Get(&schema, infrav1beta1.ConditionReady)
progressingCondition := conditions.Get(&schema, infrav1beta1.ConditionReconciling)
if progressingCondition != nil && readyCondition != nil && readyCondition.Status == metav1.ConditionTrue && podErr == nil && schema.Status.Reconciler.Name != "" {
logger.V(1).Info("garbage collect reconciler pod", "pod-name", schema.Status.Reconciler.Name)
return schema, ctrl.Result{Requeue: true}, cleanup()
return schema, ctrl.Result{RequeueAfter: time.Millisecond}, cleanup()
}

if schema.Status.ConfigMap.Name != "" {
Expand Down Expand Up @@ -378,7 +379,7 @@ func (r *SuperGraphSchemaReconciler) handleReconcilerState(ctx context.Context,
schema.Status.ComposeErrors = nil
schema.Status.ObservedSHA256Checksum = checksum
schema = infrav1beta1.SuperGraphSchemaReady(schema, metav1.ConditionTrue, "ReconciliationSucceeded", fmt.Sprintf("reconciler %s terminated with code 0", schema.Status.Reconciler.Name))
return schema, ctrl.Result{Requeue: true}, nil
return schema, ctrl.Result{RequeueAfter: time.Millisecond}, nil
}

schema.Status.ComposeErrors = nil
Expand Down Expand Up @@ -496,7 +497,7 @@ func (r *SuperGraphSchemaReconciler) createSuperGraphResult(ctx context.Context,
}

schema.Status.ConfigMap.Name = cm.Name
return schema, ctrl.Result{Requeue: true}, nil
return schema, ctrl.Result{RequeueAfter: time.Millisecond}, nil
}

func (r *SuperGraphSchemaReconciler) createReconciler(ctx context.Context, schema infrav1beta1.SuperGraphSchema, subgraphs []infrav1beta1.SubGraph, checksum string, logger logr.Logger) (infrav1beta1.SuperGraphSchema, ctrl.Result, error) {
Expand Down
4 changes: 2 additions & 2 deletions internal/controllers/supergraphschema_controller_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@ import (

var _ = Describe("SuperGraphSchema controller", func() {
const (
timeout = time.Second * 3
interval = time.Millisecond * 200
timeout = time.Second * 6
interval = time.Millisecond * 50
)

When("reconciling a suspended SuperGraphSchema", func() {
Expand Down
Loading