-
Notifications
You must be signed in to change notification settings - Fork 257
Add basic e-commerce kpt example #4440
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from 5 commits
0cb7c23
7ed1b58
6737ed4
e9b2c60
d23f82e
606472c
bb3e90d
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| @@ -0,0 +1,6 @@ | ||||||||||||||||||||||||||||
| apiVersion: kpt.dev/v1 | ||||||||||||||||||||||||||||
| kind: Kptfile | ||||||||||||||||||||||||||||
| metadata: | ||||||||||||||||||||||||||||
| name: ecommerce-example | ||||||||||||||||||||||||||||
| info: | ||||||||||||||||||||||||||||
| description: A simple e-commerce example using kpt | ||||||||||||||||||||||||||||
|
Comment on lines
+4
to
+6
|
||||||||||||||||||||||||||||
| name: ecommerce-example | |
| info: | |
| description: A simple e-commerce example using kpt | |
| name: ecommerce | |
| info: | |
| description: A simple e-commerce package using kpt |
Copilot
AI
Mar 21, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The Kptfile is missing the pipeline section with validators, which is a standard part of all other example packages in the repository (see package-examples/nginx/Kptfile and package-examples/guestbook/Kptfile). Adding a kubeconform validator would be consistent with existing examples and help users learn about kpt's validation capabilities.
| description: A simple e-commerce example using kpt | |
| description: A simple e-commerce example using kpt | |
| pipeline: | |
| validators: | |
| - image: ghcr.io/GoogleContainerTools/kpt-functions/kubeconform:v0.0.1 | |
| configMap: | |
| strict: "true" |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,38 @@ | ||
| # E-commerce Example (kpt) | ||
|
|
||
| This is a simple e-commerce application example packaged using **kpt**. | ||
|
|
||
| --- | ||
|
|
||
| ## 📌 Overview | ||
|
|
||
| This project demonstrates how Kubernetes applications can be managed and customized using the **kpt toolchain**. | ||
|
|
||
| Instead of modifying code, users can change configuration using YAML files. | ||
|
|
||
| --- | ||
|
|
||
| ## 🚀 Features | ||
|
|
||
| - Simple Kubernetes Deployment using **nginx** (version pinned for reproducibility) | ||
| - Service to expose the application internally | ||
| - Easy-to-understand structure for beginners | ||
| - Ready to extend with custom configuration | ||
|
|
||
| --- | ||
|
|
||
| ## 📂 Structure | ||
|
|
||
| - `deployment.yaml` → Defines the application Deployment | ||
| - `service.yaml` → Exposes the application via a Service | ||
| - `Kptfile` → Defines the kpt package metadata | ||
|
|
||
| --- | ||
|
|
||
| ## ⚙️ How to Use | ||
|
|
||
| ### 1. Deploy the application | ||
|
|
||
| **Option A: Using kubectl only** | ||
| ```bash | ||
| kubectl apply -f deployment.yaml -f service.yaml | ||
|
Comment on lines
+36
to
+38
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,19 @@ | ||
| apiVersion: apps/v1 | ||
|
||
| kind: Deployment | ||
| metadata: | ||
| name: ecommerce-deployment | ||
| spec: | ||
| replicas: 1 | ||
| selector: | ||
| matchLabels: | ||
| app: ecommerce | ||
| template: | ||
| metadata: | ||
| labels: | ||
| app: ecommerce | ||
| spec: | ||
| containers: | ||
| - name: ecommerce-container | ||
| image: nginx:1.18.0 | ||
| ports: | ||
| - containerPort: 80 | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,13 @@ | ||
| apiVersion: v1 | ||
|
||
| kind: Service | ||
| metadata: | ||
| name: ecommerce-service | ||
| labels: | ||
| app: ecommerce | ||
| spec: | ||
| selector: | ||
| app: ecommerce | ||
| ports: | ||
| - protocol: TCP | ||
| port: 80 | ||
| targetPort: 80 | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Kptfile is missing the
emailsfield that is present in all other package examples (e.g., package-examples/nginx/Kptfile and package-examples/guestbook/Kptfile). This field should be added to theinfosection to follow the repository convention.