Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PSP migration policy - Allowed Volume Types #193

Closed
chipzoller opened this issue Dec 7, 2021 · 1 comment · Fixed by #241
Closed

PSP migration policy - Allowed Volume Types #193

chipzoller opened this issue Dec 7, 2021 · 1 comment · Fixed by #241
Assignees
Labels
sample Sample policy
Milestone

Comments

@chipzoller
Copy link
Member

From comment here, when 1.6.0 is released assuming support for kyverno/kyverno#2543 is available, this policy becomes possible:

apiVersion: kyverno.io/v1
kind: ClusterPolicy
metadata:
  name: allowed-vols
spec:
  validationFailureAction: enforce
  background: false
  rules:
  - name: allowed-vols
    match:
      resources:
        kinds:
        - Pod
    preconditions:
      all:
      - key: "{{request.operation}}"
        operator: In
        value: 
        - CREATE
        - UPDATE
      - key: "{{ request.object.spec.volumes[].keys(@)[] | length(@) }}"
        operator: GreaterThan
        value: 0
    validate:
      message: "Only emptyDir and projected volumes are allowed."
      deny:
        conditions:
          all:
          - key: "{{ request.object.spec.volumes[].keys(@)[] }}"
            operator: AnyNotIn
            value:
            - name
            - projected
            - emptyDir
@chipzoller chipzoller added the sample Sample policy label Dec 7, 2021
@chipzoller chipzoller added this to the 1.6.0 milestone Dec 7, 2021
@chipzoller chipzoller self-assigned this Dec 7, 2021
@chipzoller
Copy link
Member Author

With the recent updates to the upstream Pod Security Standards, the control which previously was a deny list has been inverted into an allow list thereby covering this policy. PR #241 contains this file here. Since the request in this issue is now effectively the same as how this updated PSS policy is written, it doesn't make sense to duplicate the rule/policy.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
sample Sample policy
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant