-
Notifications
You must be signed in to change notification settings - Fork 774
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
feat: create a policy utils package #5473
Conversation
Signed-off-by: Charles-Edouard Brétéché <charles.edouard@nirmata.com>
Codecov Report
@@ Coverage Diff @@
## main #5473 +/- ##
=======================================
Coverage 36.42% 36.42%
=======================================
Files 172 172
Lines 19087 19087
=======================================
Hits 6952 6952
Misses 11340 11340
Partials 795 795 📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more |
@@ -97,13 +96,9 @@ kyverno oci pull -i <imgref> -d policies`, | |||
return fmt.Errorf("unmarshaling layer blob: %v", err) | |||
} | |||
for _, policy := range policies { | |||
policyJsonBytes, err := json.Marshal(policy) | |||
policyBytes, err := policyutils.ToYaml(policy) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can we add a comment here , since function name says ToYaml
but we doing obj>json>yaml
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@prateekpandey14 done.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
BTW, I added the comment on the ToYaml
func, not here.
Signed-off-by: Charles-Edouard Brétéché <charles.edouard@nirmata.com>
Signed-off-by: Charles-Edouard Brétéché charles.edouard@nirmata.com
Explanation
This PR creates a policy utils package.
We manipulate policies a lot and this package will contain policy manipulation code we use often.
For now I added functions to marshal policies into json/yaml.