{
  "apiVersion": "json.kyverno.io/v1alpha1",
  "kind": "ValidatingPolicy",
  "metadata": {
    "name": "forbid-unknown-fields",
    "annotations": {
      "nova.cloudinit.dev/severity": "low",
      "title.policy.kyverno.io": "Contract has only schema-allowed fields"
    }
  },
  "spec": {
    "rules": [
      {
        "name": "no-unknown-fields",
        "assert": {
          "all": [
            {
              "check": {
                "(length(keys(@)) == `4`)": true,
                "keys(@)": {
                  "(contains(['id','name','environment','infrastructure'], @))": true
                }
              }
            }
          ]
        }
      }
    ]
  }
}