Skip to content

Commit 6aeda11

Browse files
authored
Feat/w3ds evoting (#290)
* chore: add migrations * feat: voting logic * feat: points & rank based voting * chore: control panel features * chore: sign pages * feat: eVoting * fix: deeplink stuff * feat: eVoting responsiveness
1 parent a3253cd commit 6aeda11

File tree

90 files changed

+9830
-4573
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

90 files changed

+9830
-4573
lines changed
Lines changed: 147 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,38 +1,167 @@
1-
# sv
1+
# Control Panel
22

3-
Everything you need to build a Svelte project, powered by [`sv`](https://github.com/sveltejs/cli).
3+
A SvelteKit-based control panel for monitoring and managing various services and platforms.
44

5-
## Creating a project
5+
## Features
66

7-
If you're seeing this, you've probably already done this step. Congrats!
7+
### eVault Monitoring
8+
9+
- **Real-time eVault Discovery**: Automatically discovers eVault pods across all Kubernetes namespaces
10+
- **Pod Information**: Displays comprehensive pod details including status, readiness, restarts, age, IP, and node
11+
- **Live Logs**: View real-time logs from eVault pods with automatic refresh
12+
- **Pod Details**: Access detailed pod information including YAML configuration and resource usage
13+
- **Metrics**: View pod performance metrics (when metrics-server is available)
14+
15+
## Prerequisites
16+
17+
### Kubernetes Access
18+
19+
- `kubectl` must be installed and configured
20+
- Access to the Kubernetes cluster where eVaults are running
21+
- Proper RBAC permissions to list and describe pods
22+
23+
### System Requirements
24+
25+
- Node.js 18+
26+
- Access to execute `kubectl` commands
27+
28+
## Installation
29+
30+
1. Install dependencies:
831

932
```bash
10-
# create a new project in the current directory
11-
npx sv create
33+
npm install
34+
```
35+
36+
2. Ensure kubectl is configured:
1237

13-
# create a new project in my-app
14-
npx sv create my-app
38+
```bash
39+
kubectl cluster-info
1540
```
1641

17-
## Developing
42+
## Usage
1843

19-
Once you've created a project and installed dependencies with `npm install` (or `pnpm install` or `yarn`), start a development server:
44+
### Development
2045

2146
```bash
2247
npm run dev
23-
24-
# or start the server and open the app in a new browser tab
25-
npm run dev -- --open
2648
```
2749

28-
## Building
29-
30-
To create a production version of your app:
50+
### Building
3151

3252
```bash
3353
npm run build
3454
```
3555

36-
You can preview the production build with `npm run preview`.
56+
## eVault Monitoring
57+
58+
### Main Dashboard
59+
60+
The main page displays a table of all eVault pods found across your Kubernetes cluster:
61+
62+
- **Name**: Clickable link to detailed pod view
63+
- **Namespace**: Kubernetes namespace where the pod is running
64+
- **Status**: Current pod status (Running, Pending, Failed, etc.)
65+
- **Ready**: Number of ready containers vs total containers
66+
- **Restarts**: Number of container restarts
67+
- **Age**: How long the pod has been running
68+
- **IP**: Pod IP address
69+
- **Node**: Kubernetes node where the pod is scheduled
70+
71+
### Detailed Pod View
72+
73+
Click on any eVault name to access detailed monitoring:
74+
75+
#### Logs Tab
76+
77+
- Real-time pod logs with automatic refresh
78+
- Configurable log tail length
79+
- Terminal-style display for easy reading
80+
81+
#### Details Tab
82+
83+
- Complete pod description from `kubectl describe pod`
84+
- YAML configuration from `kubectl get pod -o yaml`
85+
- Resource requests and limits
86+
- Environment variables and volume mounts
87+
88+
#### Metrics Tab
89+
90+
- CPU and memory usage (requires metrics-server)
91+
- Resource consumption trends
92+
- Performance monitoring data
93+
94+
### API Endpoints
95+
96+
#### GET /api/evaults
97+
98+
Returns a list of all eVault pods across all namespaces.
99+
100+
#### GET /api/evaults/[namespace]/[pod]/logs?tail=[number]
101+
102+
Returns the most recent logs from a specific pod.
103+
104+
#### GET /api/evaults/[namespace]/[pod]/details
105+
106+
Returns detailed information about a specific pod.
107+
108+
## Configuration
109+
110+
### eVault Detection
111+
112+
The system automatically detects eVault pods by filtering for pods with names containing:
113+
114+
- `evault`
115+
- `vault`
116+
- `web3`
117+
118+
You can modify the filter in `src/routes/api/evaults/+server.ts` to adjust detection criteria.
119+
120+
### Log Tail Length
121+
122+
Default log tail length is 100 lines. This can be configured via the `tail` query parameter.
123+
124+
## Troubleshooting
125+
126+
### No eVaults Found
127+
128+
1. Verify kubectl is configured: `kubectl cluster-info`
129+
2. Check if eVault pods are running: `kubectl get pods --all-namespaces`
130+
3. Verify pod names contain expected keywords
131+
4. Check RBAC permissions for pod listing
132+
133+
### Permission Denied
134+
135+
Ensure your kubectl context has permissions to:
136+
137+
- List pods across namespaces
138+
- Describe pods
139+
- Access pod logs
140+
- View pod metrics (if using metrics-server)
141+
142+
### Metrics Not Available
143+
144+
If the metrics tab shows no data:
145+
146+
1. Verify metrics-server is installed: `kubectl get pods -n kube-system | grep metrics`
147+
2. Check metrics-server logs for errors
148+
3. Ensure HPA (Horizontal Pod Autoscaler) is configured if needed
149+
150+
## Security Considerations
151+
152+
- The control panel executes kubectl commands on the server
153+
- Ensure proper access controls and authentication
154+
- Consider implementing role-based access control
155+
- Monitor and audit kubectl command execution
156+
157+
## Contributing
158+
159+
1. Fork the repository
160+
2. Create a feature branch
161+
3. Make your changes
162+
4. Add tests if applicable
163+
5. Submit a pull request
164+
165+
## License
37166

38-
> To deploy your app, you may need to install an [adapter](https://svelte.dev/docs/kit/adapters) for your target environment.
167+
[Add your license information here]

infrastructure/control-panel/package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@
5050
"flowbite": "^3.1.2",
5151
"flowbite-svelte": "^1.10.7",
5252
"flowbite-svelte-icons": "^2.2.1",
53+
"lucide-svelte": "^0.539.0",
5354
"tailwind-merge": "^3.0.2"
5455
}
5556
}
Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
import type { EVault } from '../../routes/api/evaults/+server';
2+
3+
export class EVaultService {
4+
static async getEVaults(): Promise<EVault[]> {
5+
try {
6+
const response = await fetch('/api/evaults');
7+
if (!response.ok) {
8+
throw new Error('Failed to fetch eVaults');
9+
}
10+
const data = await response.json();
11+
return data.evaults || [];
12+
} catch (error) {
13+
console.error('Error fetching eVaults:', error);
14+
return [];
15+
}
16+
}
17+
18+
static async getEVaultLogs(namespace: string, podName: string, tail: number = 100): Promise<string[]> {
19+
try {
20+
const response = await fetch(`/api/evaults/${encodeURIComponent(namespace)}/${encodeURIComponent(podName)}/logs?tail=${tail}`);
21+
if (!response.ok) {
22+
throw new Error('Failed to fetch logs');
23+
}
24+
const data = await response.json();
25+
return data.logs || [];
26+
} catch (error) {
27+
console.error('Error fetching logs:', error);
28+
return [];
29+
}
30+
}
31+
32+
static async getEVaultDetails(namespace: string, podName: string): Promise<any> {
33+
try {
34+
const response = await fetch(`/api/evaults/${encodeURIComponent(namespace)}/${encodeURIComponent(podName)}/details`);
35+
if (!response.ok) {
36+
throw new Error('Failed to fetch eVault details');
37+
}
38+
return await response.json();
39+
} catch (error) {
40+
console.error('Error fetching eVault details:', error);
41+
return null;
42+
}
43+
}
44+
45+
static async getEVaultMetrics(namespace: string, podName: string): Promise<any> {
46+
try {
47+
const response = await fetch(`/api/evaults/${encodeURIComponent(namespace)}/${encodeURIComponent(podName)}/metrics`);
48+
if (!response.ok) {
49+
throw new Error('Failed to fetch metrics');
50+
}
51+
return await response.json();
52+
} catch (error) {
53+
console.error('Error fetching eVault metrics:', error);
54+
return null;
55+
}
56+
}
57+
}

0 commit comments

Comments
 (0)