Skip to content

Commit

Permalink
Let's add the new cost-tracking tags to workflows
Browse files Browse the repository at this point in the history
  • Loading branch information
AidanHilt committed Jan 16, 2025
1 parent cd71d6f commit 3bdfcac
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 4 deletions.
3 changes: 3 additions & 0 deletions kube/services/argo-events/workflows/configmap.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,9 @@ data:
karpenter.sh/discovery: ENVIRONMENT
purpose: workflow
workflowname: WORKFLOW_NAME
"vadc:cost-type": user-based-variable
"vadc:usage-type": user-infrastructure
"vadc:environment-type": "ENVIRONMENT_TYPE_CODE"
userData: |
MIME-Version: 1.0
Content-Type: multipart/mixed; boundary="BOUNDARY"
Expand Down
11 changes: 9 additions & 2 deletions kube/services/argo-events/workflows/sensor-created.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,13 @@ spec:
- "-c"
- |
#!/bin/bash
if [ "$ENVIRONMENT" = "vhdcprod" ]; then
ENVIRONMENT_TYPE_CODE="production"
elif [ "$ENVIRONMENT" = "va-testing" ]; then
ENVIRONMENT_TYPE_CODE="testing"
else;
ENVIRONMENT_TYPE_CODE="environment"
fi
if [ -z "$NODEPOOL_TEMPLATE" ]; then
NODEPOOL_TEMPLATE="/manifests/nodepool.yaml"
Expand All @@ -74,11 +81,11 @@ spec:
fi
if ! kubectl get ec2nodeclass workflow-$WORKFLOW_NAME >/dev/null 2>&1; then
sed -e "s/WORKFLOW_NAME/$WORKFLOW_NAME/" -e "s/GEN3_USERNAME/$GEN3_USERNAME/" -e "s/GEN3_TEAMNAME/$GEN3_TEAMNAME/" -e "s/ENVIRONMENT/$ENVIRONMENT/" "$NODECLASS_TEMPLATE" | kubectl apply -f -
sed -e "s/ENVIRONMENT_TYPE_CODE/$ENVIRONMENT_TYPE_CODE" -e "s/WORKFLOW_NAME/$WORKFLOW_NAME/" -e "s/GEN3_USERNAME/$GEN3_USERNAME/" -e "s/GEN3_TEAMNAME/$GEN3_TEAMNAME/" -e "s/ENVIRONMENT/$ENVIRONMENT/" "$NODECLASS_TEMPLATE" | kubectl apply -f -
fi
if ! kubectl get nodepool workflow-$WORKFLOW_NAME >/dev/null 2>&1; then
sed -e "s/WORKFLOW_NAME/$WORKFLOW_NAME/" -e "s/GEN3_USERNAME/$GEN3_USERNAME/" -e "s/GEN3_TEAMNAME/$GEN3_TEAMNAME/" -e "s/ENVIRONMENT/$ENVIRONMENT/" "$NODEPOOL_TEMPLATE" | kubectl apply -f -
sed -e "s/ENVIRONMENT_TYPE_CODE/$ENVIRONMENT_TYPE_CODE" -e "s/WORKFLOW_NAME/$WORKFLOW_NAME/" -e "s/GEN3_USERNAME/$GEN3_USERNAME/" -e "s/GEN3_TEAMNAME/$GEN3_TEAMNAME/" -e "s/ENVIRONMENT/$ENVIRONMENT/" "$NODEPOOL_TEMPLATE" | kubectl apply -f -
fi
env:
- name: WORKFLOW_NAME
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,14 @@ spec:
- "-c"
- |
#!/bin/bash
if [ "$ENVIRONMENT" = "vhdcprod" ]; then
ENVIRONMENT_TYPE_CODE="production"
elif [ "$ENVIRONMENT" = "va-testing" ]; then
ENVIRONMENT_TYPE_CODE="testing"
else;
ENVIRONMENT_TYPE_CODE="environment"
fi
if [ -z "$NODEPOOL_TEMPLATE" ]; then
NODEPOOL_TEMPLATE="/manifests/provisioner.yaml"
fi
Expand Down Expand Up @@ -62,12 +70,12 @@ spec:
if [ ! -z "$workflow_name" ]; then
if ! kubectl get ec2nodeclass workflow-$workflow_name >/dev/null 2>&1; then
echo "No awsnodetemplate found for ${workflow_name}, creating one"
sed -e "s/WORKFLOW_NAME/$workflow_name/" -e "s/GEN3_TEAMNAME/$workflow_team/" -e "s/GEN3_USERNAME/$workflow_user/" -e "s/ENVIRONMENT/$ENVIRONMENT/" "$NODECLASS_TEMPLATE" | kubectl apply -f -
sed -e "s/ENVIRONMENT_TYPE_CODE/$ENVIRONMENT_TYPE_CODE" -e "s/WORKFLOW_NAME/$workflow_name/" -e "s/GEN3_TEAMNAME/$workflow_team/" -e "s/GEN3_USERNAME/$workflow_user/" -e "s/ENVIRONMENT/$ENVIRONMENT/" "$NODECLASS_TEMPLATE" | kubectl apply -f -
fi
if ! kubectl get nodepool workflow-$workflow_name >/dev/null 2>&1; then
echo "No provisioner found for ${workflow_name}, creating one"
sed -e "s/WORKFLOW_NAME/$workflow_name/" -e "s/GEN3_TEAMNAME/$workflow_team/" -e "s/GEN3_USERNAME/$workflow_user/" -e "s/ENVIRONMENT/$ENVIRONMENT/" "$NODEPOOL_TEMPLATE" | kubectl apply -f -
sed -e "s/ENVIRONMENT_TYPE_CODE/$ENVIRONMENT_TYPE_CODE" -e "s/WORKFLOW_NAME/$workflow_name/" -e "s/GEN3_TEAMNAME/$workflow_team/" -e "s/GEN3_USERNAME/$workflow_user/" -e "s/ENVIRONMENT/$ENVIRONMENT/" "$NODEPOOL_TEMPLATE" | kubectl apply -f -
fi
fi
Expand Down

0 comments on commit 3bdfcac

Please sign in to comment.