Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions cortex.sh
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,7 @@ fi
export CORTEX_LOG_GROUP="${CORTEX_LOG_GROUP:-cortex}"
export CORTEX_BUCKET="${CORTEX_BUCKET:-""}"
export CORTEX_REGION="${CORTEX_REGION:-us-west-2}"
export CORTEX_ZONES="${CORTEX_ZONES:-""}"

export CORTEX_CLUSTER="${CORTEX_CLUSTER:-cortex}"
export CORTEX_NODE_TYPE="${CORTEX_NODE_TYPE:-t3.small}"
Expand Down Expand Up @@ -141,25 +142,30 @@ export CORTEX_ENABLE_TELEMETRY="${CORTEX_ENABLE_TELEMETRY:-""}"
##########################

function install_eks() {
echo
docker run --entrypoint /root/install_eks.sh \
-e AWS_ACCESS_KEY_ID=$AWS_ACCESS_KEY_ID \
-e AWS_SECRET_ACCESS_KEY=$AWS_SECRET_ACCESS_KEY \
-e CORTEX_CLUSTER=$CORTEX_CLUSTER \
-e CORTEX_REGION=$CORTEX_REGION \
-e CORTEX_NODE_TYPE=$CORTEX_NODE_TYPE \
-e CORTEX_NODES_MIN=$CORTEX_NODES_MIN \
-e CORTEX_NODES_MAX=$CORTEX_NODES_MAX \
$CORTEX_IMAGE_MANAGER
}

function uninstall_eks() {
echo
docker run --entrypoint /root/uninstall_eks.sh \
-e AWS_ACCESS_KEY_ID=$AWS_ACCESS_KEY_ID \
-e AWS_SECRET_ACCESS_KEY=$AWS_SECRET_ACCESS_KEY \
-e CORTEX_CLUSTER=$CORTEX_CLUSTER \
-e CORTEX_REGION=$CORTEX_REGION \
$CORTEX_IMAGE_MANAGER
}

