Skip to content

Commit

Permalink
fix: Change disallowed application destination message (#14284) (#14307
Browse files Browse the repository at this point in the history
…) (#14326)

* change disallowed application destinations message



* Changed e2e tests



---------

Signed-off-by: michaelkot97 <michael.kot97@gmail.com>
Co-authored-by: Michael Kotelnikov <36506417+michaelkotelnikov@users.noreply.github.com>
  • Loading branch information
1 parent fa74998 commit 2d6d30c
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion test/e2e/app_management_ns_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1179,7 +1179,7 @@ func TestNamespacedPermissions(t *testing.T) {
Create()

sourceError := fmt.Sprintf("application repo %s is not permitted in project 'argo-project'", RepoURL(RepoURLTypeFile))
destinationError := fmt.Sprintf("application destination {%s %s} is not permitted in project 'argo-project'", KubernetesInternalAPIServerAddr, DeploymentNamespace())
destinationError := fmt.Sprintf("application destination server '%s' and namespace '%s' do not match any of the allowed destinations in project 'argo-project'", KubernetesInternalAPIServerAddr, DeploymentNamespace())

appCtx.
Path("guestbook-logs").
Expand Down
6 changes: 3 additions & 3 deletions test/e2e/app_management_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1472,7 +1472,7 @@ func TestPermissions(t *testing.T) {
Create()

sourceError := fmt.Sprintf("application repo %s is not permitted in project 'argo-project'", RepoURL(RepoURLTypeFile))
destinationError := fmt.Sprintf("application destination {%s %s} is not permitted in project 'argo-project'", KubernetesInternalAPIServerAddr, DeploymentNamespace())
destinationError := fmt.Sprintf("application destination server '%s' and namespace '%s' do not match any of the allowed destinations in project 'argo-project'", KubernetesInternalAPIServerAddr, DeploymentNamespace())

appCtx.
Path("guestbook-logs").
Expand Down Expand Up @@ -1628,7 +1628,7 @@ func TestPermissionDeniedWithNegatedNamespace(t *testing.T) {
IgnoreErrors().
CreateApp().
Then().
Expect(Error("", "is not permitted in project"))
Expect(Error("", "do not match any of the allowed destinations in project"))
}

func TestPermissionDeniedWithNegatedServer(t *testing.T) {
Expand All @@ -1655,7 +1655,7 @@ func TestPermissionDeniedWithNegatedServer(t *testing.T) {
IgnoreErrors().
CreateApp().
Then().
Expect(Error("", "is not permitted in project"))
Expect(Error("", "do not match any of the allowed destinations in project"))
}

// make sure that if we deleted a resource from the app, it is not pruned if annotated with Prune=false
Expand Down
2 changes: 1 addition & 1 deletion util/argo/argo.go
Original file line number Diff line number Diff line change
Expand Up @@ -585,7 +585,7 @@ func ValidatePermissions(ctx context.Context, spec *argoappv1.ApplicationSpec, p
if !permitted {
conditions = append(conditions, argoappv1.ApplicationCondition{
Type: argoappv1.ApplicationConditionInvalidSpecError,
Message: fmt.Sprintf("application destination {%s %s} is not permitted in project '%s'", spec.Destination.Server, spec.Destination.Namespace, spec.Project),
Message: fmt.Sprintf("application destination server '%s' and namespace '%s' do not match any of the allowed destinations in project '%s'", spec.Destination.Server, spec.Destination.Namespace, spec.Project),
})
}
// Ensure the k8s cluster the app is referencing, is configured in Argo CD
Expand Down

0 comments on commit 2d6d30c

Please sign in to comment.