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

Commit

Permalink
Merge branch 'main' into tedi/envvars
Browse files Browse the repository at this point in the history
  • Loading branch information
tedim52 authored Oct 14, 2024
2 parents a6e4918 + e397c2e commit 5395f34
Show file tree
Hide file tree
Showing 15 changed files with 624 additions and 390 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/ci-e2e-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ jobs:
run: |
tenant_id=${{ steps.tenant.outputs.id }}
nodes=$(curl http://localhost:8080/tenant/${tenant_id}/topology | jq -r '.nodes[].id' | tr " " "\n" | sort -g | tr "\n" " " | xargs)
if [ "${nodes}" != "cartservice free-currency-api frontend ingress postgres productcatalogservice" ]; then exit 1; fi
if [ "${nodes}" != "cartservice frontend ingress jsdelivr-api postgres productcatalogservice" ]; then exit 1; fi
- name: Create, validate and delete flow
run: |
Expand Down
18 changes: 18 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,23 @@
# Changelog

## [0.4.1](https://github.com/kurtosis-tech/kardinal-kontrol/compare/0.4.0...0.4.1) (2024-10-10)


### Bug Fixes

* fix flow visibility logic ([#64](https://github.com/kurtosis-tech/kardinal-kontrol/issues/64)) ([ce84820](https://github.com/kurtosis-tech/kardinal-kontrol/commit/ce848200e88b2f3ba208456eb1632b7c07f4c0a7))

## [0.4.0](https://github.com/kurtosis-tech/kardinal-kontrol/compare/0.3.0...0.4.0) (2024-10-10)


### ⚠ BREAKING CHANGES

* multiple services depending on same plugin implementation ([#61](https://github.com/kurtosis-tech/kardinal-kontrol/issues/61))

### Features

* multiple services depending on same plugin implementation ([#61](https://github.com/kurtosis-tech/kardinal-kontrol/issues/61)) ([3fce223](https://github.com/kurtosis-tech/kardinal-kontrol/commit/3fce2233898dcc576136f79374be0b5c829483a7))

## [0.3.0](https://github.com/kurtosis-tech/kardinal-kontrol/compare/0.2.3...0.3.0) (2024-10-03)


Expand Down
91 changes: 53 additions & 38 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 @@ -332,3 +299,51 @@ spec:
name: frontend
port:
number: 80

---
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"
30 changes: 1 addition & 29 deletions ci/template.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,32 +4,4 @@ metadata:
name: postgres
annotations:
kardinal.dev.service/shared: "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);
INSERT INTO public.items (id, created_at, updated_at, deleted_at, user_id, product_id, quantity)
VALUES (3, '2024-08-02 13:03:10.891407 +00:00', '2024-08-02 13:02:10.891407 +00:00', null, '0494c5e0-dde0-48fa-a6d8-f7962f5476bf', '2ZYFJ3GM2N', ${last_insert_quantity:-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"
21 changes: 12 additions & 9 deletions kontrol-frontend/src/pages/TrafficConfiguration.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { useRef, useEffect, useState } from "react";
import { useRef, useEffect, useState, useCallback } from "react";
import { Grid } from "@chakra-ui/react";
import CytoscapeGraph, { utils } from "@/components/CytoscapeGraph";
import { ElementDefinition } from "cytoscape";
Expand All @@ -14,15 +14,17 @@ const Page = () => {
const { refetchFlows, flowVisibility } = useFlowsContext();
const timerRef = useRef<NodeJS.Timeout | null>(null);

const fetchElems = async () => {
const fetchElems = useCallback(async () => {
const response = await getTopology();
const filtered = {
...response,
nodes: response.nodes.map((node) => {
return {
...node,
versions: node.versions?.filter((version) => {
return flowVisibility[version.flowId] === true;
const currentVisibility = flowVisibility[version.flowId];
// un-set visibility is considered visible, only false is hidden
return currentVisibility == null || currentVisibility === true;
}),
};
}),
Expand All @@ -38,22 +40,23 @@ const Page = () => {
setElems(newElems);
// re-fetch flows if topology changes
refetchFlows();
};
}, [getTopology, flowVisibility, refetchFlows]);

const startPolling = () => {
const startPolling = useCallback(() => {
timerRef.current = setInterval(fetchElems, pollingIntervalSeconds * 1000);
};
}, [fetchElems]);

const stopPolling = () => {
const stopPolling = useCallback(() => {
clearInterval(timerRef.current!);
timerRef.current = null;
};
}, []);

useEffect(() => {
fetchElems();
startPolling();
return stopPolling;
// eslint-disable-next-line react-hooks/exhaustive-deps
}, []);
}, [startPolling, stopPolling, fetchElems]);

return (
<Grid
Expand Down
Loading

0 comments on commit 5395f34

Please sign in to comment.