Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update hypershift on aks to calculate the token #708

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion workloads/kube-burner-ocp-wrapper/run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -54,9 +54,16 @@ hypershift(){
HCP_NAMESPACE=${HC_NAME}
QUERY="sum(kube_node_role{cluster=\"$MC_NAME\",role=\"worker\"})by(node)"

if [[ -z ${AKS_PROM} ]] || [[ -z ${AZURE_PROM} ]] || [[ -z ${AZURE_PROM_TOKEN} ]]; then
if [[ -z ${AKS_PROM} ]] || [[ -z ${AZURE_PROM} ]] ; then
echo "Azure/AKS prometheus inputs are missing, exiting.."
exit 1
elif [[ -z ${AZURE_PROM_TOKEN} ]]; then
if [[ -z ${AZ_CLIENT_SECRET} ]] || [[ -z ${AZ_CLIENT_ID} ]] ; then
echo "Azure/AKS prometheus token is missing and cannot be calculated, exiting.."
exit 1
else
AZURE_PROM_TOKEN=$(curl --request POST 'https://login.microsoftonline.com/64dc69e4-d083-49fc-9569-ebece1dd1408/oauth2/v2.0/token' --header 'Content-Type: application/x-www-form-urlencoded' --data-urlencode 'client_id=${AZ_CLIENT_ID}' --data-urlencode 'grant_type=client_credentials' --data-urlencode 'client_secret=${AZ_CLIENT_SECRET}' --data-urlencode 'scope=https://prometheus.monitor.azure.com/.default' | jq -r '.access_token')
fi
fi

MC_OBO=$AKS_PROM
Expand Down