Skip to content

Commit

Permalink
wait last generation of status on rpaas-api
Browse files Browse the repository at this point in the history
  • Loading branch information
wpjunior committed Apr 10, 2024
1 parent 8f673f9 commit dd43a14
Showing 1 changed file with 11 additions and 3 deletions.
14 changes: 11 additions & 3 deletions internal/pkg/rpaas/validation/manager.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import (
"github.com/tsuru/rpaas-operator/api/v1alpha1"
"github.com/tsuru/rpaas-operator/internal/pkg/rpaas"
k8sErrors "k8s.io/apimachinery/pkg/api/errors"
v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"sigs.k8s.io/controller-runtime/pkg/client"
)

Expand Down Expand Up @@ -164,8 +165,13 @@ func (v *validationManager) validationCRD(ctx context.Context, instanceName stri
}

return &v1alpha1.RpaasValidation{
ObjectMeta: instance.ObjectMeta,
Spec: instance.Spec,
ObjectMeta: v1.ObjectMeta{
Name: instance.Name,
Namespace: instance.Namespace,
Labels: instance.Labels,
Annotations: instance.Annotations,
},
Spec: instance.Spec,
}, nil
}

Expand Down Expand Up @@ -197,7 +203,9 @@ func (v *validationManager) waitController(ctx context.Context, validation *v1al
return err
}

if existingValidation.Status.Valid != nil {
isLastStatus := existingValidation.Generation == existingValidation.Status.ObservedGeneration

if isLastStatus && existingValidation.Status.Valid != nil {
if *existingValidation.Status.Valid {
return nil
}
Expand Down

0 comments on commit dd43a14

Please sign in to comment.