Skip to content

Commit 62fe52c

Browse files
committed
Reverse logic
1 parent c96be43 commit 62fe52c

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ kubectl run --image nginx nginx-1
9595
vs
9696

9797
```bash
98-
kubectl run --image nope nginx-1
98+
kubectl run --image nope nginx-2
9999
```
100100

101101
You're now done! 🧞

main.go

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -87,13 +87,13 @@ func imagineHandler(imageName string) http.HandlerFunc {
8787
return
8888
}
8989

90-
var allowed bool
91-
reason := fmt.Sprintf("image name contains disallowed string: %s", imageName)
90+
allowed := true
91+
reason := "Image name is allowed"
9292

9393
for _, container := range imageReview.Spec.Containers {
94-
if !strings.Contains(container.Image, imageName) {
95-
allowed = true
96-
reason = ""
94+
if strings.Contains(container.Image, imageName) {
95+
allowed = false
96+
reason = fmt.Sprintf("image name contains disallowed string: %s", imageName)
9797
break
9898
}
9999
}

0 commit comments

Comments
 (0)