forked from badtuxx/giropops-senhas
-
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: Update dependencies and add Kyverno policies for Pod validation
- Loading branch information
nataliagranato
committed
Aug 26, 2024
1 parent
caa732b
commit 1c91929
Showing
5 changed files
with
72 additions
and
1 deletion.
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,18 @@ | ||
apiVersion: kyverno.io/v1 | ||
kind: ClusterPolicy | ||
metadata: | ||
name: no-root-containers | ||
spec: | ||
rules: | ||
- name: require-non-root | ||
match: | ||
resources: | ||
kinds: | ||
- Pod | ||
validate: | ||
message: "Containers must not run as root" | ||
pattern: | ||
spec: | ||
containers: | ||
- securityContext: | ||
runAsNonRoot: true |
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,19 @@ | ||
apiVersion: kyverno.io/v1 | ||
kind: ClusterPolicy | ||
metadata: | ||
name: require-labels | ||
spec: | ||
validationFailureAction: Audit | ||
rules: | ||
- name: check-for-labels | ||
match: | ||
any: | ||
- resources: | ||
kinds: | ||
- Pod | ||
validate: | ||
message: "label 'app' is required" | ||
pattern: | ||
metadata: | ||
labels: | ||
app: "?*" |
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,32 @@ | ||
apiVersion: kyverno.io/v1 | ||
kind: ClusterPolicy | ||
metadata: | ||
name: require-requests-limits | ||
annotations: | ||
policies.kyverno.io/title: Require Limits and Requests | ||
policies.kyverno.io/severity: medium | ||
policies.kyverno.io/subject: Pod | ||
policies.kyverno.io/minversion: 1.6.0 | ||
policies.kyverno.io/description: >- | ||
As application workloads share cluster resources, it is important to limit resources requested and consumed by each Pod. It is recommended to require resource requests and limits per Pod, especially for memory and CPU. If a Namespace level request or limit is specified, defaults will automatically be applied to each Pod based on the LimitRange configuration. This policy validates that all containers have something specified for memory and CPU requests and memory limits. | ||
spec: | ||
validationFailureAction: Audit | ||
background: true | ||
rules: | ||
- name: validate-resources | ||
match: | ||
any: | ||
- resources: | ||
kinds: | ||
- Pod | ||
validate: | ||
message: "CPU and memory resource requests and limits are required." | ||
pattern: | ||
spec: | ||
containers: | ||
- resources: | ||
requests: | ||
memory: "?*" | ||
cpu: "?*" | ||
limits: | ||
memory: "?*" |