spring-guides / top-spring-on-kubernetes

Spring on Kubernetes :: Topic guide to Spring and Kubernetes
18 stars 14 forks source link

Guide Rewrite #7

Closed robertmcnees closed 1 week ago

robertmcnees commented 2 months ago

This PR suggests several changes to the existing material. I tried to preserve the structure and fundamental teachings of the existing guide.

There are a few general topics in this PR.

Reduction in tooling I removed references to Kind and Kustomize. Removing references to Kind and instead using Docker Desktop with kubernetes necessitated a change to the container spec when creating the deployment. Removing references to Kustomize required the addition of a project and 2 additional yaml files (only used in the final section of the guide) to manage the deployment and service creation.

All required code in this repository The previous guide instructed users to load a deployment located in Ryan Baxter's personal repository with Kustomize. When I removed Kustomize from the guide, it made sense to have all of the code required for the tutorial managed in this repository. This necessitated a second app in the project and restructured all of the existing code files.

Code rename and restructure Previously the guide included a single project located in the app folder. It wasn't clear to me what the app should be throughout much of the tutorial. The code provided in the app folder was written to call a second application. These instructions were not given until the end of the guide, making me wonder what I should have been deploying throughout the guide. The code in Ryan's repository was the base 'hello world' example and is what I based all teachings around in the restructured guide. Ryan's code came into the project as hello-spring-k8s and is the foundation for the guide. The existing code in the app folder was moved to hello-caller and only used at the end to demonstrate service registration and discovery.

Called out sections separately When following along with the guide, it naturally fell into 4 distinct sections. I created headings and links so that the user can more easily navigate to the section that they are looking for.

Created multiple solution yaml files Since the guide focuses primarily on creating kubernetes resources, I chose to only provide solutions to the Java projects. Because this guide does not focus on the Java code nor help users build an application step by step, I removed references to starting a new project with Spring Initializr. This helped reduce the size of the guide and focus only on what is being taught in the guide. Instead of focusing on the Java code, I added multiple folders in the k8s-artifacts folder that have yaml files that correspond to the sections of the guide. My hope is that his more easily allows the user the ability to jump in at a specific point if they want to.

Project Maintenance I updated all Spring Boot applications to the latest version. The Maven wrapper was updated. I also added GitHub configuration files for CI as well as Dependabot.

robertmcnees commented 2 months ago

Asking for a review from @ryanjbaxter and perhaps @rstoyanchev as the original authors of the guide.

robertmcnees commented 2 months ago

This PR should address issues #6 #5 #3 #2

ryanjbaxter commented 2 months ago

@robertmcnees remind me is there a way to build the guide so I can see the final result making it easier to read an review?

robertmcnees commented 2 months ago

I need to pull out the .DS_Store files from this PR. Apparently I checked those files in with my first commit before noticing they were not excluded in .gitignore. With my second commit I added .DS_Store to .gitignore but the damage was done.

It might take a few steps to get those files off of this PR but I'll get it fixed.

robertmcnees commented 2 months ago

@ryanjbaxter The easiest way to view the code is to pull down the code and view the README in IntelliJ.

robertmcnees commented 1 month ago

Added a commit to address #8. preStop is not required. Additionally, as of Spring Boot 3.4 the instructions in this guide will throw an error.

ryanjbaxter commented 4 weeks ago

This looks good.

I would consider adding a note about building container on ARM64 (Mx chips for Macs) architectures. While the default buildpack will work it is built using a different architecture and when you run the apps on ARM64 the performance of the containers are pretty poor. To solve this DaShaun has been managing a buildpack for compiling containers for ARM64. To use it when you are on a Mac you would need to do ./mvnw spring-boot:build-image -Dspring-boot.build-image.builder=dashaun/builder:tiny.

robertmcnees commented 1 week ago

@ryanjbaxter Probably best if you merge this PR. It should be all ready to go as is. My apologies I didn't merge myself and clear this off my list before last week.