Skip to content

Commit 7767852

Browse files
committed
change errors
Signed-off-by: Sinelnikov Michail <mikhail.sinelnikov@flant.com>
1 parent b83537e commit 7767852

File tree

1 file changed

+12
-2
lines changed

1 file changed

+12
-2
lines changed

pkg/linters/rbac/rules/placement.go

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -145,12 +145,22 @@ func objectRBACPlacementServiceAccount(m *module.Module, object storage.StoreObj
145145
switch objectName {
146146
case serviceAccountName:
147147
if m.GetNamespace() != namespace {
148-
errorList.Errorf("ServiceAccount should be deployed to %q", m.GetNamespace())
148+
if isDeckhouseSystemNamespace(namespace) {
149+
errorList.Errorf("Name of ServiceAccount in %q should be equal to %q namespace. If the namespace is correct, change name to %q", shortPath, serviceAccountName, expectedServiceAccountName)
150+
return
151+
}
152+
153+
errorList.Errorf("Name of ServiceAccount in %q should be equal to %q namespace. If this namespace is incorrect, change name to %q and change the namespace to system like \"d8-system\" or \"d8-monitoring\"", shortPath, serviceAccountName, expectedServiceAccountName)
149154
}
150155
return
151156
case expectedServiceAccountName:
152157
if !isDeckhouseSystemNamespace(namespace) {
153-
errorList.Error("ServiceAccount should be deployed to \"d8-system\" or \"d8-monitoring\"")
158+
if m.GetNamespace() != namespace {
159+
errorList.Errorf("Name of ServiceAccount in %q in namespace %q should be equal to system like \"d8-system\" or \"d8-monitoring\". If this namespaces is incorrect, change name to %q and change the namespace to %q", shortPath, serviceAccountName, expectedServiceAccountName, m.GetNamespace())
160+
return
161+
}
162+
163+
errorList.Errorf("Name of ServiceAccount in %q in namespace %q should be equal to system like \"d8-system\" or \"d8-monitoring\". If the name is correct, change the name to %q", shortPath, namespace, serviceAccountName)
154164
}
155165
return
156166
}

0 commit comments

Comments
 (0)