PR contributor testing workflow¶
The PR contributor testing workflow is a mandatory process for contributors proposing changes to the Istio project's sample applications, specifically demonstrated using the bookinfo sample^[400-devops__07-Monitoring-and-Observability__k8s-istio__samples__bookinfo__README.md]. This workflow requires contributors to build, push, and validate Docker images using their own repositories before requesting official maintainers to publish images to the Istio registry^[400-devops__07-Monitoring-and-Observability__k8s-istio__samples__bookinfo__README.md].
Process Overview¶
Before the Istio maintainers will build or push images to the official repository, the PR owner must verify that the changes work correctly^[400-devops__07-Monitoring-and-Observability__k8s-istio__samples__bookinfo__README.md]. This involves a cycle of building container images locally, pushing them to a personal Docker Registry, deploying them to a Kubernetes cluster, and running functional tests^[400-devops__07-Monitoring-and-Observability__k8s-istio__samples__bookinfo__README.md].
Step-by-Step Workflow¶
1. Build Docker Images¶
The first step is to build the service images locally using the provided scripts^[400-devops__07-Monitoring-and-Observability__k8s-istio__samples__bookinfo__README.md]. This requires specifying a version tag and a prefix for your personal Docker Registry.
cd samples/bookinfo
src/build-services.sh <version> <prefix>
Example^[400-devops__07-Monitoring-and-Observability__k8s-istio__samples__bookinfo__README.md]:
$ src/build-services.sh 1.16.3 docker.io/shamsher31
...
Successfully tagged shamsher31/examples-bookinfo-ratings-v2:1.16.3
2. Push Images and Update Manifests¶
Once the local build succeeds, the images must be pushed to a container registry (e.g., Docker Hub), and the Kubernetes YAML manifests must be updated to reference the new tags^[400-devops__07-Monitoring-and-Observability__k8s-istio__samples__bookinfo__README.md]. A helper script is provided to automate building, pushing, and updating in a single step^[400-devops__07-Monitoring-and-Observability__k8s-istio__samples__bookinfo__README.md].
./build_push_update_images.sh <version> --prefix=<prefix>
After running this script, verify that the platform/kube/bookinfo*.yaml files have been updated with the correct tag (e.g., 1.16.3)^[400-devops__07-Monitoring-and-Observability__k8s-istio__samples__bookinfo__README.md].
3. Deploy to Kubernetes¶
Apply the updated YAML files to your Kubernetes cluster to deploy the services^[400-devops__07-Monitoring-and-Observability__k8s-istio__samples__bookinfo__README.md].
[kubectl](<./kubectl.md>) apply -f samples/bookinfo/platform/kube/bookinfo.yaml
Wait for all pods to reach the Running state^[400-devops__07-Monitoring-and-Observability__k8s-istio__samples__bookinfo__README.md]:
[kubectl get pods](<./kubectl-get-pods.md>)
# NAME READY STATUS RESTARTS AGE
# details-v1-7f556f5c6b-485l2 2/2 Running 0 10m
# ...
4. Verification and Testing¶
Verify the deployment by testing connectivity internally via the CLI and externally via a browser^[400-devops__07-Monitoring-and-Observability__k8s-istio__samples__bookinfo__README.md].
-
CLI Test: Execute a command from a pod to check the productpage service^[400-devops__07-Monitoring-and-Observability__k8s-istio__samples__bookinfo__README.md].
[kubectl](<./kubectl.md>) exec -it "$([kubectl](<./kubectl.md>) get pod -l app=ratings -o jsonpath='{.items[0].metadata.name}')" -c ratings -- curl productpage:9080/productpage | grep -o "<title>.*</title>" # Output: <title>Simple Bookstore App</title> -
Browser Test: Access the product page URL (e.g.,
http://<NodeIP>:<Port>/productpage) to confirm the "Simple Bookstore App" loads correctly with stars visible^[400-devops__07-Monitoring-and-Observability__k8s-istio__samples__bookinfo__README.md].
5. Finalization¶
If the tests pass successfully, the contributor should request the maintainer to build the official set of images^[400-devops__07-Monitoring-and-Observability__k8s-istio__samples__bookinfo__README.md]. Additionally, a new commit must be added to the original PR to update the version changes to the official values^[400-devops__07-Monitoring-and-Observability__k8s-istio__samples__bookinfo__README.md].
Related Concepts¶
- [[流程化筆記]]: Documenting this workflow ensures that no steps are missed during the testing phase.
- 20/80 Learning Principle: Understanding the core 20% of Kubernetes commands used here (apply, get, exec) allows for 80% of the necessary testing validation.
Sources¶
^[400-devops__07-Monitoring-and-Observability__k8s-istio__samples__bookinfo__README.md]