-
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.
Added test for copy-ns-labels policy (#967)
* Added test for copy-ns-labels policy Signed-off-by: siddhikhapare <[email protected]> * files fixed Signed-off-by: siddhikhapare <[email protected]> * error fixed Signed-off-by: siddhikhapare <[email protected]> * issue resolved Signed-off-by: siddhikhapare <[email protected]> * resource removed Signed-off-by: siddhikhapare <[email protected]> * chainsaw-test file fixed Signed-off-by: siddhikhapare <[email protected]> * container image name changed Signed-off-by: siddhikhapare <[email protected]> * files added Signed-off-by: siddhikhapare <[email protected]> * files deleted Signed-off-by: siddhikhapare <[email protected]> * test for label added Signed-off-by: siddhikhapare <[email protected]> * test file modified Signed-off-by: siddhikhapare <[email protected]> * Errors fixed Signed-off-by: siddhikhapare <[email protected]> * fixing lint error Signed-off-by: siddhikhapare <[email protected]> * fixing test error Signed-off-by: siddhikhapare <[email protected]> --------- Signed-off-by: siddhikhapare <[email protected]>
- Loading branch information
1 parent
f8d0175
commit a664743
Showing
5 changed files
with
167 additions
and
0 deletions.
There are no files selected for viewing
28 changes: 28 additions & 0 deletions
28
other/copy-namespace-labels/.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,28 @@ | ||
apiVersion: chainsaw.kyverno.io/v1alpha1 | ||
kind: Test | ||
metadata: | ||
name: copy-namespace-labels | ||
spec: | ||
steps: | ||
- name: step-01 | ||
try: | ||
- apply: | ||
file: ns.yaml | ||
- apply: | ||
file: ../copy-namespace-labels.yaml | ||
- assert: | ||
file: policy-ready.yaml | ||
- name: step-02 | ||
try: | ||
- apply: | ||
file: resource.yaml | ||
- assert: | ||
file: patchresource.yaml | ||
- error: | ||
resource: | ||
apiVersion: apps/v1 | ||
kind: Deployment | ||
metadata: | ||
namespace: within-ns | ||
labels: | ||
kubernetes.io/metadata.name: "within-ns" |
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: v1 | ||
kind: Namespace | ||
metadata: | ||
name: within-ns | ||
labels: | ||
owner: "any-corp" | ||
env: dev |
66 changes: 66 additions & 0 deletions
66
other/copy-namespace-labels/.chainsaw-test/patchresource.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,66 @@ | ||
apiVersion: apps/v1 | ||
kind: Deployment | ||
metadata: | ||
name: my-deployment-1 | ||
namespace: within-ns | ||
labels: | ||
app: good-app | ||
owner: "any-corp" | ||
env: dev | ||
spec: | ||
replicas: 1 | ||
selector: | ||
matchLabels: | ||
app: good-app | ||
template: | ||
metadata: | ||
labels: | ||
app: good-app | ||
spec: | ||
containers: | ||
- name: good-app-deploy | ||
image: busybox:1.35 | ||
--- | ||
apiVersion: apps/v1 | ||
kind: Deployment | ||
metadata: | ||
name: my-deployment-3 | ||
namespace: within-ns | ||
labels: | ||
owner: "any-corp" | ||
env: dev | ||
spec: | ||
replicas: 1 | ||
selector: | ||
matchLabels: | ||
app: my-app03 | ||
template: | ||
metadata: | ||
labels: | ||
app: my-app03 | ||
spec: | ||
containers: | ||
- name: my-app03-deploy | ||
image: busybox:1.35 | ||
--- | ||
apiVersion: apps/v1 | ||
kind: Deployment | ||
metadata: | ||
name: my-deployment-4 | ||
namespace: within-ns | ||
labels: | ||
owner: "any-corp" | ||
env: dev | ||
spec: | ||
replicas: 1 | ||
selector: | ||
matchLabels: | ||
app: my-app04 | ||
template: | ||
metadata: | ||
labels: | ||
app: my-app04 | ||
spec: | ||
containers: | ||
- name: my-app04-deploy | ||
image: busybox:1.35 |
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,6 @@ | ||
apiVersion: kyverno.io/v1 | ||
kind: ClusterPolicy | ||
metadata: | ||
name: copy-namespace-labels | ||
status: | ||
ready: 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,60 @@ | ||
apiVersion: apps/v1 | ||
kind: Deployment | ||
metadata: | ||
name: my-deployment-1 | ||
namespace: within-ns | ||
labels: | ||
app: good-app | ||
spec: | ||
replicas: 1 | ||
selector: | ||
matchLabels: | ||
app: good-app | ||
template: | ||
metadata: | ||
labels: | ||
app: good-app | ||
spec: | ||
containers: | ||
- name: good-app-deploy | ||
image: busybox:1.35 | ||
--- | ||
apiVersion: apps/v1 | ||
kind: Deployment | ||
metadata: | ||
name: my-deployment-3 | ||
namespace: within-ns | ||
labels: | ||
owner: "dev-team" | ||
spec: | ||
replicas: 1 | ||
selector: | ||
matchLabels: | ||
app: my-app03 | ||
template: | ||
metadata: | ||
labels: | ||
app: my-app03 | ||
spec: | ||
containers: | ||
- name: my-app03-deploy | ||
image: busybox:1.35 | ||
--- | ||
apiVersion: apps/v1 | ||
kind: Deployment | ||
metadata: | ||
name: my-deployment-4 | ||
namespace: within-ns | ||
spec: | ||
replicas: 1 | ||
selector: | ||
matchLabels: | ||
app: my-app04 | ||
template: | ||
metadata: | ||
labels: | ||
app: my-app04 | ||
spec: | ||
containers: | ||
- name: my-app04-deploy | ||
image: busybox:1.35 |