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

policy: cherry pick state policy changes from upstream #273

Draft
wants to merge 6 commits into
base: msft-main
Choose a base branch
from

Conversation

Redent0r
Copy link

@Redent0r Redent0r commented Dec 16, 2024

Merge Checklist
  • Followed patch format from upstream recommendation: https://github.com/kata-containers/community/blob/main/CONTRIBUTING.md#patch-format
    • Included a single commit in a given PR - at least unless there are related commits and each makes sense as a change on its own.
  • Aware about the PR to be merged using "create a merge commit" rather than "squash and merge" (or similar)
  • The upstream/missing label (or upstream/not-needed) has been set on the PR.
Summary

This PR downstream all available state policy changes from upstream. These are:

Test Methodology

Since we are changing the agent, I'm building a new image with updated kata(-cc) packages.

@Redent0r Redent0r added the upstream/not-needed PRs that will not be upstreamed (e.g. internal) label Dec 16, 2024
@Redent0r Redent0r changed the title Saulparedes/add state to policy policy: cherry pick state policy changes from upstream Dec 16, 2024
Redent0r and others added 6 commits December 16, 2024 13:18
Use regorous engine's add_data method to add state to the policy.
This data can later be accessed inside rego context through the data namespace.

Support state modifications (json-patches) that may be returned as a result from policy evaluation.

Also initialize a policy engine data slice "pstate" dedicated for storing state.

Signed-off-by: Saul Paredes <[email protected]>
Make sure all container sandbox names match the sandbox name of the first container.

Signed-off-by: Saul Paredes <[email protected]>
Before this patch there was a mismatch between the JSON path under which
the state of the rule evaluation is set in comparison to under which
it is retrieved.

This resulted in the behavior that each time the policy was evaluated,
it thought it was the _first_ time the policy was evaluated.
This also means that the consistency check for the `sandbox_name`
was ineffective.

Signed-off-by: Leonard Cohnen <[email protected]>
Reuse constants where applicable

Signed-off-by: Saul Paredes <[email protected]>
- Remove default_namespace from settings
- Ensure container namespaces in a pod match each other in case no namespace is specified in the YAML

Signed-off-by: Saul Paredes <[email protected]>
Update samples policy annotations

Signed-off-by: Saul Paredes <[email protected]>
@Redent0r Redent0r force-pushed the saulparedes/add_state_to_policy branch from 3a25d45 to 9a557d2 Compare December 16, 2024 21:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
upstream/not-needed PRs that will not be upstreamed (e.g. internal)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants