PriceSmart is a dynamic pricing engine built with Spring Boot, designed to demonstrate Istio's traffic management capabilities in a Kubernetes environment. The service provides a REST API to calculate product prices based on different pricing models (Global, Customer, and Subscription) controlled via environment variables.
- Dynamic Pricing Models:
GLOBAL: Standard pricing for all users.CUSTOMER: Applies "Happy Hour" (2 PM - 4 PM) and "Flash Sale" (random 1 in 3 chance) discounts.SUBSCRIPTION: Premium tier pricing with base discounts and loyalty bonuses.
- Istio Ready: Designed for Canary deployments and traffic splitting experiments.
- Observability: Structured logging for tracking price calculations and discount applications.
- Actuator Enabled: Built-in health checks and metrics.
- Java 21
- Spring Boot 4.0.2
- Maven
- Docker
- Kubernetes & Istio (for deployment)
GET /api/v1/price?productId={id}
Response Example:
{
"id": "123",
"name": "The Big Mac",
"description": "The iconic double-decker with two 100% chicken patties and Special Sauce.",
"price": 5.99,
"model": "GLOBAL",
"note": "Standard Global Pricing",
"timestamp": "2026-02-05 19:15:00"
}- JDK 21
- Maven 3.9+
- Docker (optional)
./mvnw spring-boot:runThe service will be available at http://localhost:8080.
./mvnw clean packagedocker build -t pricing-service:latest .The repository includes Istio manifests in devops-setup/pricing-gitops to demonstrate advanced traffic routing:
-
Deploy the Service:
kubectl apply -f devops-setup/pricing-gitops/deployment-v1.yaml kubectl apply -f devops-setup/pricing-gitops/deployment-v2.yaml kubectl apply -f devops-setup/pricing-gitops/deployment-v3.yaml
-
Configure Networking:
kubectl apply -f devops-setup/pricing-gitops/gateway.yaml kubectl apply -f devops-setup/pricing-gitops/service.yaml kubectl apply -f devops-setup/pricing-gitops/destination-rule.yaml kubectl apply -f devops-setup/pricing-gitops/virtual-service.yaml
This setup will split traffic across three versions (v1: 40%, v2: 40%, v3: 20%).
Copyright 2026 Abhishek Roy. Licensed under the Apache License, Version 2.0.