Skip to content

Commit

Permalink
final
Browse files Browse the repository at this point in the history
  • Loading branch information
Kévin PEREZ committed Jan 5, 2024
1 parent 69b68a7 commit fa27575
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 2 deletions.
4 changes: 4 additions & 0 deletions Readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,10 @@ For specific exceptions, add another network policy.
| **CUSTOM_LABELS** | *Add custom labels to namespaces* | `quota=managed,monitoring=true` | `no ` | - |
| **DEFAULT_PERMISSION** | *ClusterRole associated with default service account* | `view` | `no ` | - |
| **BLACKLIST** | *Ignore Project* | `my-project-dev` | `no ` | - |
| **PODSECURITYADMISSION_ENFORCEMENT** | *PodSecurityAdmission Enforcement* | `restricted` | `no ` | `baseline ` |
| **PODSECURITYADMISSION_WARNING** | *PodSecurityAdmission Warning* | `restricted` | `no ` | `restricted ` |
| **PODSECURITYADMISSION_AUDIT** | *PodSecurityAdmission Audit* | `restricted` | `no ` | `restricted ` |
| **PRIVILEGED_NAMESPACES** | *Namespaces allowed to use privileged annotation* | `native-development` | `no ` | - |

## Versioning

Expand Down
2 changes: 2 additions & 0 deletions internal/utils/constants.go
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,8 @@ const (
PodSecurityAdmissionEnforcement = "baseline"
PodSecurityAdmissionWarning = "restricted"
PodSecurityAdmissionAudit = "restricted"

PodSecurityPrivileged = "privileged"
)

var BlacklistedNamespaces = []string{
Expand Down
4 changes: 2 additions & 2 deletions internal/utils/helpers.go
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,8 @@ func Union(a map[string]string, b map[string]string) map[string]string {
func IsInPrivilegedNamespacesList(namespace string) string {
for _, nsItem := range Config.PrivilegedNamespaces {
if strings.Contains(nsItem, namespace) {
Log.Info().Msgf("Namespace %v is labeled as privileged", namespace)
return "privileged"
Log.Warn().Msgf("Namespace %v is labeled as privileged", namespace)
return PodSecurityPrivileged
}
}
return Config.PodSecurityAdmissionEnforcement
Expand Down

0 comments on commit fa27575

Please sign in to comment.