Skip to content

Commit 942784b

Browse files
committed
fix
Signed-off-by: Pavel Okhlopkov <pavel.okhlopkov@flant.com>
1 parent 7767852 commit 942784b

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

pkg/linters/rbac/rules/placement.go

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -142,15 +142,21 @@ func objectRBACPlacementServiceAccount(m *module.Module, object storage.StoreObj
142142
return
143143
}
144144

145+
// проверяем ServiceAccount
146+
// если ServiceAccount имеет имя равное имени папок от папки templates до файла rbac-for-us.yaml,
147+
// то он должен быть в namespace модуля
148+
// если ServiceAccount имеет имя равное имени модуля + "-" + имени папок от папки templates до файла rbac-for-us.yaml,
149+
// то он должен быть в системном namespace Deckhouse
150+
145151
switch objectName {
146152
case serviceAccountName:
147153
if m.GetNamespace() != namespace {
148154
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)
155+
errorList.Errorf("Service account namespace should be equal to %q namespace. If the namespace is correct, change name to %q", m.GetNamespace(), expectedServiceAccountName)
150156
return
151157
}
152158

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)
159+
errorList.Errorf("Service account namespace should be equal to %q namespace.", m.GetNamespace())
154160
}
155161
return
156162
case expectedServiceAccountName:

0 commit comments

Comments
 (0)