jsonnet-training-course icon indicating copy to clipboard operation
jsonnet-training-course copied to clipboard

Update examples to generate kubernetes compliant deployments

Open Pokom opened this issue 3 years ago • 1 comments

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 deployment object which k8s will reject
  • httpd:2.5 does not exist :smile:, so I changed it to 2.3 for the default and called withImage('httpd:2.4')

I ignored the following:

  • example5.jsonnet isn'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.

Pokom avatar Sep 07 '22 15:09 Pokom

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.

Pokom avatar Sep 29 '22 15:09 Pokom