Skip to content

Commit a431b39

Browse files
camilamacedo86timflannagan
authored andcommitted
fix: clarifies message error regards service account (openshift#174)
* fix: clarifies message error regards service account * apply suggestions Upstream-repository: api Upstream-commit: f579141ce61d8bb7c4dc7c06169bc436ac4b9703
1 parent 7bc1b26 commit a431b39

File tree

3 files changed

+12
-4
lines changed

3 files changed

+12
-4
lines changed

staging/api/pkg/validation/internal/bundle.go

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,11 @@ func validateServiceAccounts(bundle *manifests.Bundle) []errors.Error {
5252
sa := v1.ServiceAccount{}
5353
if err := runtime.DefaultUnstructuredConverter.FromUnstructured(obj.Object, &sa); err == nil {
5454
if _, ok := saNamesFromCSV[sa.Name]; ok {
55-
errs = append(errs, errors.ErrInvalidBundle("invalid service account found in bundle. sa name cannot match service account defined for deployment spec in CSV", sa.Name))
55+
errs = append(errs, errors.ErrInvalidBundle(fmt.Sprintf("invalid service account found in bundle. " +
56+
"This service account %s in your bundle is not valid, because a service account with the same name " +
57+
"was already specified in your CSV. If this was unintentional, please remove the service account " +
58+
"manifest from your bundle. If it was intentional to specify a separate service account, " +
59+
"please rename the SA in either the bundle manifest or the CSV.",sa.Name), sa.Name))
5660
}
5761
}
5862
}

staging/api/pkg/validation/internal/bundle_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ func TestValidateBundle(t *testing.T) {
4949
description: "invalid bundle service account can't match sa in csv",
5050
directory: "./testdata/invalid_bundle_sa",
5151
hasError: true,
52-
errString: `invalid service account found in bundle. sa name cannot match service account defined for deployment spec in CSV`,
52+
errString: `invalid service account found in bundle. This service account etcd-operator in your bundle is not valid, because a service account with the same name was already specified in your CSV. If this was unintentional, please remove the service account manifest from your bundle. If it was intentional to specify a separate service account, please rename the SA in either the bundle manifest or the CSV.`,
5353
},
5454
}
5555

@@ -141,7 +141,7 @@ func TestValidateServiceAccount(t *testing.T) {
141141
},
142142
},
143143
hasError: true,
144-
errString: `invalid service account found in bundle. sa name cannot match service account defined for deployment spec in CSV`,
144+
errString: `invalid service account found in bundle. This service account foo in your bundle is not valid, because a service account with the same name was already specified in your CSV. If this was unintentional, please remove the service account manifest from your bundle. If it was intentional to specify a separate service account, please rename the SA in either the bundle manifest or the CSV.`,
145145
},
146146
}
147147

vendor/github.com/operator-framework/api/pkg/validation/internal/bundle.go

Lines changed: 5 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)