-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
rewrite validate kyverno policies function to better handle rendered … (
#52) …templates
- Loading branch information
1 parent
6219e6f
commit 8fdae1a
Showing
4 changed files
with
115 additions
and
39 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
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
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,36 @@ | ||
apiVersion: apps/v1 | ||
kind: Deployment | ||
metadata: | ||
name: noncompliant-app | ||
labels: | ||
app: noncompliant-app | ||
spec: | ||
replicas: 1 | ||
selector: | ||
matchLabels: | ||
app: noncompliant-app | ||
template: | ||
metadata: | ||
labels: | ||
app: noncompliant-app | ||
spec: | ||
containers: | ||
- name: noncompliant-container | ||
image: mysql:latest # Violates "no latest tag" policy | ||
securityContext: | ||
capabilities: # Violates "disallow capabilities" policy | ||
add: | ||
- NET_ADMIN | ||
- SYS_MODULE | ||
privileged: true # Violates "no privileged containers" policy | ||
runAsNonRoot: false # Violates "must run as non-root" policy | ||
readOnlyRootFilesystem: false # Violates "read-only root filesystem" policy | ||
resources: | ||
requests: # Violates "resource requests and limits required" policy | ||
memory: "0" | ||
cpu: "0" | ||
limits: | ||
memory: "0" | ||
cpu: "0" | ||
ports: | ||
- containerPort: 3306 # Exposes a port without proper context |
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,36 @@ | ||
apiVersion: apps/v1 | ||
kind: Deployment | ||
metadata: | ||
name: compliance-app | ||
labels: | ||
app: compliance-app | ||
spec: | ||
replicas: 1 | ||
selector: | ||
matchLabels: | ||
app: compliance-app | ||
template: | ||
metadata: | ||
labels: | ||
app: compliance-app | ||
spec: | ||
containers: | ||
- name: compliance-container | ||
image: bitnami/redis:7.0.10 # Uses a specific, secure image version | ||
securityContext: | ||
runAsNonRoot: true # Enforces running as a non-root user | ||
runAsUser: 1001 # Specifies a non-root user ID | ||
allowPrivilegeEscalation: false # Prevents privilege escalation | ||
capabilities: # Drops unnecessary capabilities | ||
drop: | ||
- ALL | ||
readOnlyRootFilesystem: true # Makes the root filesystem immutable | ||
resources: | ||
requests: # Defines minimum resource requests | ||
memory: "64Mi" | ||
cpu: "250m" | ||
limits: # Defines maximum resource limits | ||
memory: "128Mi" | ||
cpu: "500m" | ||
ports: | ||
- containerPort: 6379 # Specifies the Redis port exposed by the container |