-
Notifications
You must be signed in to change notification settings - Fork 5
/
hack.sh
61 lines (49 loc) · 2.03 KB
/
hack.sh
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
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
# You're not supposed to run this as a script
exit 0
# A collection of utility functions for working with the swarm
# Launch
pushd assisted-swarm
sudo KUBECONFIG=/root/kubeconfig ./main.py 200 testplan.example.yaml service_config.example.yaml
# Download agent logs
export KUBECONFIG=/root/kubeconfig
oc get agents -A -ojson | jq '.items[].metadata | select(.namespace | test("swarm-")).name' -r | xargs -I@ sh -c "sudo journalctl DRY_AGENT_ID=@ > @.logs"
# Show all installer logs
export KUBECONFIG=/root/kubeconfig
oc get agents -A -ojson | jq '.items[].metadata | select(.namespace | test("swarm-")).name' -r | xargs -I@ sh -c "echo @ && cat /var/log/[email protected] | tail -1"
# Delete all namespaces
export KUBECONFIG=/root/kubeconfig
oc get namespace -A -ojson | jq '.items[] | select(.metadata.name | test("swarm"))' | oc delete -f -
# Kill all processes
killall agent
pgrep assisted-installer-controller -f | xargs kill -9
pgrep next_step_runner -f | xargs kill -9
# Delete mounts
findmnt --json --list | jq '.filesystems[].target | select(test("/root/.cache/swarm"))' -r | xargs -L1 umount
findmnt --json --list | jq '.filesystems[].target | select(test("/root/.cache/swarm"))' -r | xargs -L1 umount
findmnt --json --list | jq '.filesystems[].target | select(test("/root/.cache/swarm"))' -r | xargs -L1 umount
findmnt --json --list | jq '.filesystems[].target | select(test("/root/.cache/swarm"))' -r | xargs -L1 umount
# Cleanup
rm -rf /var/log/assisted-installer-*.log
rm -rf /root/mtab-*
rm -rf /root/.cache/swarm/swarm-*
# Prometheus instance
docker run \
--net host \
-p 9090:9090 \
-v $PWD/prometheus.yml:/etc/prometheus/prometheus.yml \
prom/prometheus
# Prometheus prometheus.yml
"
global:
scrape_interval: 5s
scrape_configs:
- job_name: 'swarm'
static_configs:
- targets: ['localhost:9100']
- job_name: 'ai'
scheme: https
static_configs:
- targets: ['assisted-service-open-cluster-management.apps.jetlag-ibm0.performance-scale.cloud:443']
tls_config:
insecure_skip_verify: true
"