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

[Bug]: Volumes aren't converted properly #295

Open
Clijsters opened this issue Apr 7, 2023 · 0 comments
Open

[Bug]: Volumes aren't converted properly #295

Clijsters opened this issue Apr 7, 2023 · 0 comments
Labels
bug Something isn't working triage Triage

Comments

@Clijsters
Copy link

Clijsters commented Apr 7, 2023

What happened?

While converting a PSP with any spec.volumes in it, the generated kyverno policy doesn't use the given volumes list, but a hard coded one from kyverno.ts#111, so the output is:

conditions:
            all:
              - key: "{{ request.object.spec.volumes[].keys(@)[] }}"
                operator: AnyNotIn
                value:
                  - name
                  - projected
                  - emptyDir

Regardless of the input object.

My wild guess is that the hard coded list should be replaced with smth like exactly done in the capabilities section at kyverno.ts#190

How to reproduce:

$ echo "foobarYouCanTypeAnything" | ./psp-migration-linux-x64 -e kyverno
apiVersion: kyverno.io/v1
kind: ClusterPolicy
metadata:
  name: psp-volumes-27205
spec:
  rules:
    - preconditions:
        all:
          - key: "{{ request.object.spec.volumes[].keys(@)[] | length(@) }}"
            operator: GreaterThan
            value: 0
      validate:
        deny:
          conditions:
            all:
              - key: "{{ request.object.spec.volumes[].keys(@)[] }}"
                operator: AnyNotIn
                value:
                  - name
                  - projected
                  - emptyDir
        message: Rejected by psp-volumes-0 rule
      match:
        resources:
          kinds:
            - Pod
      name: psp-volumes-0
  validationFailureAction: enforce

What policy engine were you generating policy for

Kynvero

Relevant log output

No response

@Clijsters Clijsters added bug Something isn't working triage Triage labels Apr 7, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working triage Triage
Projects
None yet
Development

No branches or pull requests

1 participant