Skip to content

Commit f579141

Browse files
fix: clarifies message error regards service account (#174)
* fix: clarifies message error regards service account * apply suggestions
1 parent 3e95d2c commit f579141

File tree

2 files changed

+7
-3
lines changed

2 files changed

+7
-3
lines changed

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
}

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

0 commit comments

Comments
 (0)