Skip to content
This repository has been archived by the owner on Oct 21, 2024. It is now read-only.

Commit

Permalink
Merge pull request #12 from kurtosis-tech/laurent/k8s-manifest-input
Browse files Browse the repository at this point in the history
feat: Switch docker compose input to k8s manifest
  • Loading branch information
laurentluce authored Jul 15, 2024
2 parents 3ccb234 + b003993 commit 0074374
Show file tree
Hide file tree
Showing 3 changed files with 131 additions and 7 deletions.
10 changes: 5 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ Follow these steps to explore the Kardinal Playground.
- Look for the port labelled "voting-app-prod" and open it in your browser
- Click on the voting buttons to generate some traffic

**Note**: Codespaces port forwarding can be flaky. If you immediately click on the toast that pops up when a port is fowarded, it can be too fast and the port tunnel will shut down. If that happens, just run `./scripts/forward.sh` to set up the forwarding again. Then, don't click on the toast - instead, let it run, wait a tick, and open the port in the "ports" tab.
**Note**: Codespaces port forwarding can be flaky. If you immediately click on the toast that pops up when a port is fowarded, it can be too fast and the port tunnel will shut down. If that happens, just run `./scripts/forward.sh` to set up the forwarding again. Then, don't click on the toast - instead, let it run, wait 15 seconds, and open the port in the "ports" tab.

1. 📊 Visualize the production structure on app.kardinal.dev:
- Get your Kardinal URL by running:
Expand All @@ -65,7 +65,7 @@ Follow these steps to explore the Kardinal Playground.
1. 🔧 Create the dev flow:
```
kardinal flow create voting-app-ui voting-app-ui-dev -d voting-app-demo/compose.yml
kardinal flow create voting-app-ui voting-app-ui-dev -k voting-app-demo/k8s-manifest.yaml
```
This command sets up a development version of the voting app alongside the production version.
Expand All @@ -80,7 +80,7 @@ Follow these steps to explore the Kardinal Playground.
- Look for the port labelled "voting-app-dev" and open it in your browser
- Click on the voting buttons in the dev version to send traffic through it
**Note**: Codespaces port forwarding can be flaky. If you immediately click on the toast that pops up when a port is fowarded, it can be too fast and the port tunnel will shut down. If that happens, just run `./scripts/forward.sh` to set up the forwarding again. Then, don't click on the toast - instead, let it run, wait a tick, and open the port in the "ports" tab.
**Note**: Codespaces port forwarding can be flaky. If you immediately click on the toast that pops up when a port is fowarded, it can be too fast and the port tunnel will shut down. If that happens, just run `./scripts/forward.sh` to set up the forwarding again. Then, don't click on the toast - instead, let it run, wait 15 seconds, and open the port in the "ports" tab.
1. 🔍 Compare the new structure on app.kardinal.dev:
- Go back to the dashboard
Expand All @@ -95,7 +95,7 @@ Follow these steps to explore the Kardinal Playground.
1. 🧹 Clean up the dev flow:
```
kardinal flow delete -d voting-app-demo/compose.yml
kardinal flow delete -k voting-app-demo/k8s-manifest.yaml
```
This command removes the development version of the app.
Expand All @@ -115,7 +115,7 @@ This guide showcases the power of Kardinal by demonstrating the seamless creatio
We're using port forwarding in this Codespace setup to make the various services accessible to you. Since the Minikube cluster is running inside the Codespace, we need to forward specific ports to allow you to interact with the applications and dashboards through your browser. This is why you'll see multiple forwarded ports in the "Ports" tab (directly above the terminal section in the Codespaces UI).
Codespaces port forwarding can be flaky. If you immediately click on the toast that pops up when a port is fowarded, it can be too fast and the port tunnel will shut down. If that happens, just run `./scripts/forward.sh` to set up the forwarding again. Then, don't click on the toast - instead, let it run, wait a tick, and open the port in the "ports" tab.
Codespaces port forwarding can be flaky. If you immediately click on the toast that pops up when a port is fowarded, it can be too fast and the port tunnel will shut down. If that happens, just run `./scripts/forward.sh` to set up the forwarding again. Then, don't click on the toast - instead, let it run, wait 15 seconds, and open the port in the "ports" tab.
If you encounter any issues with port forwarding, you can reset it by running:
```
Expand Down
4 changes: 2 additions & 2 deletions scripts/startup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ deploy_kardinal_manager() {
log "👩‍💼 Kardinal Manager Deployed"

# Run the kardinal command for voting app deployment with spinner
run_command_with_spinner kardinal deploy -d voting-app-demo/compose.yml
run_command_with_spinner kardinal deploy -k voting-app-demo/k8s-manifest.yaml

log "🗳️ Initial version of voting app deployed"

Expand Down Expand Up @@ -191,4 +191,4 @@ main() {
exec bash
}

main "$@"
main "$@"
124 changes: 124 additions & 0 deletions voting-app-demo/k8s-manifest.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,124 @@
apiVersion: v1
kind: Service
metadata:
labels:
app: redis-prod
version: v1
name: redis-prod
namespace: voting-app
spec:
ports:
- name: tcp-redis
port: 6379
protocol: TCP
targetPort: 6379
selector:
app: redis-prod
---
apiVersion: apps/v1
kind: Deployment
metadata:
labels:
app: redis-prod
version: v1
name: redis-prod
namespace: voting-app
spec:
replicas: 1
selector:
matchLabels:
app: redis-prod
version: v1
strategy:
rollingUpdate:
maxSurge: 25%
maxUnavailable: 25%
type: RollingUpdate
template:
metadata:
annotations:
sidecar.istio.io/inject: "true"
labels:
app: redis-prod
version: v1
spec:
containers:
- name: redis-prod
image: bitnami/redis:6.0.8
env:
- name: ALLOW_EMPTY_PASSWORD
value: "yes"
- name: REDIS_PORT_NUMBER
value: "6379"
resources:
requests:
cpu: 100m
memory: 128Mi
limits:
cpu: 250m
memory: 256Mi
ports:
- containerPort: 6379
name: redis

---
apiVersion: v1
kind: Service
metadata:
labels:
app: voting-app-ui
version: v1
name: voting-app-ui
namespace: voting-app
spec:
ports:
- name: http
port: 80
protocol: TCP
targetPort: 80
selector:
app: voting-app-ui
---
apiVersion: apps/v1
kind: Deployment
metadata:
labels:
app: voting-app-ui
version: v1
name: voting-app-ui
namespace: voting-app
spec:
replicas: 1
selector:
matchLabels:
app: voting-app-ui
version: v1
strategy:
rollingUpdate:
maxSurge: 25%
maxUnavailable: 25%
type: RollingUpdate
template:
metadata:
annotations:
sidecar.istio.io/inject: "true"
labels:
app: voting-app-ui
version: v1
spec:
containers:
- name: voting-app-ui
image: kurtosistech/demo-voting-app-ui
imagePullPolicy: IfNotPresent
resources:
requests:
cpu: 100m
memory: 128Mi
limits:
cpu: 250m
memory: 256Mi
ports:
- containerPort: 80
env:
- name: REDIS
value: "redis-prod"

0 comments on commit 0074374

Please sign in to comment.