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: function to mutate the pod spec. #64
Conversation
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.
LGTM, thanks!
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.
LGTM!
src/lib.rs
Outdated
if let Some(ref mut spec) = deployment.spec { | ||
spec.template.spec = Some(pod_spec); | ||
} |
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.
It's a bit of a corner case, but if deployment.spec
is None
, then the mutation is not done.
I would replace the code to be something like:
let mut deployment_spec = deployment.unwrap_or_default();
deployment_spec.template.spec = Some(pod_spec);
deployment.spec = Some(deployment_spec);
The same approach applies to the other types of resources being handled
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.
Done
Adds a new function in the SDK to help policy developers to mutate pod spec from the high level resources (e.g. deployment, statefulset, replicaset, etc).
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.
LGTM
Adds a new function in the SDK to help policy developers to mutate pod spec from the high level resources (e.g. deployment, statefulset, replicaset, etc).
Fix #63