Skip to content
Merged
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
21 changes: 1 addition & 20 deletions server/application/application_validate_src_and_dest.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,6 @@ import (
"errors"
"fmt"

"google.golang.org/grpc/codes"
"google.golang.org/grpc/status"
apierrors "k8s.io/apimachinery/pkg/api/errors"

"github.com/argoproj/argo-cd/v3/pkg/apiclient/application"
Expand Down Expand Up @@ -73,22 +71,5 @@ func validateDestination(ctx context.Context, dest *appv1.ApplicationDestination
return errors.New("no destination defined in app spec")
}
_, err := argo.GetDestinationCluster(ctx, *dest, db)
if err != nil {
return err
}

if dest.Server != "" {
// Ensure the k8s cluster the app is referencing, is configured in Argo CD
_, err := db.GetCluster(ctx, dest.Server)
if err != nil {
if errStatus, ok := status.FromError(err); ok && errStatus.Code() == codes.NotFound {
return fmt.Errorf("cluster '%s' has not been configured", dest.Server)
}
return err
}
} else if dest.Server == "" {
return errors.New("destination server missing from app spec")
}

return nil
return err
}
Loading