Skip to content

[Bug] kyverno-json documentation seems incorrect re: wildcards and validate property #342

@menzenski

Description

@menzenski

Kyverno JSON Version

0.1.0

Description

I am on version 0.0.2, which I can't select in the bug issue form version selector (I installed via Homebrew, and the only version available there is 0.0.2)

The kyverno-json documentation includes an example ValidatingPolicy that uses validate with a wildcard ?*:

apiVersion: json.kyverno.io/v1alpha1
kind: ValidatingPolicy
metadata:
  name: required-s3-tags
spec:
  rules:
    - name: require-team-tag
      identifier: address
      match:
        any:
        - type: aws_s3_bucket
      exclude:
        any:
        - name: bypass-me
      validate:
        assert:
          all:
          - values:
              tags:
                Team: ?*

However, this doesn't work. In the Kyverno playground an attempt to use this policy just returns {"results": null}. On the command line there is an error thrown:

$ kyverno-json scan --payload my_payload.yaml --policy required_s3_tags.yaml
Loading policies ...
Error: failed to parse document (spec.rules[0].validate: Invalid value: value provided for unknown field)

Steps to reproduce

  1. Define policy with the YAML example from the documentation:
cat <<EOF > test_policy.yaml
apiVersion: json.kyverno.io/v1alpha1
kind: ValidatingPolicy
metadata:
  name: required-s3-tags
spec:
  rules:
    - name: require-team-tag
      identifier: address
      match:
        any:
        - type: aws_s3_bucket
      exclude:
        any:
        - name: bypass-me
      validate:
        assert:
          all:
          - values:
              tags:
                Team: ?*
EOF
  1. Invoke kyverno-json using that policy:
$ kyverno-json scan --policy test_policy.yaml

This throws an error:

$ kyverno-json scan --policy test_policy.yaml
Loading policies ...
Error: failed to parse document (spec.rules[0].validate: Invalid value: value provided for unknown field)

Expected behavior

I had expected that the examples provided in the documentation would work.

Screenshots

No response

Logs

No response

Slack discussion

No response

Troubleshooting

  • I have searched other issues in this repository and mine is not recorded.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workinggood first issueGood for newcomerstriageDefault label assigned to all new issues indicating label curation is needed to fully organize.

    Type

    No type

    Projects

    Status

    No status

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions