forked from kyverno/kyverno
-
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.
Showing
46 changed files
with
671 additions
and
63 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
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
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
17 changes: 17 additions & 0 deletions
17
...licy/standard/existing/different-configurations-for-generate-existing/README.md
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,17 @@ | ||
## Description | ||
|
||
This test ensures that a generate policy works as expected in case one rule sets the `generateExisting` field whereas the other don't set it. It is expected that rules which don't set the field will use the higher level value `spec.generateExisting`. | ||
|
||
## Expected Behavior | ||
|
||
1. Create two Namespaces named `red-ns` and `green-ns`. | ||
|
||
2. Create a policy with two generate rules: | ||
- The first rule named `generate-network-policy` matches Namespaces sets the `generateExisting` to `true`. | ||
- The second rule named `generate-config-map` matches Namespaces and it doesn't set the field. It is expected that the rule will use the `spec.generateExisting` value which is `false`. | ||
|
||
3. It is expected that a NetworkPolicy will be generated for each Namespace whereas ConfigMaps will not be generated. | ||
|
||
## Reference Issue(s) | ||
|
||
N/A |
27 changes: 27 additions & 0 deletions
27
...olicy/standard/existing/different-configurations-for-generate-existing/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,27 @@ | ||
apiVersion: chainsaw.kyverno.io/v1alpha1 | ||
kind: Test | ||
metadata: | ||
creationTimestamp: null | ||
name: different-configurations-for-generate-existing | ||
spec: | ||
steps: | ||
- name: step-01 | ||
try: | ||
- apply: | ||
file: existing-resources.yaml | ||
- name: step-02 | ||
try: | ||
- apply: | ||
file: policy.yaml | ||
- assert: | ||
file: policy-ready.yaml | ||
- name: step-03 | ||
try: | ||
- sleep: | ||
duration: 3s | ||
- name: step-04 | ||
try: | ||
- assert: | ||
file: generated-resources.yaml | ||
- error: | ||
file: fail-generated-resources.yaml |
13 changes: 13 additions & 0 deletions
13
.../standard/existing/different-configurations-for-generate-existing/existing-resources.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,13 @@ | ||
apiVersion: v1 | ||
kind: Namespace | ||
metadata: | ||
name: red-ns | ||
labels: | ||
color: red | ||
--- | ||
apiVersion: v1 | ||
kind: Namespace | ||
metadata: | ||
name: green-ns | ||
labels: | ||
color: green |
21 changes: 21 additions & 0 deletions
21
...ard/existing/different-configurations-for-generate-existing/fail-generated-resources.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,21 @@ | ||
apiVersion: v1 | ||
data: | ||
KAFKA_ADDRESS: 192.168.10.13:9092,192.168.10.14:9092,192.168.10.15:9092 | ||
ZK_ADDRESS: 192.168.10.10:2181,192.168.10.11:2181,192.168.10.12:2181 | ||
kind: ConfigMap | ||
metadata: | ||
labels: | ||
somekey: somevalue | ||
name: zk-kafka-address | ||
namespace: red-ns | ||
--- | ||
apiVersion: v1 | ||
data: | ||
KAFKA_ADDRESS: 192.168.10.13:9092,192.168.10.14:9092,192.168.10.15:9092 | ||
ZK_ADDRESS: 192.168.10.10:2181,192.168.10.11:2181,192.168.10.12:2181 | ||
kind: ConfigMap | ||
metadata: | ||
labels: | ||
somekey: somevalue | ||
name: zk-kafka-address | ||
namespace: green-ns |
25 changes: 25 additions & 0 deletions
25
...standard/existing/different-configurations-for-generate-existing/generated-resources.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,25 @@ | ||
apiVersion: networking.k8s.io/v1 | ||
kind: NetworkPolicy | ||
metadata: | ||
labels: | ||
created-by: kyverno | ||
name: default-deny | ||
namespace: red-ns | ||
spec: | ||
podSelector: {} | ||
policyTypes: | ||
- Ingress | ||
- Egress | ||
--- | ||
apiVersion: networking.k8s.io/v1 | ||
kind: NetworkPolicy | ||
metadata: | ||
labels: | ||
created-by: kyverno | ||
name: default-deny | ||
namespace: green-ns | ||
spec: | ||
podSelector: {} | ||
policyTypes: | ||
- Ingress | ||
- Egress |
9 changes: 9 additions & 0 deletions
9
...policy/standard/existing/different-configurations-for-generate-existing/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,9 @@ | ||
apiVersion: kyverno.io/v1 | ||
kind: ClusterPolicy | ||
metadata: | ||
name: different-generate-existing-values | ||
status: | ||
conditions: | ||
- reason: Succeeded | ||
status: "True" | ||
type: Ready |
Oops, something went wrong.