Skip to content

Commit

Permalink
Merge branch 'master' into chore/fence_deploy_azlinux
Browse files Browse the repository at this point in the history
  • Loading branch information
nss10 authored Jan 22, 2025
2 parents 83a44a1 + 2aa20f1 commit 82c2a77
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 6 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,16 @@ spec:
- "-c"
- |
#!/bin/bash
ENVIRONMENT=$(kubectl -n default get configmap global -o jsonpath="{.data.environment}")
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 All @@ -41,8 +51,6 @@ spec:
NODECLASS_TEMPLATE="/manifests/nodeclass.yaml"
fi
ENVIRONMENT=$(kubectl -n default get configmap global -o jsonpath="{.data.environment}")
WORKFLOWS=$(kubectl get workflows -n argo -o=jsonpath='{range .items[*]}{.metadata.name}{" "}{.metadata.labels.gen3username}{" "}{.metadata.labels.gen3teamproject}{"\n"}')
WORKFLOW_ARRAY=()
Expand All @@ -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 82c2a77

Please sign in to comment.