-
-
Notifications
You must be signed in to change notification settings - Fork 9
/
init.sql
40 lines (37 loc) · 1.14 KB
/
init.sql
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
CREATE TABLE public.metrics_server (
api VARCHAR NOT NULL UNIQUE,
token VARCHAR NOT NULL
);
CREATE TABLE public.nodes (
node_id INT GENERATED ALWAYS AS IDENTITY PRIMARY KEY,
node_name VARCHAR NOT NULL UNIQUE,
used_cpu VARCHAR,
used_memory VARCHAR
);
CREATE TABLE public.pods (
pod_id INT GENERATED ALWAYS AS IDENTITY PRIMARY KEY,
node_id INT REFERENCES public.nodes (node_id),
pod_name VARCHAR NOT NULL,
tm TIMESTAMP NOT NULL,
pod_status VARCHAR NOT NULL,
UNIQUE (pod_name, tm)
);
CREATE TABLE public.containers (
container_id INT GENERATED ALWAYS AS IDENTITY PRIMARY KEY,
container_name VARCHAR NOT NULL,
pod_id INT REFERENCES public.pods (pod_id),
--pod_name VARCHAR NOT NULL,
node_id INT REFERENCES public.nodes (node_id),
--node_name VARCHAR NOT NULL,
tm TIMESTAMP NOT NULL,
cpu_used VARCHAR,
memory_used VARCHAR,
cpu_percent NUMERIC (6,3),
memory_percent NUMERIC (6,3),
UNIQUE (pod_name, tm)
);
/*
volumes:
- ./db.sql:/docker-entrypoint-initdb.d/db.sql
- ./postgres-data:/var/lib/postgresql/data
*/