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

Commit

Permalink
obd-demo file edited to support new plugins API
Browse files Browse the repository at this point in the history
  • Loading branch information
leoporoli committed Oct 7, 2024
1 parent 120ec6a commit 3da1351
Show file tree
Hide file tree
Showing 2 changed files with 155 additions and 40 deletions.
193 changes: 154 additions & 39 deletions ci/obd-demo.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@ spec:
targetPort: 8090
protocol: TCP
appProtocol: HTTP

---
apiVersion: apps/v1
kind: Deployment
Expand Down Expand Up @@ -124,15 +125,12 @@ spec:
- name: "Cookie"
value: "shop_session-id=x-liveness-probe"
env:
- name: ADDRESS
value: ":8080"
- name: FREECURRENCYAPIKEY
value: "fca_live_nFVVF8CvfxqJhzMHB4N2x1NH7ffVVPwZr9hg3iNl"
- name: JSDELIVRAPIKEY
value: "prod"
- name: CARTSERVICEHOST
value: cartservice
- name: PRODUCTCATALOGSERVICEHOST
value: productcatalogservice

---
apiVersion: v1
kind: Service
Expand All @@ -143,12 +141,7 @@ metadata:
version: v1
annotations:
kardinal.dev.service/dependencies: "productcatalogservice:http,cartservice:http"
kardinal.dev.service/plugins: |
- name: https://github.com/kurtosis-tech/free-currency-api-plugin.git
type: external
servicename: free-currency-api
args:
api_key: fca_live_VKZlykCWEiFcpBHnw74pzd4vLi04q1h9JySbVHDF
kardinal.dev.service/plugins: "jsdelivr-api"
spec:
type: ClusterIP
selector:
Expand Down Expand Up @@ -210,33 +203,7 @@ metadata:
version: v1
annotations:
kardinal.dev.service/stateful: "true"
kardinal.dev.service/plugins: |
- name: github.com/kurtosis-tech/postgres-seed-plugin
args:
seed_script: |
-- create the table
CREATE TABLE IF NOT EXISTS public.items(
id bigserial PRIMARY KEY,
created_at TIMESTAMP WITH TIME ZONE,
updated_at TIMESTAMP WITH TIME ZONE,
deleted_at TIMESTAMP WITH TIME ZONE,
user_id TEXT,
product_id TEXT,
quantity INTEGER
);
INSERT INTO public.items (id, created_at, updated_at, deleted_at, user_id, product_id, quantity)
VALUES (1, '2024-08-02 13:02:07.656104 +00:00', '2024-08-02 13:02:07.656104 +00:00', null, '0494c5e0-dde0-48fa-a6d8-f7962f5476bf', '66VCHSJNUP', 1);
INSERT INTO public.items (id, created_at, updated_at, deleted_at, user_id, product_id, quantity)
VALUES (2, '2024-08-02 13:02:10.891407 +00:00', '2024-08-02 13:02:10.891407 +00:00', null, '0494c5e0-dde0-48fa-a6d8-f7962f5476bf', '2ZYFJ3GM2N', 1);
-- Set the sequence to the correct value after inserting records
SELECT setval('public.items_id_seq', (SELECT MAX(id) FROM public.items));
db_name: "cart"
db_user: "postgresuser"
db_password: "postgrespass"
kardinal.dev.service/plugins: "postgres-seed-plugin"
spec:
type: ClusterIP
ports:
Expand Down Expand Up @@ -312,6 +279,44 @@ spec:
protocol: TCP
appProtocol: HTTP

---
apiVersion: gateway.networking.k8s.io/v1
kind: Gateway
metadata:
name: gateway
annotations:
kardinal.dev.service/gateway: "true"
spec:
gatewayClassName: istio
listeners:
- name: default
hostname: "*.app.localhost"
port: 8888
protocol: HTTP
allowedRoutes:
namespaces:
from: All

