-
Notifications
You must be signed in to change notification settings - Fork 60
/
integration.sh
executable file
·85 lines (69 loc) · 2.46 KB
/
integration.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
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
#!/bin/bash
set -o errexit
set -o errtrace
set -o nounset
set -o pipefail
set -o xtrace
binary=$1
# These commands are copied from usage. This script assumes
# a cluster with kubecost is configured as the current
# kube context on the machine this script runs on, hence
# it is an integration test.
#
# WARNING: the nightly cluster does not have a staging install
# so tests that use -N and/or --service-name should be changed.
# Show the projected monthly rate for each namespace
# based on the last 5 days of activity.
$binary namespace --window 5d
# https://stackoverflow.com/questions/59895/how-do-i-get-the-directory-where-a-bash-script-is-located-from-within-the-script
SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )
$binary predict -f "${SCRIPT_DIR}/multi.yaml"
$binary predict --show-cost-per-resource-hr -f "${SCRIPT_DIR}/multi.yaml"
$binary predict --no-diff --show-cost-per-resource-hr -f "${SCRIPT_DIR}/multi.yaml"
# Show how much each namespace cost over the past 5 days
# with additional CPU and memory cost and without efficiency.
$binary namespace \
--historical \
--window 5d \
--show-cpu \
--show-memory \
--show-efficiency=false
# Show the projected monthly rate for each controller
# based on the last 5 days of activity with PV (persistent
# volume) cost breakdown.
$binary controller --window 5d --show-pv
# Show costs over the past 5 days broken down by the value
# of the "app" label:
$binary label --historical -l app
# Show the projected monthly rate for each deployment
# based on the last month of activity with CPU, memory,
# GPU, PV, and network cost breakdown.
$binary deployment --window month -A
# Show the projected monthly rate for each deployment
# in the "kubecost" namespace based on the last 3 days
# of activity with CPU cost breakdown.
$binary deployment \
--window 3d \
--show-cpu \
-n kubecost
# The same, but with a non-standard Kubecost deployment
# in the namespace "kubecost-staging" with the cost
# analyzer service called "kubecost-staging-cost-analyzer".
#
# WARNING: modified from usage examles because test cluster
# doesn't have a staging install
$binary deployment \
--window 3d \
--show-cpu \
-n kubecost \
-N kubecost \
--service-name kubecost-cost-analyzer
# Show how much each pod in the "kube-system" namespace
# cost yesterday, including CPU-specific cost.
$binary pod \
--historical \
--window yesterday \
--show-cpu \
-n kube-system
# use proxy
$binary namespace --use-proxy