Skip to content

Instantly share code, notes, and snippets.

@raindev
Created March 7, 2023 17:47
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save raindev/73f805d5d32fe9862a03371dd99aae28 to your computer and use it in GitHub Desktop.
Save raindev/73f805d5d32fe9862a03371dd99aae28 to your computer and use it in GitHub Desktop.
Retrieve cost history for the services that participate in iHAC
#!/bin/bash
set -euo pipefail
services=(
fashion-store-api
fjord
cliff
coast-cart-service
quote-service
coast-checkout-service
)
for service in "${services[@]}"; do
echo -e "\n>$service"
echo 'Aug'
curl -H "Authorization: Bearer $(ztoken)" "https://kube-cost-allocator-kube-cost-api.cloud-cost-efficiency.zalan.do/costs/applications/$service?start=01-08-2022%2000:00:00&end=31-08-2022%2023:59:59&group_by=component"
echo 'Sep'
curl -H "Authorization: Bearer $(ztoken)" "https://kube-cost-allocator-kube-cost-api.cloud-cost-efficiency.zalan.do/costs/applications/$service?start=01-09-2022%2000:00:00&end=30-09-2022%2023:59:59&group_by=component"
echo 'Dec'
curl -H "Authorization: Bearer $(ztoken)" "https://kube-cost-allocator-kube-cost-api.cloud-cost-efficiency.zalan.do/costs/applications/$service?start=01-12-2022%2000:00:00&end=31-12-2022%2023:59:59&group_by=component"
echo 'Jan'
curl -H "Authorization: Bearer $(ztoken)" "https://kube-cost-allocator-kube-cost-api.cloud-cost-efficiency.zalan.do/costs/applications/$service?start=01-01-2023%2000:00:00&end=31-01-2023%2023:59:59&group_by=component"
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment