
The skill service and profile service are written in Go as opposed to Java but will behave in the same way in Skaffold.
The profile service follows the same pattern as the skill service. Repeat the steps in the profile-service directory to set up Skaffold and create the ConfigMap.
Create a Secret for Service Account Keys
The skill service requires a Google Cloud service account key to access the Google Cloud Storage bucket.
When the service is created, the key will be mounted into the container at /var/secrets/google/${SKILL_SERVICE_SA}.json for the service to use.
To configure the profile and fact service, follow the same steps but using the PROFILE_SERVICE_SA and FACT_SERVICE_SA environment variable, respectively, in the place of SKILL_SERVICE_SA.
While you could configure the fact service in the same way, it has a default Spring Profile that does not use Google Cloud services, so it can be run without a service account. In a way, this is a good thing, as it means you can run the application locally without needing to connect to Google Cloud.
Build a Container with Skaffold
This is an example of the skill service, but the same applies to both the fact and profiles services as well.
You can also launch this in the browser in Cloud Shell by clicking the Web Preview button and then preview on port 8080.
By doing this, Skaffold will monitor the source files for any changes. When detected, it will automatically rebuild and redeploy a new container. For Java applications, this may take a few seconds, so it is likely you will not want a deployment every time you make a change. However, knowing that, redeployment with skaffold run means that feedback is almost as fast as starting Spring Boot directly.
For Go applications like the skill service, the build time is so fast that you can use skaffold dev to get a great inner loop experience.
This command starts the application in debug mode, so any breakpoints in the code will activate just as if the application was running in debug mode outside the Kubernetes cluster.
Summary
Choosing how to build a laboratory does depend on your needs, but the options are there to build a great developer experience by optimizing your inner loop.
Here are your variables:
- Which IDE option to use and where to run it
- How to build your containers
- Which container runtime to use to run your container
- How to test your application with dependent services
In Chapter 11, you will be creating the citadel to further protect the API and UI you deployed in Chapter 9.