Skip to content

Commit

Permalink
Inject tags used in testing in the cloudformation
Browse files Browse the repository at this point in the history
  • Loading branch information
jonathan-innis committed Jun 23, 2023
1 parent ff7e6e4 commit 035e16e
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 2 deletions.
13 changes: 12 additions & 1 deletion test/manifests/pre-upgrade-setup.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -54,9 +54,20 @@ spec:
workingDir: $(workspaces.ws.path)
script: |
aws iam create-service-linked-role --aws-service-name spot.amazonaws.com || true
CLOUDFORMATION_PATH=website/content/en/preview/getting-started/getting-started-with-eksctl/cloudformation.yaml
# Iterate through the policy and add more permissive tagging for tests to succeed
# There are various tests that add more tags than are permitted by the default policy
EXTRA_TAGS=""
for TAG in "TestTag" "example.com\/tag" "custom-tag" "custom-tag2"; do
EXTRA_TAGS="$EXTRA_TAGS\n \"$TAG\","
done
sed -i "s/\"aws:TagKeys\": \[/\"aws:TagKeys\": \[$EXTRA_TAGS/" "$CLOUDFORMATION_PATH"
aws cloudformation deploy \
--stack-name iam-$(params.cluster-name) \
--template-file website/content/en/preview/getting-started/getting-started-with-eksctl/cloudformation.yaml \
--template-file "$CLOUDFORMATION_PATH" \
--capabilities CAPABILITY_NAMED_IAM \
--parameter-overrides "ClusterName=$(params.cluster-name)"
Expand Down
13 changes: 12 additions & 1 deletion test/manifests/setup.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -49,9 +49,20 @@ spec:
workingDir: $(workspaces.ws.path)
script: |
aws iam create-service-linked-role --aws-service-name spot.amazonaws.com || true
CLOUDFORMATION_PATH=website/content/en/preview/getting-started/getting-started-with-karpenter/cloudformation.yaml
# Iterate through the policy and add more permissive tagging for tests to succeed
# There are various tests that add more tags than are permitted by the default policy
EXTRA_TAGS=""
for TAG in "TestTag" "example.com\/tag" "custom-tag" "custom-tag2"; do
EXTRA_TAGS="$EXTRA_TAGS\n \"$TAG\","
done
sed -i "s/\"aws:TagKeys\": \[/\"aws:TagKeys\": \[$EXTRA_TAGS/" "$CLOUDFORMATION_PATH"
aws cloudformation deploy \
--stack-name iam-$(params.cluster-name) \
--template-file website/content/en/preview/getting-started/getting-started-with-karpenter/cloudformation.yaml \
--template-file $CLOUDFORMATION_PATH \
--capabilities CAPABILITY_NAMED_IAM \
--parameter-overrides "ClusterName=$(params.cluster-name)"
Expand Down

0 comments on commit 035e16e

Please sign in to comment.