---
apiVersion: gateway.networking.k8s.io/v1
kind: HTTPRoute
metadata:
name: http
annotations:
kardinal.dev.service/route: "true"
spec:
parentRefs:
- name: gateway
hostnames: ["prod.app.localhost"]
rules:
- matches:
- path:
type: PathPrefix
value: /
backendRefs:
- name: frontend
port: 80

---
apiVersion: networking.k8s.io/v1
kind: Ingress
Expand All @@ -322,7 +327,7 @@ metadata:
name: ingress
spec:
rules:
- host: baseline.app.localhost
- host: web.other.localhost
http:
paths:
- path: /
Expand All @@ -332,3 +337,113 @@ spec:
name: frontend
port:
number: 80

---
apiVersion: apps/v1
kind: Deployment
metadata:
name: metrics-v1
labels:
app: metrics
version: v1
spec:
selector:
matchLabels:
app: metrics
version: v1
template:
metadata:
labels:
app: metrics
version: v1
annotations:
sidecar.istio.io/rewriteAppHTTPProbers: "true"
spec:
containers:
- name: server
image: kurtosistech/metrics:main
imagePullPolicy: IfNotPresent
ports:
- containerPort: 8091
readinessProbe:
initialDelaySeconds: 10
httpGet:
path: "/_healthz"
port: 8091
httpHeaders:
- name: "Cookie"
value: "shop_session-id=x-readiness-probe"
livenessProbe:
initialDelaySeconds: 10
httpGet:
path: "/_healthz"
port: 8091
httpHeaders:
- name: "Cookie"
value: "shop_session-id=x-liveness-probe"
---
apiVersion: v1
kind: Service
metadata:
name: metrics
labels:
app: metrics
version: v1
spec:
type: ClusterIP
selector:
app: metrics
ports:
- name: http
port: 8091
protocol: TCP
appProtocol: HTTP
targetPort: 8091

---
apiVersion: v1
kind: Service
metadata:
name: jsdelivr-api
annotations:
kardinal.dev.service/plugin-definition: |
- name: github.com/leoporoli/jsdelivr-api-plugin
type: external
servicename: jsdelivr-api
args:
api_key: "dev"
---
apiVersion: v1
kind: Service
metadata:
name: postgres-seed-plugin
annotations:
kardinal.dev.service/plugin-definition: |
- name: github.com/leoporoli/postgres-seed-plugin
type: stateful
servicename: postgres-seed-plugin
args:
seed_script: |
-- create the table
CREATE TABLE IF NOT EXISTS public.items(
id bigserial PRIMARY KEY,
created_at TIMESTAMP WITH TIME ZONE,
updated_at TIMESTAMP WITH TIME ZONE,
deleted_at TIMESTAMP WITH TIME ZONE,
user_id TEXT,
product_id TEXT,
quantity INTEGER
);
INSERT INTO public.items (id, created_at, updated_at, deleted_at, user_id, product_id, quantity)
VALUES (1, '2024-08-02 13:02:07.656104 +00:00', '2024-08-02 13:02:07.656104 +00:00', null, '0494c5e0-dde0-48fa-a6d8-f7962f5476bf', '66VCHSJNUP', 1);
INSERT INTO public.items (id, created_at, updated_at, deleted_at, user_id, product_id, quantity)
VALUES (2, '2024-08-02 13:02:10.891407 +00:00', '2024-08-02 13:02:10.891407 +00:00', null, '0494c5e0-dde0-48fa-a6d8-f7962f5476bf', '2ZYFJ3GM2N', 1);
-- Set the sequence to the correct value after inserting records
SELECT setval('public.items_id_seq', (SELECT MAX(id) FROM public.items));
db_name: "cart"
db_user: "postgresuser"
db_password: "postgrespass"
2 changes: 1 addition & 1 deletion ci/template.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ metadata:
annotations:
kardinal.dev.service/shared: "true"
kardinal.dev.service/plugins: |
- name: github.com/kurtosis-tech/postgres-seed-plugin
- name: github.com/leoporoli/postgres-seed-plugin
args:
seed_script: |
-- create the table
Expand Down

0 comments on commit 3da1351

Please sign in to comment.