function install_cortex() {
echo
docker run --entrypoint /root/install_cortex.sh \
-e AWS_ACCESS_KEY_ID=$AWS_ACCESS_KEY_ID \
-e AWS_SECRET_ACCESS_KEY=$AWS_SECRET_ACCESS_KEY \
Expand Down Expand Up @@ -190,28 +196,34 @@ function install_cortex() {
}

function uninstall_cortex() {
echo
docker run --entrypoint /root/uninstall_cortex.sh \
-e AWS_ACCESS_KEY_ID=$AWS_ACCESS_KEY_ID \
-e AWS_SECRET_ACCESS_KEY=$AWS_SECRET_ACCESS_KEY \
-e CORTEX_CLUSTER=$CORTEX_CLUSTER \
-e CORTEX_REGION=$CORTEX_REGION \
-e CORTEX_NAMESPACE=$CORTEX_NAMESPACE \
$CORTEX_IMAGE_MANAGER
}

function uninstall_operator() {
echo
docker run --entrypoint /root/uninstall_operator.sh \
-e AWS_ACCESS_KEY_ID=$AWS_ACCESS_KEY_ID \
-e AWS_SECRET_ACCESS_KEY=$AWS_SECRET_ACCESS_KEY \
-e CORTEX_CLUSTER=$CORTEX_CLUSTER \
-e CORTEX_REGION=$CORTEX_REGION \
-e CORTEX_NAMESPACE=$CORTEX_NAMESPACE \
$CORTEX_IMAGE_MANAGER
}

function info() {
echo
docker run --entrypoint /root/info.sh \
-e AWS_ACCESS_KEY_ID=$AWS_ACCESS_KEY_ID \
-e AWS_SECRET_ACCESS_KEY=$AWS_SECRET_ACCESS_KEY \
-e CORTEX_CLUSTER=$CORTEX_CLUSTER \
-e CORTEX_REGION=$CORTEX_REGION \
-e CORTEX_NAMESPACE=$CORTEX_NAMESPACE \
$CORTEX_IMAGE_MANAGER
}
Expand Down
3 changes: 3 additions & 0 deletions docs/cluster/config.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,9 @@ export CORTEX_BUCKET="cortex-[RANDOM_ID]"
# The AWS region Cortex will use
export CORTEX_REGION="us-west-2"

# The AWS zones Cortex will use (e.g. "us-east-1a,us-east-1b")
export CORTEX_ZONES=""

# The name of the EKS cluster Cortex will use
export CORTEX_CLUSTER="cortex"

Expand Down
3 changes: 1 addition & 2 deletions manager/info.sh
Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,10 @@ function get_apis_endpoint() {
kubectl -n=$CORTEX_NAMESPACE get service nginx-controller-apis -o json | tr -d '[:space:]' | sed 's/.*{\"hostname\":\"\(.*\)\".*/\1/'
}

eksctl utils write-kubeconfig --name=$CORTEX_CLUSTER | grep -v "saved kubeconfig as" || true
eksctl utils write-kubeconfig --name=$CORTEX_CLUSTER --region=$CORTEX_REGION | grep -v "saved kubeconfig as" || true

operator_endpoint=$(get_operator_endpoint)
apis_endpoint=$(get_apis_endpoint)

echo
echo "Operator endpoint: $operator_endpoint"
echo "APIs endpoint: $apis_endpoint"
16 changes: 11 additions & 5 deletions manager/install_cortex.sh
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,16 @@ function setup_bucket() {
if ! aws s3api head-bucket --bucket $CORTEX_BUCKET --output json 2>/dev/null; then
if aws s3 ls "s3://$CORTEX_BUCKET" --output json 2>&1 | grep -q 'NoSuchBucket'; then
echo "✓ Creating an S3 bucket: $CORTEX_BUCKET"
aws s3api create-bucket --bucket $CORTEX_BUCKET \
--region $CORTEX_REGION \
--create-bucket-configuration LocationConstraint=$CORTEX_REGION \
>/dev/null
if [ "$CORTEX_REGION" == "us-east-1" ]; then
aws s3api create-bucket --bucket $CORTEX_BUCKET \
--region $CORTEX_REGION \
>/dev/null
else
aws s3api create-bucket --bucket $CORTEX_BUCKET \
--region $CORTEX_REGION \
--create-bucket-configuration LocationConstraint=$CORTEX_REGION \
>/dev/null
fi
else
echo "A bucket named \"${CORTEX_BUCKET}\" already exists, but you do not have access to it"
exit 1
Expand Down Expand Up @@ -152,7 +158,7 @@ function validate_cortex() {

eksctl utils write-kubeconfig --name=$CORTEX_CLUSTER --region=$CORTEX_REGION | grep -v "saved kubeconfig as" || true

echo -e "\nInstalling Cortex ..."
echo "Installing Cortex ..."

setup_bucket
setup_cloudwatch_logs
Expand Down
4 changes: 2 additions & 2 deletions manager/install_eks.sh
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,11 @@

set -e

echo -e "\nSpinning up the cluster ... (this will about 15 minutes)"
echo -e "Spinning up the cluster ... (this will take about 15 minutes)\n"

echo
eksctl create cluster --name=$CORTEX_CLUSTER \
--region=$CORTEX_REGION \
--zones=$CORTEX_ZONES \
--node-type=$CORTEX_NODE_TYPE \
--nodes-min=$CORTEX_NODES_MIN \
--nodes-max=$CORTEX_NODES_MAX \
Expand Down
2 changes: 1 addition & 1 deletion manager/uninstall_cortex.sh
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ set -e

eksctl utils write-kubeconfig --name=$CORTEX_CLUSTER --region=$CORTEX_REGION | grep -v "saved kubeconfig as" || true

echo -e "\nUninstalling Cortex ..."
echo "Uninstalling Cortex ..."

# Remove finalizers on sparkapplications (they sometimes create deadlocks)
if kubectl get namespace $CORTEX_NAMESPACE >/dev/null 2>&1 && kubectl get customresourcedefinition sparkapplications.sparkoperator.k8s.io >/dev/null 2>&1; then
Expand Down
3 changes: 1 addition & 2 deletions manager/uninstall_eks.sh
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,8 @@

set -e

echo -e "\nSpinning down the cluster ... (this will take a few minutes)"
echo -e "Spinning down the cluster ... (this will take a few minutes)\n"

echo
eksctl delete cluster --name=$CORTEX_CLUSTER --region=$CORTEX_REGION

echo -e "\n✓ Spun down the cluster"
2 changes: 1 addition & 1 deletion manager/uninstall_operator.sh
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ set -e

eksctl utils write-kubeconfig --name=$CORTEX_CLUSTER --region=$CORTEX_REGION | grep -v "saved kubeconfig as" || true

echo -e "\nUninstalling the Cortex operator ..."
echo "Uninstalling the Cortex operator ..."

kubectl -n=$CORTEX_NAMESPACE delete --ignore-not-found=true deployment operator >/dev/null 2>&1

Expand Down