Skip to content

Commit

Permalink
Merge pull request #708 from morenod/azure_prometheus_token
Browse files Browse the repository at this point in the history
Update hypershift on aks to calculate the token
  • Loading branch information
openshift-merge-bot[bot] authored Jun 26, 2024
2 parents 53c0a6c + 4cfbac4 commit 944e4bb
Showing 1 changed file with 8 additions and 1 deletion.
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

0 comments on commit 944e4bb

Please sign in to comment.