Skip to content

Commit

Permalink
Minor updates
Browse files Browse the repository at this point in the history
  • Loading branch information
christinaexyou committed Jan 31, 2025
1 parent f511f81 commit 8bf8602
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 2 deletions.
2 changes: 1 addition & 1 deletion controllers/gorch/deployment.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
6 changes: 6 additions & 0 deletions controllers/gorch/guardrailsorchestrator_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
2 changes: 1 addition & 1 deletion controllers/gorch/route.go
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down

0 comments on commit 8bf8602

Please sign in to comment.