-
Notifications
You must be signed in to change notification settings - Fork 37
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added utils for labels duplicates (#61)
- Loading branch information
1 parent
4272392
commit fd117b9
Showing
3 changed files
with
26 additions
and
42 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
package utils.labels | ||
|
||
isCommonK8sLabelNotSet { | ||
not input.labels["app.kubernetes.io/name"] | ||
} | ||
|
||
isCommonK8sLabelNotSet { | ||
not input.labels["app.kubernetes.io/instance"] | ||
} | ||
|
||
isCommonK8sLabelNotSet { | ||
not input.labels["app.kubernetes.io/component"] | ||
} | ||
|
||
isCommonK8sLabelNotSet { | ||
not input.labels["app.kubernetes.io/part-of"] | ||
} | ||
|
||
isCommonK8sLabelNotSet { | ||
not input.labels["app.kubernetes.io/managed-by"] | ||
} |
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 |
---|---|---|
@@ -1,27 +1,9 @@ | ||
package main | ||
|
||
import data.utils.labels | ||
|
||
warn[msg] { | ||
isCommonK8sLabelNotSet with input as input.metadata | ||
labels.isCommonK8sLabelNotSet with input as input.metadata | ||
|
||
msg := sprintf("%s/%s: does not contain all the expected k8s labels in 'metadata.labels'. See: https://kubernetes.io/docs/concepts/overview/working-with-objects/common-labels", [input.kind, input.metadata.name]) | ||
} | ||
|
||
isCommonK8sLabelNotSet { | ||
not input.labels["app.kubernetes.io/name"] | ||
} | ||
|
||
isCommonK8sLabelNotSet { | ||
not input.labels["app.kubernetes.io/instance"] | ||
} | ||
|
||
isCommonK8sLabelNotSet { | ||
not input.labels["app.kubernetes.io/component"] | ||
} | ||
|
||
isCommonK8sLabelNotSet { | ||
not input.labels["app.kubernetes.io/part-of"] | ||
} | ||
|
||
isCommonK8sLabelNotSet { | ||
not input.labels["app.kubernetes.io/managed-by"] | ||
} |
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