From 8bf860254593d4848a848b614ad435dd3896e4dc Mon Sep 17 00:00:00 2001 From: Christina Xu Date: Fri, 31 Jan 2025 14:48:23 -0500 Subject: [PATCH] Minor updates --- controllers/gorch/deployment.go | 2 +- controllers/gorch/guardrailsorchestrator_controller.go | 6 ++++++ controllers/gorch/route.go | 2 +- 3 files changed, 8 insertions(+), 2 deletions(-) diff --git a/controllers/gorch/deployment.go b/controllers/gorch/deployment.go index 31e2aee..a6d43fd 100644 --- a/controllers/gorch/deployment.go +++ b/controllers/gorch/deployment.go @@ -72,7 +72,7 @@ func (r *GuardrailsOrchestratorReconciler) createDeployment(ctx context.Context, func (r *GuardrailsOrchestratorReconciler) checkDeploymentReady(ctx context.Context, orchestrator *gorchv1alpha1.GuardrailsOrchestrator) (bool, error) { deployment := &appsv1.Deployment{} - err := r.Get(ctx, types.NamespacedName{Name: orchestrator.Name, Namespace: r.Namespace}, deployment) + err := r.Get(ctx, types.NamespacedName{Name: orchestrator.Name, Namespace: orchestrator.Namespace}, deployment) if err != nil { if errors.IsNotFound(err) { return false, nil diff --git a/controllers/gorch/guardrailsorchestrator_controller.go b/controllers/gorch/guardrailsorchestrator_controller.go index 76b22dc..c6eb402 100644 --- a/controllers/gorch/guardrailsorchestrator_controller.go +++ b/controllers/gorch/guardrailsorchestrator_controller.go @@ -215,6 +215,12 @@ func (r *GuardrailsOrchestratorReconciler) Reconcile(ctx context.Context, req ct return ctrl.Result{}, err } + // Refetch the orchestrator before updating the status + err = r.Get(ctx, req.NamespacedName, orchestrator) + if err != nil { + return ctrl.Result{}, err + } + // Finalize reconcilation _, updateErr := r.reconcileStatuses(ctx, orchestrator) if updateErr != nil { diff --git a/controllers/gorch/route.go b/controllers/gorch/route.go index 92b27c0..233241b 100644 --- a/controllers/gorch/route.go +++ b/controllers/gorch/route.go @@ -41,7 +41,7 @@ func (r *GuardrailsOrchestratorReconciler) createRoute(ctx context.Context, orch func (r *GuardrailsOrchestratorReconciler) checkRouteReady(ctx context.Context, orchestrator *gorchv1alpha1.GuardrailsOrchestrator) (bool, error) { existingRoute := &routev1.Route{} - typedNamespaceName := types.NamespacedName{Name: orchestrator.Name, Namespace: orchestrator.Namespace} + typedNamespaceName := types.NamespacedName{Name: orchestrator.Name + "-route", Namespace: orchestrator.Namespace} err := r.Get(ctx, typedNamespaceName, existingRoute) if err != nil { if errors.IsNotFound(err) {