Skip to content

Instantly share code, notes, and snippets.

View steve-fraser's full-sized avatar

Steven Fraser steve-fraser

View GitHub Profile
affinity:
nodeAffinity:
requiredDuringSchedulingIgnoredDuringExecution:
nodeSelectorTerms:
- matchExpressions:
- key: "fanduel.com/storage-optimized"
operator: In
values:
- ebs
aggressiveMode: true
managedByCASTAI: false
customConfig: |
evictionConfig:
- podSelector:
kind: StatefulSet
settings:
disposable:
enabled: true
curl --request POST \
--url https://api.cast.ai/v1/kubernetes/external-clusters/fc5dac97-6e52-4d16-a6b1-ad4d1bcf8754/disconnect \
--header 'X-API-Key: <>' \
--header 'accept: application/json' \
--header 'content-type: application/json' \
--data '
{
"deleteProvisionedNodes": false,
"keepKubernetesResources": true
}
#!/bin/bash
RETRY_SEC=${RETRY_SEC:-1}
RETRY_TIMES=${RETRY_TIMES:-30}
retry() {
local -r cmd="$@"
local -i retries=1
until $cmd; do
sleep $RETRY_SEC
#!/bin/bash
RETRY_SEC=${RETRY_SEC:-1}
RETRY_TIMES=${RETRY_TIMES:-30}
retry() {
local -r cmd="$@"
local -i retries=1
until $cmd; do
sleep $RETRY_SEC
#!/bin/bash
RETRY_SEC=${RETRY_SEC:-1}
RETRY_TIMES=${RETRY_TIMES:-30}
retry() {
local -r cmd="$@"
local -i retries=1
until $cmd; do
sleep $RETRY_SEC
data "castai_workload_scaling_policy_order" "cluster" {
cluster_id = castai_eks_clusterid.cluster_id.id
}
locals {
ordered_policy_ids = [
castai_workload_scaling_policy.default.id,
castai_workload_scaling_policy.default-statefulset.id,
]
unordered_policy_ids = tolist(setsubtract(data.castai_workload_scaling_policy_order.cluster.policy_ids, local.ordered_policy_ids))
#!/bin/bash
set -euo pipefail
echo "Starting AWS integration setup"
: ${INTEGRATION_NAME:="AWS discovery"}
: ${CASTAI_API_URL:="https://api.cast.ai"}
: ${ROLE_NAME:="castai-discovery-role"}
: ${STACKSET_NAME:="castai-discovery-roles"}
#!/bin/bash
# Hardcoded credentials - Replace these placeholder values with your actual credentials
SUBSCRIPTION_ID="your-subscription-id-here"
TENANT_ID="your-tenant-id-here"
CLIENT_ID="your-client-id-here"
FEDERATION_ID="your-federation-id-here"
CASTAI_CLUSTER_ID="your-cluster-id-here"
CASTAI_API_TOKEN="your-api-token-here"
CREDENTIALS='{
"subscriptionId": "'"$SUBSCRIPTION_ID"'",
"tenantId": "'"$TENANT_ID"'",
"clientId": "'"$CLIENT_ID"'",
"federationId": "'"$FEDERATION_ID"'"
}'
echo $CREDENTIALS
echo "Sending credentials to CAST AI console..."
API_URL="https://api.cast.ai/v1/kubernetes/external-clusters/${CASTAI_CLUSTER_ID}"
BODY=$(jq -c -n --arg CREDENTIALS "$CREDENTIALS" '{credentials:$CREDENTIALS}')