-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: Ved Ratan <[email protected]>
- Loading branch information
Showing
17 changed files
with
808 additions
and
6 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,112 @@ | ||
# Test: `netpol-kubearmor-adapter-policy-creation` | ||
|
||
This test validates that creating a `dns-manipulation` SecurityIntent with SecurityIntentBinding generates the expected Network Policy and KubeArmor policy. | ||
|
||
|
||
## Steps | ||
|
||
| # | Name | Bindings | Try | Catch | Finally | | ||
|:-:|---|:-:|:-:|:-:|:-:| | ||
| 1 | [Create a SecurityIntent](#step-Create a SecurityIntent) | 0 | 1 | 0 | 0 | | ||
| 2 | [Create a SecurityIntentBinding](#step-Create a SecurityIntentBinding) | 0 | 1 | 0 | 0 | | ||
| 3 | [Verify NimbusPolicy creation](#step-Verify NimbusPolicy creation) | 0 | 1 | 0 | 0 | | ||
| 4 | [Verify NetworkPolicy creation](#step-Verify NetworkPolicy creation) | 0 | 1 | 0 | 0 | | ||
| 5 | [Verify KubeArmorPolicy creation](#step-Verify KubeArmorPolicy creation) | 0 | 1 | 0 | 0 | | ||
| 6 | [Verify status of created SecurityIntentBinding](#step-Verify status of created SecurityIntentBinding) | 0 | 1 | 0 | 0 | | ||
| 7 | [Verify status of created NimbusPolicy](#step-Verify status of created NimbusPolicy) | 0 | 1 | 0 | 0 | | ||
| 8 | [Verify that the corresponding netpol native policy is being updated in the NimbusPolicy status](#step-Verify that the corresponding netpol native policy is being updated in the NimbusPolicy status) | 0 | 1 | 0 | 0 | | ||
| 9 | [Verify that the corresponding kubearmor native policy is being updated in the NimbusPolicy status](#step-Verify that the corresponding kubearmor native policy is being updated in the NimbusPolicy status) | 0 | 1 | 0 | 0 | | ||
|
||
### Step: `Create a SecurityIntent` | ||
|
||
*No description* | ||
|
||
#### Try | ||
|
||
| # | Operation | Bindings | Outputs | Description | | ||
|:-:|---|:-:|:-:|---| | ||
| 1 | `apply` | 0 | 0 | *No description* | | ||
|
||
### Step: `Create a SecurityIntentBinding` | ||
|
||
*No description* | ||
|
||
#### Try | ||
|
||
| # | Operation | Bindings | Outputs | Description | | ||
|:-:|---|:-:|:-:|---| | ||
| 1 | `apply` | 0 | 0 | *No description* | | ||
|
||
### Step: `Verify NimbusPolicy creation` | ||
|
||
*No description* | ||
|
||
#### Try | ||
|
||
| # | Operation | Bindings | Outputs | Description | | ||
|:-:|---|:-:|:-:|---| | ||
| 1 | `assert` | 0 | 0 | *No description* | | ||
|
||
### Step: `Verify NetworkPolicy creation` | ||
|
||
*No description* | ||
|
||
#### Try | ||
|
||
| # | Operation | Bindings | Outputs | Description | | ||
|:-:|---|:-:|:-:|---| | ||
| 1 | `assert` | 0 | 0 | *No description* | | ||
|
||
### Step: `Verify KubeArmorPolicy creation` | ||
|
||
*No description* | ||
|
||
#### Try | ||
|
||
| # | Operation | Bindings | Outputs | Description | | ||
|:-:|---|:-:|:-:|---| | ||
| 1 | `assert` | 0 | 0 | *No description* | | ||
|
||
### Step: `Verify status of created SecurityIntentBinding` | ||
|
||
Verify the created SecurityIntentBinding status subresource includes the number and names of bound intents, along with the generated NimbusPolicy name. | ||
|
||
|
||
#### Try | ||
|
||
| # | Operation | Bindings | Outputs | Description | | ||
|:-:|---|:-:|:-:|---| | ||
| 1 | `assert` | 0 | 0 | *No description* | | ||
|
||
### Step: `Verify status of created NimbusPolicy` | ||
|
||
*No description* | ||
|
||
#### Try | ||
|
||
| # | Operation | Bindings | Outputs | Description | | ||
|:-:|---|:-:|:-:|---| | ||
| 1 | `assert` | 0 | 0 | *No description* | | ||
|
||
### Step: `Verify that the corresponding netpol native policy is being updated in the NimbusPolicy status` | ||
|
||
*No description* | ||
|
||
#### Try | ||
|
||
| # | Operation | Bindings | Outputs | Description | | ||
|:-:|---|:-:|:-:|---| | ||
| 1 | `script` | 0 | 0 | *No description* | | ||
|
||
### Step: `Verify that the corresponding kubearmor native policy is being updated in the NimbusPolicy status` | ||
|
||
*No description* | ||
|
||
#### Try | ||
|
||
| # | Operation | Bindings | Outputs | Description | | ||
|:-:|---|:-:|:-:|---| | ||
| 1 | `script` | 0 | 0 | *No description* | | ||
|
||
--- | ||
|
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,65 @@ | ||
# SPDX-License-Identifier: Apache-2.0 | ||
# Copyright 2023 Authors of Nimbus | ||
|
||
apiVersion: chainsaw.kyverno.io/v1alpha1 | ||
kind: Test | ||
metadata: | ||
name: netpol-kubearmor-adapter-policy-creation | ||
spec: | ||
description: > | ||
This test validates that creating a `dns-manipulation` SecurityIntent with SecurityIntentBinding generates the expected Network Policy and KubeArmor policy. | ||
steps: | ||
- name: "Create a SecurityIntent" | ||
try: | ||
- apply: | ||
file: ../../resources/namespaced/dns-manipulation-si.yaml | ||
|
||
- name: "Create a SecurityIntentBinding" | ||
try: | ||
- apply: | ||
file: ../../resources/namespaced/dns-manipulation-sib.yaml | ||
|
||
- name: "Verify NimbusPolicy creation" | ||
try: | ||
- assert: | ||
file: ../nimbus-policy-assert.yaml | ||
|
||
- name: "Verify NetworkPolicy creation" | ||
try: | ||
- assert: | ||
file: ../netpol.yaml | ||
|
||
- name: "Verify KubeArmorPolicy creation" | ||
try: | ||
- assert: | ||
file: ../ksp.yaml | ||
|
||
- name: "Verify status of created SecurityIntentBinding" | ||
description: > | ||
Verify the created SecurityIntentBinding status subresource includes the number and names of bound intents, | ||
along with the generated NimbusPolicy name. | ||
try: | ||
- assert: | ||
file: ../sib-status-assert.yaml | ||
|
||
- name: "Verify status of created NimbusPolicy" | ||
try: | ||
- assert: | ||
file: ../np-status-assert.yaml | ||
|
||
- name: "Verify that the corresponding NimbusPolicy status has been updated with the generated Network Policy" | ||
try: | ||
- script: | ||
content: kubectl get np -n $NAMESPACE dns-manipulation-binding -o=jsonpath='{.status.adapterPolicies}' | ||
check: | ||
(contains($stdout, 'NetworkPolicy/dns-manipulation-binding-dnsmanipulation')): true | ||
|
||
- name: "Verify that the corresponding NimbusPolicy status has been updated with the generated KubeArmor Policy" | ||
try: | ||
- script: | ||
content: kubectl get np -n $NAMESPACE dns-manipulation-binding -o=jsonpath='{.status.adapterPolicies}' | ||
check: | ||
(contains($stdout, 'KubeArmorPolicy/dns-manipulation-binding-dnsmanipulation')): true | ||
|
||
|
||
|
Oops, something went wrong.