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

Commit

Permalink
Use k8s manifest instead of docker compose
Browse files Browse the repository at this point in the history
  • Loading branch information
laurentluce committed Jul 15, 2024
1 parent 5ff7223 commit e2bbcea
Show file tree
Hide file tree
Showing 2 changed files with 71 additions and 5 deletions.
10 changes: 5 additions & 5 deletions postgres-demo/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ Follow these steps to explore the Kardinal Playground.
- Create a new project in Neon.
- In your project, create a new branch (this will be your main branch).

b. Open the file `voting-app-demo/compose.yml` and fill in the following variables:
b. Open the file `voting-app-demo/k8s-manifest.yaml` and fill in the following variables:
- NEON_API_KEY: Your Neon API key (found in your Neon account settings)
- NEON_PROJECT_ID: The ID of your Neon project (visible in the project URL)
- NEON_MAIN_BRANCH_ID: The ID of the main branch you created
Expand All @@ -65,7 +65,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 forwarded, it can be too fast and the port tunnel will shut down. If that happens, just run `./scripts/forward.sh prod` 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 forwarded, it can be too fast and the port tunnel will shut down. If that happens, just run `./scripts/forward.sh prod` 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 Down Expand Up @@ -96,7 +96,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 Down Expand Up @@ -132,7 +132,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 of the Codespace UI.
Codespaces port forwarding can be flaky. If you immediately click on the toast that pops up when a port is forwarded, 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 forwarded, 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 Expand Up @@ -163,4 +163,4 @@ We are working with a small but selective set of initial users, join the beta [h
If you run into any issues with this playground please create an issue here or email us at `[email protected]`.
If you are encountering any issue with the port forwards, simply use `./scripts/forward.sh` to reset the port forwarding.
If you are encountering any issue with the port forwards, simply use `./scripts/forward.sh` to reset the port forwarding.
66 changes: 66 additions & 0 deletions postgres-demo/voting-app-demo/k8s-manifest.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
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: voting-app-ui
imagePullPolicy: IfNotPresent
resources:
requests:
cpu: 100m
memory: 128Mi
limits:
cpu: 250m
memory: 256Mi
ports:
- containerPort: 80
env:
- name: POSTGRES
value: "postgresql://USER:PASSWORD@HOST/DB?sslmode=require"
- name: NEON_API_KEY
value: "API_KEY"
- name: NEON_PROJECT_ID
value: "PROJECT_ID" # id of the project looks like foo-bar-12312
- name: NEON_MAIN_BRANCH_ID
value: "ID_OF_THE_MAIN_BRANCH" # branches will be created based on this branch looks like br-fizz-buzz-123zv

0 comments on commit e2bbcea

Please sign in to comment.