-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
INSIGHTS-519 Support .util validation during validation runtime (#217)
* [WIP] INSIGHTS-520 Lib support to OPA validation * Removed code * Removed code * Removed code * Fixed issue * Adding etsts * Upgraded libs * Revert "Upgraded libs" This reverts commit 29da67b. * Upgraded libs * Added tests * Added tests * Added tests * Added tests * Added tests * Merge * Fixed issue * Fixed issue
- Loading branch information
Showing
9 changed files
with
137 additions
and
15 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
package fairwinds | ||
|
||
import data.utils.array_contains | ||
|
||
labelrequired[actionItem] { | ||
requiredLabelValue := "development" | ||
provided := [input.metadata.labels[_]] | ||
not array_contains(provided, requiredLabelValue) | ||
description := sprintf("Label value %v is missing", [requiredLabelValue]) | ||
actionItem := { | ||
"title": "Label is missing", | ||
"description": description, | ||
"severity": .2, | ||
"remediation": "Add the label", | ||
"category": "Reliability" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
123 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
package fairwinds | ||
|
||
import data.utils.array_contains | ||
|
||
labelrequired[actionItem] { | ||
requiredLabelValue := "development" | ||
provided := [input.metadata.labels[_]] | ||
not array_contains(provided, requiredLabelValue) | ||
description := sprintf("Label value %v is missing", [requiredLabelValue]) | ||
actionItem := { | ||
"title": "Label is missing", | ||
"description": description, | ||
"severity": .2, | ||
"remediation": "Add the label", | ||
"category": "Reliability" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
package utils | ||
|
||
array_contains(array, elem) { | ||
lower(array[_]) = lower(elem) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
apiVersion: apps/v1 | ||
kind: Deployment | ||
metadata: | ||
name: policy-test | ||
labels: | ||
department: development | ||
spec: | ||
replicas: 1 | ||
template: | ||
spec: | ||
containers: | ||
- image: busybox |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
apiVersion: apps/v1 | ||
kind: Deployment | ||
metadata: | ||
name: policy-test | ||
labels: | ||
department: hr | ||
spec: | ||
replicas: 1 | ||
template: | ||
spec: | ||
containers: | ||
- image: busybox |