-
Notifications
You must be signed in to change notification settings - Fork 984
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
r/kubernetes_pod: add support for init containers #156
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.
The code on this seems right to me, though I agree having tests for update would be ideal.
@paddycarver Interestingly enough the api reference provided an important tidbit:
Which is why when I added a test check to update the image json-patch was complaining
(which I found out is written by a hashicorp employee Evan Phoenix, I'm super star-struck now!) So I will remove the ability to update that attribute. Would I place a UPDATE: investigating further the notion of updating an init-container does seem to exist in the wild... but it's unclear to me, the user guides and official api reference seems to contradict itself, but to me the init containers are basically like a startup script that persists things to the pod, it wouldn't make sense to me that it could be updated... I'm going to remove the ability to update for now |
Hi @appilon - I wonder if the discrepancy you're seeing with updates to |
@sl1pm4t Thanks for the heads up I am still new to Kubernetes so its good to get insight on its quirks and behaviours. At least for my PR I figured out a way to not allow updates for init containers (but still allow them for non init containers). |
only allow container spec image to be updated by non-init containers add acceptance checks for forced new add acceptance test to Replication Controller
+1 |
This has been released with version 1.2.0 |
Fix #61
Implement init containers. Docs and Api for K8s list it follows the exact same schema as a normal container but there are some subtle behavioural differences
Please let me know if we want acceptance tests that try to validate those things or if we want special validations on the init_container schema. The path of least resistance was to just piggyback the
container
schemaUPDATE: I might need to test the updating behaviour
FINAL NOTES:
As far as I can tell updates are not permitted to an init container's spec. I needed to ForceNew on the Pod if that is changed. Unfortunately just adding that attribute on the list
init_container
was not enough, it appears thecontainer
spec I was piggy backing allows changes to theimage
always, which does not hold true for InitContainers, so I introduced a new boolean in the spec functions to forceNew for init containers and added some acceptance checks that actually check the UID of the pod (as a method of proving if it remained the same or a new one was made).@paddycarver if you could do a quick second check since I changed the code a decent amount since your last review that would be aweseome!