{"id":13788005,"url":"https://github.com/tsandall/validating-and-mutating-example","last_synced_at":"2025-03-20T02:34:58.826Z","repository":{"id":79896467,"uuid":"233067876","full_name":"tsandall/validating-and-mutating-example","owner":"tsandall","description":"A small example project containing a validating and mutating policy.","archived":false,"fork":false,"pushed_at":"2020-01-10T17:21:56.000Z","size":5,"stargazers_count":4,"open_issues_count":0,"forks_count":4,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-01-25T05:24:59.726Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Open Policy Agent","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/tsandall.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2020-01-10T14:48:03.000Z","updated_at":"2022-06-16T15:53:17.000Z","dependencies_parsed_at":"2023-05-31T09:00:45.348Z","dependency_job_id":null,"html_url":"https://github.com/tsandall/validating-and-mutating-example","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tsandall%2Fvalidating-and-mutating-example","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tsandall%2Fvalidating-and-mutating-example/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tsandall%2Fvalidating-and-mutating-example/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tsandall%2Fvalidating-and-mutating-example/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/tsandall","download_url":"https://codeload.github.com/tsandall/validating-and-mutating-example/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":244539039,"owners_count":20468836,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-08-03T21:00:34.310Z","updated_at":"2025-03-20T02:34:58.808Z","avatar_url":"https://github.com/tsandall.png","language":"Open Policy Agent","readme":"# 🛠 Validating and Mutating Admission Control Example 🛠\n\nThis repository contains a small example of how to combine validating and mutating admission control policies in OPA using the [entry point contributed to the open-policy-agent/library repository](https://github.com/open-policy-agent/library/blob/master/kubernetes/mutating-admission/main.rego).\n\n## Examples\n\n* 🔪 The mutating policy sets an annotation on objects that indicate a requirement.\n* 🛡️ The validating policy example checks for a specific label.\n\nThere are four files:\n\n* [main.rego](./main.rego) is the entry point from the library repository\n  copied with minor changes.\n* [main_test.rego](main_test.rego) shows an end-to-end test of the\n  validating and mutating policies.\n* [validate-deny-missing-label.rego](validate-deny-missing-label.rego) shows a trivial validation policy with unit testing.\n* [patch-add-dummy-annotation.rego](patch-add-dummy-annotation.rego)\n  shows a trivial mutating policy with unit testing.\n\n## Running\n\nYou can run the tests on the command-line:\n\n```\nopa test -b . -v\n```\n\nYou can evaluate the entire policy with an example input on the command-line:\n\n```\nopa eval -b . -i input.json 'data.system.main'\n```\n\n\u003e Hint: check out the ['Open Policy Agent' extension for VS Code](https://github.com/open-policy-agent/vscode-opa). Try the `OPA: Test Workspace`, `OPA: Evaluate Selection`, and `OPA: Toggle Evaluation Coverage` commands on this project.","funding_links":[],"categories":["Kubernetes"],"sub_categories":["Built with Wasm"],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftsandall%2Fvalidating-and-mutating-example","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftsandall%2Fvalidating-and-mutating-example","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftsandall%2Fvalidating-and-mutating-example/lists"}