-
Notifications
You must be signed in to change notification settings - Fork 45
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Change StormForge test from Job to CronJob
- Loading branch information
Showing
2 changed files
with
67 additions
and
64 deletions.
There are no files selected for viewing
67 changes: 67 additions & 0 deletions
67
eks-anywhere-common/Testers/StormForge/stormforge-test-cronjob.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
apiVersion: batch/v1 | ||
kind: CronJob | ||
metadata: | ||
name: stormforge-test-cronjob | ||
namespace: stormforge | ||
spec: | ||
schedule: "30 */6 * * *" # Every six hours, at half-past. | ||
jobTemplate: | ||
spec: | ||
backoffLimit: 4 | ||
template: | ||
spec: | ||
activeDeadlineSeconds: 1800 | ||
restartPolicy: Never | ||
containers: | ||
- name: stormforge-test-job | ||
image: badouralix/curl-jq:alpine | ||
env: | ||
- name: CLI_VERSION | ||
value: "5.1.9" | ||
envFrom: | ||
- secretRef: | ||
name: stormforge-agent-auth | ||
- secretRef: | ||
name: stormforge-agent-env | ||
command: | ||
- '/bin/sh' | ||
- '-c' | ||
- | | ||
# Setup: Fetch the StormForge CLI tool | ||
while :; do | ||
[ "$(uname -sm)" = "Linux aarch64" ] && arch=arm64 || arch=amd64 | ||
curl -L "https://downloads.stormforge.io/stormforge-cli/v${CLI_VERSION}/stormforge_${CLI_VERSION}_linux_${arch}.tar.gz" | tar -xz | ||
if [ $? = 0 ]; then | ||
chmod a+x ./stormforge | ||
mv ./stormforge /usr/local/bin | ||
break | ||
fi | ||
sleep 5 | ||
done | ||
# Tidy: delete any old and inactive eksa test clusters that may still be registered | ||
stormforge get clusters --state Inactive -o json \ | ||
| jq -r '.items[].name | select(. | test("^eksa-test-"))' \ | ||
| xargs --no-run-if-empty stormforge delete clusters | ||
# Validate: when the cluster name has been registered, is not Inactive, and | ||
# shows both products connected, then Optimize Live is working. | ||
while :; do | ||
echo "checking for stormforge-agent, stormforge-applier registration on $STORMFORGE_CLUSTER_NAME" | ||
if stormforge get cluster "$STORMFORGE_CLUSTER_NAME" -o json \ | ||
| jq -e 'all(.items[]; | ||
(.status.phase == "Created") | ||
and | ||
all(.stormforge.products | map(.name); | ||
any(index("stormforge-agent")) | ||
and | ||
any(index("stormforge-applier")) ))' | ||
then | ||
echo "successfully connected ${STORMFORGE_CLUSTER_NAME} to StormForge backend" | ||
break | ||
fi | ||
sleep 5 | ||
done | ||
# Success! (failure is handled by spec.activeDeadlineSeconds) | ||
exit 0 |
64 changes: 0 additions & 64 deletions
64
eks-anywhere-common/Testers/StormForge/stormforge-test-job.yaml
This file was deleted.
Oops, something went wrong.