Update examples to generate kubernetes compliant deployments
As I work through the examples, I like getting some hands on experience deploying the changes to a kubernetes cluster. I've created a local kind cluster to test changes against by executing the following commend:
jsonnet example1.jsonnet | k apply -f -
Issues resolved:
- selector and labels are missing(k8s rejects deployment)
- examples 4/6/7 nested the deployment in a
deploymentobject which k8s will reject -
httpd:2.5does not exist :smile:, so I changed it to2.3for the default and calledwithImage('httpd:2.4')
I ignored the following:
-
example5.jsonnetisn't referenced, can probably be deleted? - updated pitfall examples
I'll submit separate PR's later lessons as I get to them. Overall, I found the first lesson to be pretty clear where the value add is with jsonnet and liked how you introduced mixins and other concepts.
Thanks for the feedback! At the time, I didn't realize the importance of the nested deployment object. I think it would be reasonable to leave the deployment object in to ensure it's idiomatic jsonnet, otherwise that defeats the purpose of the course.
Let me try to fiddle with the script you linked and see if I can update the example to include a snippet on how to pipe the output into kubectl so that it can run.