Skip to content

Commit ba23a2d

Browse files
kmarteauxzegl
authored andcommitted
Fix implied ignore annotations block in isEnabled function
1 parent 76f03ff commit ba23a2d

File tree

2 files changed

+23
-2
lines changed

2 files changed

+23
-2
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
apiVersion: v1
2+
kind: Pod
3+
metadata:
4+
name: kube-score-ignore-annotations
5+
annotations:
6+
"kube-score/ignore": container-security-context-readonlyrootfilesystem,pod-networkpolicy,container-security-context-user-group-id,pod-probes,container-resources
7+
spec:
8+
containers:
9+
- name: foobar
10+
image: foo/bar:123
11+
resources:
12+
limits:
13+
cpu: 200m
14+
memory: 1Gi
15+
ephemeral-storage: 2Gi
16+
requests:
17+
cpu: 200m

scorecard/enabled.go

+6-2
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,12 @@ func (so *ScoredObject) isEnabled(check ks.Check, annotations, childAnnotations
1313
if v == key {
1414
return true
1515
}
16-
if _, ok := impliedIgnoreAnnotations[v]; ok {
17-
return true
16+
if vals, ok := impliedIgnoreAnnotations[v]; ok {
17+
for i := range vals {
18+
if vals[i] == key {
19+
return true
20+
}
21+
}
1822
}
1923
}
2024
return false

0 commit comments

Comments
 (0)