Skip to content

Commit

Permalink
Added version to expected labels (#93)
Browse files Browse the repository at this point in the history
  • Loading branch information
garethahealy authored Jul 27, 2020
1 parent acb7840 commit 76e721d
Show file tree
Hide file tree
Showing 27 changed files with 143 additions and 1 deletion.
10 changes: 10 additions & 0 deletions _test/all-namespaces/ocp/bestpractices/all.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ objects:
labels:
app.kubernetes.io/name: Foo
app.kubernetes.io/instance: Bar
app.kubernetes.io/version: v1
app.kubernetes.io/component: FooBar
app.kubernetes.io/part-of: Foo
app.kubernetes.io/managed-by: Bar
Expand All @@ -29,6 +30,7 @@ objects:
matchLabels:
app.kubernetes.io/name: Foo
app.kubernetes.io/instance: Bar
app.kubernetes.io/version: v1
app.kubernetes.io/component: FooBar
app.kubernetes.io/part-of: Foo
app.kubernetes.io/managed-by: Bar
Expand All @@ -40,6 +42,7 @@ objects:
labels:
app.kubernetes.io/name: Foo
app.kubernetes.io/instance: Bar
app.kubernetes.io/version: v1
app.kubernetes.io/component: FooBar
app.kubernetes.io/part-of: Foo
app.kubernetes.io/managed-by: Bar
Expand All @@ -51,6 +54,7 @@ objects:
selector:
app.kubernetes.io/name: Foo
app.kubernetes.io/instance: Bar
app.kubernetes.io/version: v1
app.kubernetes.io/component: FooBar
app.kubernetes.io/part-of: Foo
app.kubernetes.io/managed-by: Bar
Expand All @@ -64,6 +68,7 @@ objects:
matchLabels:
app.kubernetes.io/name: Foo
app.kubernetes.io/instance: Bar
app.kubernetes.io/version: v1
app.kubernetes.io/component: FooBar
app.kubernetes.io/part-of: Foo
app.kubernetes.io/managed-by: Bar
Expand All @@ -73,6 +78,7 @@ objects:
labels:
app.kubernetes.io/name: Foo
app.kubernetes.io/instance: Bar
app.kubernetes.io/version: v1
app.kubernetes.io/component: FooBar
app.kubernetes.io/part-of: Foo
app.kubernetes.io/managed-by: Bar
Expand All @@ -83,6 +89,7 @@ objects:
matchLabels:
app.kubernetes.io/name: Foo
app.kubernetes.io/instance: Bar
app.kubernetes.io/version: v1
app.kubernetes.io/component: FooBar
app.kubernetes.io/part-of: Foo
app.kubernetes.io/managed-by: Bar
Expand All @@ -91,6 +98,7 @@ objects:
labels:
app.kubernetes.io/name: Foo
app.kubernetes.io/instance: Bar
app.kubernetes.io/version: v1
app.kubernetes.io/component: FooBar
app.kubernetes.io/part-of: Foo
app.kubernetes.io/managed-by: Bar
Expand Down Expand Up @@ -145,6 +153,7 @@ objects:
labels:
app.kubernetes.io/name: Foo
app.kubernetes.io/instance: Bar
app.kubernetes.io/version: v1
app.kubernetes.io/component: FooBar
app.kubernetes.io/part-of: Foo
app.kubernetes.io/managed-by: Bar
Expand All @@ -156,6 +165,7 @@ objects:
labels:
app.kubernetes.io/name: Foo
app.kubernetes.io/instance: Bar
app.kubernetes.io/version: v1
app.kubernetes.io/component: FooBar
app.kubernetes.io/part-of: Foo
app.kubernetes.io/managed-by: Bar
Expand Down
2 changes: 1 addition & 1 deletion policy/ocp/bestpractices/common-k8s-labels-notset/src.rego
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ violation[msg] {
is_common_labels_set(metadata) {
metadata.labels["app.kubernetes.io/name"]
metadata.labels["app.kubernetes.io/instance"]
#metadata.labels["app.kubernetes.io/version"]
metadata.labels["app.kubernetes.io/version"]
metadata.labels["app.kubernetes.io/component"]
metadata.labels["app.kubernetes.io/part-of"]
metadata.labels["app.kubernetes.io/managed-by"]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ items:
matchLabels:
app.kubernetes.io/name: Foo
app.kubernetes.io/instance: Bar
app.kubernetes.io/version: v1
app.kubernetes.io/component: FooBar
app.kubernetes.io/part-of: Foo
app.kubernetes.io/managed-by: Bar
Expand All @@ -20,6 +21,7 @@ items:
labels:
app.kubernetes.io/name: Foo
app.kubernetes.io/instance: Bar
app.kubernetes.io/version: v1
app.kubernetes.io/component: FooBar
app.kubernetes.io/part-of: Foo
app.kubernetes.io/managed-by: Bar
Expand Down Expand Up @@ -72,6 +74,7 @@ items:
labels:
app.kubernetes.io/name: Foo
app.kubernetes.io/instance: Bar
app.kubernetes.io/version: v1
app.kubernetes.io/component: FooBar
app.kubernetes.io/part-of: Foo
app.kubernetes.io/managed-by: Bar
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ items:
labels:
app.kubernetes.io/name: Foo
app.kubernetes.io/instance: Bar
app.kubernetes.io/version: v1
app.kubernetes.io/component: FooBar
app.kubernetes.io/part-of: Foo
app.kubernetes.io/managed-by: Bar
Expand All @@ -18,6 +19,7 @@ items:
matchLabels:
app.kubernetes.io/name: Foo
app.kubernetes.io/instance: Bar
app.kubernetes.io/version: v1
app.kubernetes.io/component: FooBar
app.kubernetes.io/part-of: Foo
app.kubernetes.io/managed-by: Bar
Expand All @@ -26,6 +28,7 @@ items:
labels:
app.kubernetes.io/name: Foo
app.kubernetes.io/instance: Bar
app.kubernetes.io/version: v1
app.kubernetes.io/component: FooBar
app.kubernetes.io/part-of: Foo
app.kubernetes.io/managed-by: Bar
Expand Down Expand Up @@ -66,6 +69,7 @@ items:
labels:
app.kubernetes.io/name: Foo
app.kubernetes.io/instance: Bar
app.kubernetes.io/version: v1
app.kubernetes.io/component: FooBar
app.kubernetes.io/part-of: Foo
app.kubernetes.io/managed-by: Bar
Expand All @@ -77,6 +81,7 @@ items:
labels:
app.kubernetes.io/name: Foo
app.kubernetes.io/instance: Bar
app.kubernetes.io/version: v1
app.kubernetes.io/component: FooBar
app.kubernetes.io/part-of: Foo
app.kubernetes.io/managed-by: Bar
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ items:
labels:
app.kubernetes.io/name: Foo
app.kubernetes.io/instance: Bar
app.kubernetes.io/version: v1
app.kubernetes.io/component: FooBar
app.kubernetes.io/part-of: Foo
app.kubernetes.io/managed-by: Bar
Expand All @@ -18,6 +19,7 @@ items:
matchLabels:
app.kubernetes.io/name: Foo
app.kubernetes.io/instance: Bar
app.kubernetes.io/version: v1
app.kubernetes.io/component: FooBar
app.kubernetes.io/part-of: Foo
app.kubernetes.io/managed-by: Bar
Expand All @@ -26,6 +28,7 @@ items:
labels:
app.kubernetes.io/name: Foo
app.kubernetes.io/instance: Bar
app.kubernetes.io/version: v1
app.kubernetes.io/component: FooBar
app.kubernetes.io/part-of: Foo
app.kubernetes.io/managed-by: Bar
Expand Down Expand Up @@ -71,6 +74,7 @@ items:
labels:
app.kubernetes.io/name: Foo
app.kubernetes.io/instance: Bar
app.kubernetes.io/version: v1
app.kubernetes.io/component: FooBar
app.kubernetes.io/part-of: Foo
app.kubernetes.io/managed-by: Bar
Expand All @@ -82,6 +86,7 @@ items:
labels:
app.kubernetes.io/name: Foo
app.kubernetes.io/instance: Bar
app.kubernetes.io/version: v1
app.kubernetes.io/component: FooBar
app.kubernetes.io/part-of: Foo
app.kubernetes.io/managed-by: Bar
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ items:
labels:
app.kubernetes.io/name: Foo
app.kubernetes.io/instance: Bar
app.kubernetes.io/version: v1
app.kubernetes.io/component: FooBar
app.kubernetes.io/part-of: Foo
app.kubernetes.io/managed-by: Bar
Expand All @@ -18,6 +19,7 @@ items:
matchLabels:
app.kubernetes.io/name: Foo
app.kubernetes.io/instance: Bar
app.kubernetes.io/version: v1
app.kubernetes.io/component: FooBar
app.kubernetes.io/part-of: Foo
app.kubernetes.io/managed-by: Bar
Expand All @@ -26,6 +28,7 @@ items:
labels:
app.kubernetes.io/name: Foo
app.kubernetes.io/instance: Bar
app.kubernetes.io/version: v1
app.kubernetes.io/component: FooBar
app.kubernetes.io/part-of: Foo
app.kubernetes.io/managed-by: Bar
Expand Down Expand Up @@ -72,6 +75,7 @@ items:
labels:
app.kubernetes.io/name: Foo
app.kubernetes.io/instance: Bar
app.kubernetes.io/version: v1
app.kubernetes.io/component: FooBar
app.kubernetes.io/part-of: Foo
app.kubernetes.io/managed-by: Bar
Expand All @@ -82,6 +86,7 @@ items:
matchLabels:
app.kubernetes.io/name: Foo
app.kubernetes.io/instance: Bar
app.kubernetes.io/version: v1
app.kubernetes.io/component: FooBar
app.kubernetes.io/part-of: Foo
app.kubernetes.io/managed-by: Bar
Expand All @@ -90,6 +95,7 @@ items:
labels:
app.kubernetes.io/name: Foo
app.kubernetes.io/instance: Bar
app.kubernetes.io/version: v1
app.kubernetes.io/component: FooBar
app.kubernetes.io/part-of: Foo
app.kubernetes.io/managed-by: Bar
Expand Down Expand Up @@ -136,6 +142,7 @@ items:
labels:
app.kubernetes.io/name: Foo
app.kubernetes.io/instance: Bar
app.kubernetes.io/version: v1
app.kubernetes.io/component: FooBar
app.kubernetes.io/part-of: Foo
app.kubernetes.io/managed-by: Bar
Expand All @@ -146,6 +153,7 @@ items:
matchLabels:
app.kubernetes.io/name: Foo
app.kubernetes.io/instance: Bar
app.kubernetes.io/version: v1
app.kubernetes.io/component: FooBar
app.kubernetes.io/part-of: Foo
app.kubernetes.io/managed-by: Bar
Expand All @@ -154,6 +162,7 @@ items:
labels:
app.kubernetes.io/name: Foo
app.kubernetes.io/instance: Bar
app.kubernetes.io/version: v1
app.kubernetes.io/component: FooBar
app.kubernetes.io/part-of: Foo
app.kubernetes.io/managed-by: Bar
Expand Down Expand Up @@ -201,6 +210,7 @@ items:
labels:
app.kubernetes.io/name: Foo
app.kubernetes.io/instance: Bar
app.kubernetes.io/version: v1
app.kubernetes.io/component: FooBar
app.kubernetes.io/part-of: Foo
app.kubernetes.io/managed-by: Bar
Expand All @@ -212,6 +222,7 @@ items:
labels:
app.kubernetes.io/name: Foo
app.kubernetes.io/instance: Bar
app.kubernetes.io/version: v1
app.kubernetes.io/component: FooBar
app.kubernetes.io/part-of: Foo
app.kubernetes.io/managed-by: Bar
Expand Down Expand Up @@ -260,6 +271,7 @@ items:
labels:
app.kubernetes.io/name: Foo
app.kubernetes.io/instance: Bar
app.kubernetes.io/version: v1
app.kubernetes.io/component: FooBar
app.kubernetes.io/part-of: Foo
app.kubernetes.io/managed-by: Bar
Expand All @@ -271,6 +283,7 @@ items:
labels:
app.kubernetes.io/name: Foo
app.kubernetes.io/instance: Bar
app.kubernetes.io/version: v1
app.kubernetes.io/component: FooBar
app.kubernetes.io/part-of: Foo
app.kubernetes.io/managed-by: Bar
Expand Down Expand Up @@ -319,6 +332,7 @@ items:
labels:
app.kubernetes.io/name: Foo
app.kubernetes.io/instance: Bar
app.kubernetes.io/version: v1
app.kubernetes.io/component: FooBar
app.kubernetes.io/part-of: Foo
app.kubernetes.io/managed-by: Bar
Expand All @@ -330,6 +344,7 @@ items:
labels:
app.kubernetes.io/name: Foo
app.kubernetes.io/instance: Bar
app.kubernetes.io/version: v1
app.kubernetes.io/component: FooBar
app.kubernetes.io/part-of: Foo
app.kubernetes.io/managed-by: Bar
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ items:
labels:
app.kubernetes.io/name: Foo
app.kubernetes.io/instance: Bar
app.kubernetes.io/version: v1
app.kubernetes.io/component: FooBar
app.kubernetes.io/part-of: Foo
app.kubernetes.io/managed-by: Bar
Expand All @@ -20,6 +21,7 @@ items:
matchLabels:
app.kubernetes.io/name: Foo
app.kubernetes.io/instance: Bar
app.kubernetes.io/version: v1
app.kubernetes.io/component: FooBar
app.kubernetes.io/part-of: Foo
app.kubernetes.io/managed-by: Bar
Expand All @@ -28,6 +30,7 @@ items:
labels:
app.kubernetes.io/name: Foo
app.kubernetes.io/instance: Bar
app.kubernetes.io/version: v1
app.kubernetes.io/component: FooBar
app.kubernetes.io/part-of: Foo
app.kubernetes.io/managed-by: Bar
Expand Down Expand Up @@ -75,6 +78,7 @@ items:
labels:
app.kubernetes.io/name: Foo
app.kubernetes.io/instance: Bar
app.kubernetes.io/version: v1
app.kubernetes.io/component: FooBar
app.kubernetes.io/part-of: Foo
app.kubernetes.io/managed-by: Bar
Expand All @@ -88,6 +92,7 @@ items:
labels:
app.kubernetes.io/name: Foo
app.kubernetes.io/instance: Bar
app.kubernetes.io/version: v1
app.kubernetes.io/component: FooBar
app.kubernetes.io/part-of: Foo
app.kubernetes.io/managed-by: Bar
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ items:
labels:
app.kubernetes.io/name: Foo
app.kubernetes.io/instance: Bar
app.kubernetes.io/version: v1
app.kubernetes.io/component: FooBar
app.kubernetes.io/part-of: Foo
app.kubernetes.io/managed-by: Bar
Expand All @@ -18,6 +19,7 @@ items:
matchLabels:
app.kubernetes.io/name: Foo
app.kubernetes.io/instance: Bar
app.kubernetes.io/version: v1
app.kubernetes.io/component: FooBar
app.kubernetes.io/part-of: Foo
app.kubernetes.io/managed-by: Bar
Expand All @@ -26,6 +28,7 @@ items:
labels:
app.kubernetes.io/name: Foo
app.kubernetes.io/instance: Bar
app.kubernetes.io/version: v1
app.kubernetes.io/component: FooBar
app.kubernetes.io/part-of: Foo
app.kubernetes.io/managed-by: Bar
Expand Down Expand Up @@ -72,6 +75,7 @@ items:
labels:
app.kubernetes.io/name: Foo
app.kubernetes.io/instance: Bar
app.kubernetes.io/version: v1
app.kubernetes.io/component: FooBar
app.kubernetes.io/part-of: Foo
app.kubernetes.io/managed-by: Bar
Expand All @@ -83,6 +87,7 @@ items:
labels:
app.kubernetes.io/name: Foo
app.kubernetes.io/instance: Bar
app.kubernetes.io/version: v1
app.kubernetes.io/component: FooBar
app.kubernetes.io/part-of: Foo
app.kubernetes.io/managed-by: Bar
Expand Down
Loading

0 comments on commit 76e721d

Please sign in to comment.