-
Notifications
You must be signed in to change notification settings - Fork 240
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' into add-test-copynslabel
- Loading branch information
Showing
59 changed files
with
1,531 additions
and
11 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
39 changes: 39 additions & 0 deletions
39
other-cel/memory-requests-equal-limits/.chainsaw-test/chainsaw-test.yaml
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,39 @@ | ||
# yaml-language-server: $schema=https://raw.githubusercontent.com/kyverno/chainsaw/main/.schemas/json/test-chainsaw-v1alpha1.json | ||
apiVersion: chainsaw.kyverno.io/v1alpha1 | ||
kind: Test | ||
metadata: | ||
creationTimestamp: null | ||
name: memory-requests-equal-limits | ||
spec: | ||
steps: | ||
- name: step-01 | ||
try: | ||
- apply: | ||
file: ../memory-requests-equal-limits.yaml | ||
- patch: | ||
resource: | ||
apiVersion: kyverno.io/v1 | ||
kind: ClusterPolicy | ||
metadata: | ||
name: memory-requests-equal-limits | ||
spec: | ||
validationFailureAction: Enforce | ||
- assert: | ||
file: policy-ready.yaml | ||
- name: step-02 | ||
try: | ||
- apply: | ||
file: pod-good.yaml | ||
- apply: | ||
expect: | ||
- check: | ||
($error != null): true | ||
file: pod-bad.yaml | ||
- apply: | ||
file: podcontroller-good.yaml | ||
- apply: | ||
expect: | ||
- check: | ||
($error != null): true | ||
file: podcontroller-bad.yaml | ||
|
77 changes: 77 additions & 0 deletions
77
other-cel/memory-requests-equal-limits/.chainsaw-test/pod-bad.yaml
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,77 @@ | ||
apiVersion: v1 | ||
kind: Pod | ||
metadata: | ||
name: badpod01 | ||
spec: | ||
containers: | ||
- name: busybox | ||
image: busybox:1.35 | ||
resources: | ||
requests: | ||
memory: "100Mi" | ||
limits: | ||
memory: "200Mi" | ||
--- | ||
apiVersion: v1 | ||
kind: Pod | ||
metadata: | ||
name: badpod02 | ||
spec: | ||
containers: | ||
- name: busybox | ||
image: busybox:1.35 | ||
resources: | ||
requests: | ||
memory: "10Mi" | ||
limits: | ||
memory: "140Mi" | ||
- name: busybox02 | ||
image: busybox:1.35 | ||
resources: | ||
requests: | ||
memory: "100Mi" | ||
limits: | ||
memory: "150Mi" | ||
--- | ||
apiVersion: v1 | ||
kind: Pod | ||
metadata: | ||
name: badpod03 | ||
spec: | ||
containers: | ||
- name: busybox | ||
image: busybox:1.35 | ||
resources: | ||
requests: | ||
memory: "120Mi" | ||
limits: | ||
memory: "120Mi" | ||
- name: busybox02 | ||
image: busybox:1.35 | ||
resources: | ||
requests: | ||
memory: "100Mi" | ||
limits: | ||
memory: "150Mi" | ||
--- | ||
apiVersion: v1 | ||
kind: Pod | ||
metadata: | ||
name: badpod04 | ||
spec: | ||
containers: | ||
- name: busybox02 | ||
image: busybox:1.35 | ||
resources: | ||
requests: | ||
memory: "100Mi" | ||
limits: | ||
memory: "200Mi" | ||
- name: busybox | ||
image: busybox:1.35 | ||
resources: | ||
requests: | ||
memory: "100Mi" | ||
limits: | ||
memory: "100Mi" | ||
|
46 changes: 46 additions & 0 deletions
46
other-cel/memory-requests-equal-limits/.chainsaw-test/pod-good.yaml
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,46 @@ | ||
apiVersion: v1 | ||
kind: Pod | ||
metadata: | ||
name: goodpod00 | ||
spec: | ||
containers: | ||
- name: busybox | ||
image: busybox:1.35 | ||
--- | ||
apiVersion: v1 | ||
kind: Pod | ||
metadata: | ||
name: goodpod01 | ||
spec: | ||
containers: | ||
- name: busybox | ||
image: busybox:1.35 | ||
resources: | ||
requests: | ||
memory: "100Mi" | ||
limits: | ||
memory: "100Mi" | ||
--- | ||
apiVersion: v1 | ||
kind: Pod | ||
metadata: | ||
name: goodpod02 | ||
spec: | ||
containers: | ||
- name: busybox | ||
image: busybox:1.35 | ||
resources: | ||
requests: | ||
memory: "100Mi" | ||
limits: | ||
memory: "100Mi" | ||
- name: busybox02 | ||
image: busybox:1.35 | ||
- name: busybox03 | ||
image: busybox:1.35 | ||
resources: | ||
requests: | ||
memory: "50Mi" | ||
limits: | ||
memory: "50Mi" | ||
|
60 changes: 60 additions & 0 deletions
60
other-cel/memory-requests-equal-limits/.chainsaw-test/podcontroller-bad.yaml
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,60 @@ | ||
apiVersion: apps/v1 | ||
kind: Deployment | ||
metadata: | ||
labels: | ||
app: busybox | ||
name: baddeployment01 | ||
spec: | ||
replicas: 1 | ||
selector: | ||
matchLabels: | ||
app: busybox | ||
strategy: {} | ||
template: | ||
metadata: | ||
labels: | ||
app: busybox | ||
spec: | ||
containers: | ||
- name: busybox | ||
image: busybox:1.35 | ||
resources: | ||
requests: | ||
memory: "10Mi" | ||
limits: | ||
memory: "140Mi" | ||
- name: busybox02 | ||
image: busybox:1.35 | ||
resources: | ||
requests: | ||
memory: "100Mi" | ||
limits: | ||
memory: "150Mi" | ||
--- | ||
apiVersion: batch/v1 | ||
kind: CronJob | ||
metadata: | ||
name: badcronjob01 | ||
spec: | ||
schedule: "* * * * *" | ||
jobTemplate: | ||
spec: | ||
template: | ||
spec: | ||
containers: | ||
- name: busybox | ||
image: busybox:1.35 | ||
resources: | ||
requests: | ||
memory: "10Mi" | ||
limits: | ||
memory: "140Mi" | ||
- name: busybox02 | ||
image: busybox:1.35 | ||
resources: | ||
requests: | ||
memory: "100Mi" | ||
limits: | ||
memory: "150Mi" | ||
restartPolicy: OnFailure | ||
|
64 changes: 64 additions & 0 deletions
64
other-cel/memory-requests-equal-limits/.chainsaw-test/podcontroller-good.yaml
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,64 @@ | ||
apiVersion: apps/v1 | ||
kind: Deployment | ||
metadata: | ||
labels: | ||
app: busybox | ||
name: gooddeployment01 | ||
spec: | ||
replicas: 1 | ||
selector: | ||
matchLabels: | ||
app: busybox | ||
strategy: {} | ||
template: | ||
metadata: | ||
labels: | ||
app: busybox | ||
spec: | ||
containers: | ||
- name: busybox | ||
image: busybox:1.35 | ||
resources: | ||
requests: | ||
memory: "100Mi" | ||
limits: | ||
memory: "100Mi" | ||
- name: busybox02 | ||
image: busybox:1.35 | ||
- name: busybox03 | ||
image: busybox:1.35 | ||
resources: | ||
requests: | ||
memory: "50Mi" | ||
limits: | ||
memory: "50Mi" | ||
--- | ||
apiVersion: batch/v1 | ||
kind: CronJob | ||
metadata: | ||
name: goodcronjob01 | ||
spec: | ||
schedule: "* * * * *" | ||
jobTemplate: | ||
spec: | ||
template: | ||
spec: | ||
containers: | ||
- name: busybox | ||
image: busybox:1.35 | ||
resources: | ||
requests: | ||
memory: "100Mi" | ||
limits: | ||
memory: "100Mi" | ||
- name: busybox02 | ||
image: busybox:1.35 | ||
- name: busybox03 | ||
image: busybox:1.35 | ||
resources: | ||
requests: | ||
memory: "50Mi" | ||
limits: | ||
memory: "50Mi" | ||
restartPolicy: OnFailure | ||
|
7 changes: 7 additions & 0 deletions
7
other-cel/memory-requests-equal-limits/.chainsaw-test/policy-ready.yaml
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,7 @@ | ||
apiVersion: kyverno.io/v1 | ||
kind: ClusterPolicy | ||
metadata: | ||
name: memory-requests-equal-limits | ||
status: | ||
ready: true | ||
|
28 changes: 28 additions & 0 deletions
28
other-cel/memory-requests-equal-limits/.kyverno-test/kyverno-test.yaml
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,28 @@ | ||
apiVersion: cli.kyverno.io/v1alpha1 | ||
kind: Test | ||
metadata: | ||
name: memory-requests-equal-limits | ||
policies: | ||
- ../memory-requests-equal-limits.yaml | ||
resources: | ||
- resource.yaml | ||
results: | ||
- kind: CronJob | ||
policy: memory-requests-equal-limits | ||
resources: | ||
- hello | ||
result: pass | ||
rule: autogen-cronjob-memory-requests-equal-limits | ||
- kind: DaemonSet | ||
policy: memory-requests-equal-limits | ||
resources: | ||
- fluentd-elasticsearch | ||
result: pass | ||
rule: autogen-memory-requests-equal-limits | ||
- kind: Pod | ||
policy: memory-requests-equal-limits | ||
resources: | ||
- myapp-pod | ||
result: fail | ||
rule: memory-requests-equal-limits | ||
|
Oops, something went wrong.