Skip to content

Commit

Permalink
Reverse logic
Browse files Browse the repository at this point in the history
  • Loading branch information
mikejoh committed Nov 25, 2024
1 parent c96be43 commit 62fe52c
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ kubectl run --image nginx nginx-1
vs

```bash
kubectl run --image nope nginx-1
kubectl run --image nope nginx-2
```

You're now done! 🧞
Expand Down
10 changes: 5 additions & 5 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -87,13 +87,13 @@ func imagineHandler(imageName string) http.HandlerFunc {
return
}

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

for _, container := range imageReview.Spec.Containers {
if !strings.Contains(container.Image, imageName) {
allowed = true
reason = ""
if strings.Contains(container.Image, imageName) {
allowed = false
reason = fmt.Sprintf("image name contains disallowed string: %s", imageName)
break
}
}
Expand Down

0 comments on commit 62fe52c

Please sign in to comment.