forked from kyverno/kyverno
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: add resourceNames field in the generated VAPs (kyverno#10187) (k…
…yverno#10265) Signed-off-by: Mariam Fahmy <mariam.fahmy@nirmata.com> Co-authored-by: Mariam Fahmy <mariam.fahmy@nirmata.com>
- Loading branch information
1 parent
879005b
commit 381be15
Showing
13 changed files
with
202 additions
and
17 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
19 changes: 19 additions & 0 deletions
19
...licy/clusterpolicy/standard/generate/cpol-any-match-resources-by-names/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,19 @@ | ||
apiVersion: chainsaw.kyverno.io/v1alpha1 | ||
kind: Test | ||
metadata: | ||
creationTimestamp: null | ||
name: cpol-any-match-resources-by-names | ||
spec: | ||
steps: | ||
- name: step-01 | ||
try: | ||
- apply: | ||
file: policy.yaml | ||
- assert: | ||
file: policy-assert.yaml | ||
- name: step-02 | ||
try: | ||
- assert: | ||
file: validatingadmissionpolicy.yaml | ||
- assert: | ||
file: validatingadmissionpolicybinding.yaml |
12 changes: 12 additions & 0 deletions
12
...licy/clusterpolicy/standard/generate/cpol-any-match-resources-by-names/policy-assert.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,12 @@ | ||
apiVersion: kyverno.io/v1 | ||
kind: ClusterPolicy | ||
metadata: | ||
name: check-label-app-4 | ||
status: | ||
conditions: | ||
- reason: Succeeded | ||
status: "True" | ||
type: Ready | ||
validatingadmissionpolicy: | ||
generated: true | ||
|
20 changes: 20 additions & 0 deletions
20
...sion-policy/clusterpolicy/standard/generate/cpol-any-match-resources-by-names/policy.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,20 @@ | ||
apiVersion: kyverno.io/v1 | ||
kind: ClusterPolicy | ||
metadata: | ||
name: check-label-app-4 | ||
spec: | ||
validationFailureAction: Audit | ||
rules: | ||
- name: check-label-app | ||
match: | ||
any: | ||
- resources: | ||
kinds: | ||
- Pod | ||
- Deployment | ||
names: | ||
- "staging" | ||
validate: | ||
cel: | ||
expressions: | ||
- expression: "'app' in object.metadata.labels" |
39 changes: 39 additions & 0 deletions
39
...policy/standard/generate/cpol-any-match-resources-by-names/validatingadmissionpolicy.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 @@ | ||
apiVersion: admissionregistration.k8s.io/v1alpha1 | ||
kind: ValidatingAdmissionPolicy | ||
metadata: | ||
labels: | ||
app.kubernetes.io/managed-by: kyverno | ||
name: check-label-app-4 | ||
ownerReferences: | ||
- apiVersion: kyverno.io/v1 | ||
kind: ClusterPolicy | ||
name: check-label-app-4 | ||
spec: | ||
failurePolicy: Fail | ||
matchConstraints: | ||
resourceRules: | ||
- apiGroups: | ||
- "" | ||
apiVersions: | ||
- v1 | ||
operations: | ||
- CREATE | ||
- UPDATE | ||
resourceNames: | ||
- staging | ||
resources: | ||
- pods | ||
- pods/ephemeralcontainers | ||
- apiGroups: | ||
- apps | ||
apiVersions: | ||
- v1 | ||
operations: | ||
- CREATE | ||
- UPDATE | ||
resourceNames: | ||
- staging | ||
resources: | ||
- deployments | ||
validations: | ||
- expression: "'app' in object.metadata.labels" |
15 changes: 15 additions & 0 deletions
15
...standard/generate/cpol-any-match-resources-by-names/validatingadmissionpolicybinding.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,15 @@ | ||
apiVersion: admissionregistration.k8s.io/v1alpha1 | ||
kind: ValidatingAdmissionPolicyBinding | ||
metadata: | ||
labels: | ||
app.kubernetes.io/managed-by: kyverno | ||
name: check-label-app-4-binding | ||
ownerReferences: | ||
- apiVersion: kyverno.io/v1 | ||
kind: ClusterPolicy | ||
name: check-label-app-4 | ||
spec: | ||
policyName: check-label-app-4 | ||
validationActions: | ||
- Audit | ||
- Warn |
19 changes: 19 additions & 0 deletions
19
...standard/skip-generate/cpol-any-match-resources-by-names-with-wildcard/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,19 @@ | ||
apiVersion: chainsaw.kyverno.io/v1alpha1 | ||
kind: Test | ||
metadata: | ||
creationTimestamp: null | ||
name: cpol-any-match-resources-by-names-with-wildcard | ||
spec: | ||
steps: | ||
- name: step-01 | ||
try: | ||
- apply: | ||
file: policy.yaml | ||
- assert: | ||
file: policy-assert.yaml | ||
- name: step-02 | ||
try: | ||
- error: | ||
file: validatingadmissionpolicy.yaml | ||
- error: | ||
file: validatingadmissionpolicybinding.yaml |
12 changes: 12 additions & 0 deletions
12
...standard/skip-generate/cpol-any-match-resources-by-names-with-wildcard/policy-assert.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,12 @@ | ||
apiVersion: kyverno.io/v1 | ||
kind: ClusterPolicy | ||
metadata: | ||
name: check-label-app-3 | ||
status: | ||
conditions: | ||
- reason: Succeeded | ||
status: "True" | ||
type: Ready | ||
validatingadmissionpolicy: | ||
generated: false | ||
|
20 changes: 20 additions & 0 deletions
20
...policy/standard/skip-generate/cpol-any-match-resources-by-names-with-wildcard/policy.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,20 @@ | ||
apiVersion: kyverno.io/v1 | ||
kind: ClusterPolicy | ||
metadata: | ||
name: check-label-app-3 | ||
spec: | ||
validationFailureAction: Audit | ||
rules: | ||
- name: check-label-app | ||
match: | ||
any: | ||
- resources: | ||
kinds: | ||
- Pod | ||
names: | ||
- "prod-*" | ||
- "staging" | ||
validate: | ||
cel: | ||
expressions: | ||
- expression: "'app' in object.metadata.labels" |
7 changes: 7 additions & 0 deletions
7
...p-generate/cpol-any-match-resources-by-names-with-wildcard/validatingadmissionpolicy.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: admissionregistration.k8s.io/v1alpha1 | ||
kind: ValidatingAdmissionPolicy | ||
metadata: | ||
labels: | ||
app.kubernetes.io/managed-by: kyverno | ||
name: check-label-app-3 | ||
spec: {} |
7 changes: 7 additions & 0 deletions
7
...ate/cpol-any-match-resources-by-names-with-wildcard/validatingadmissionpolicybinding.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: admissionregistration.k8s.io/v1alpha1 | ||
kind: ValidatingAdmissionPolicyBinding | ||
metadata: | ||
labels: | ||
app.kubernetes.io/managed-by: kyverno | ||
name: check-label-app-3-binding | ||
spec: {} |
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