-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Bump default image to 1.0.14; Add docs for deploying to fargate
- Loading branch information
1 parent
2d41ea9
commit 53081c2
Showing
9 changed files
with
308 additions
and
5 deletions.
There are no files selected for viewing
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 |
---|---|---|
|
@@ -21,3 +21,5 @@ | |
.idea/ | ||
*.tmproj | ||
.vscode/ | ||
# Documentation | ||
docs/ |
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
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
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
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,94 @@ | ||
#!/usr/bin/env bash | ||
|
||
# Setting common bash options | ||
set -o errexit # Exit on error | ||
set -o nounset # Treat unset variables as an error | ||
set -o pipefail # Consider errors in a pipeline | ||
|
||
# Default values for configuration variables | ||
cluster_name="whylabs" | ||
aws_region="us-west-2" | ||
|
||
# Function to print usage | ||
usage() { | ||
echo "Usage: $0 [--cluster-name <name>] [--aws-region <region>]" | ||
exit 1 | ||
} | ||
|
||
# Parse command line arguments | ||
while [[ "$#" -gt 0 ]]; do | ||
case $1 in | ||
--cluster-name) cluster_name="$2"; shift ;; | ||
--aws-region) aws_region="$2"; shift ;; | ||
*) echo "Unknown parameter passed: $1"; exit 1 ;; | ||
esac | ||
shift | ||
done | ||
|
||
# Automatically determine the architecture | ||
ARCH=$(uname -m) | ||
case $ARCH in | ||
x86_64) | ||
ARCH=amd64 | ||
;; | ||
aarch64 | arm64) | ||
ARCH=arm64 | ||
;; | ||
*) | ||
echo "Unsupported architecture: $ARCH" | ||
exit 1 | ||
;; | ||
esac | ||
PLATFORM=$(uname -s)_$ARCH | ||
|
||
export AWS_REGION="${aws_region}" | ||
|
||
# Install eksctl | ||
curl -sLO "https://github.com/eksctl-io/eksctl/releases/latest/download eksctl_$PLATFORM.tar.gz" | ||
tar -xzf eksctl_$PLATFORM.tar.gz -C /tmp && rm eksctl_$PLATFORM.tar.gz | ||
sudo mv /tmp/eksctl /usr/local/bin | ||
|
||
# Validate eksctl installation | ||
if ! command -v eksctl &> /dev/null; then | ||
echo "eksctl could not be installed" | ||
exit 1 | ||
fi | ||
|
||
# Install helm | ||
curl -fsSL -o get_helm.sh https://raw.githubusercontent.com/helm/helm/main/scripts/get-helm-3 | ||
chmod 700 get_helm.sh | ||
./get_helm.sh | ||
|
||
# Validate Helm installation | ||
if ! command -v helm &> /dev/null; then | ||
echo "Helm could not be installed" | ||
exit 1 | ||
fi | ||
|
||
# Create a configuration file for eksctl | ||
cat <<EOF > cluster.yaml | ||
apiVersion: eksctl.io/v1alpha5 | ||
kind: ClusterConfig | ||
metadata: | ||
name: "${cluster_name}" | ||
region: "${aws_region}" | ||
iam: | ||
withOIDC: true | ||
fargateProfiles: | ||
- name: default | ||
selectors: | ||
- namespace: default | ||
- namespace: kube-system | ||
EOF | ||
|
||
# Check if the configuration file exists | ||
if [ ! -f cluster.yaml ]; then | ||
echo "Configuration file not found; exiting" | ||
exit 1 | ||
fi | ||
|
||
# Create the cluster from the configuration file | ||
eksctl create cluster -f cluster.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,101 @@ | ||
#!/usr/bin/env bash | ||
|
||
# Setting common bash options | ||
set -o errexit # Exit on error | ||
set -o nounset # Treat unset variables as an error | ||
set -o pipefail # Consider errors in a pipeline | ||
|
||
# Default values for configuration variables | ||
whylabs_api_key="" | ||
langkit_password="" | ||
registry_username="" | ||
registry_token="" | ||
chart_version="" | ||
|
||
# Function to print usage | ||
usage() { | ||
echo "Usage: $0 [--whylabs-api-key <key>] [--langkit-password <password>] [--registry-username <username>]" | ||
echo " [--chart-version <version>] [--registry-token <token>]" | ||
exit 1 | ||
} | ||
|
||
# Parse command line arguments | ||
while [[ "$#" -gt 0 ]]; do | ||
case $1 in | ||
--whylabs-api-key) whylabs_api_key="$2"; shift ;; | ||
--langkit-password) langkit_password="$2"; shift ;; | ||
--registry-username) registry_username="$2"; shift ;; | ||
--registry-token) registry_token="$2"; shift ;; | ||
--chart-version) chart_version="$2"; shift ;; | ||
*) echo "Unknown parameter passed: $1"; exit 1 ;; | ||
esac | ||
shift | ||
done | ||
|
||
# Check mandatory parameters | ||
if [ -z "$whylabs_api_key" ] || [ -z "$langkit_password" ] || [ -z "$registry_username" ] || [ -z "$registry_token" ] || [ -z "$chart_version" ]; then | ||
echo "Error: Missing required parameters." | ||
usage | ||
fi | ||
|
||
# Create Kubernetes secrets | ||
kubectl create secret generic whylabs-api-key \ | ||
--namespace=langkit \ | ||
--from-literal=WHYLABS_API_KEY="${whylabs_api_key}" | ||
|
||
# Verify the secret was created successfully | ||
if [ $? -ne 0 ]; then | ||
echo "whylabs-api-key secret creation failed; exiting" | ||
exit 1 | ||
fi | ||
|
||
kubectl create secret generic langkit-api-secret \ | ||
--namespace=langkit \ | ||
--from-literal=CONTAINER_PASSWORD="${langkit_password}" | ||
|
||
# Verify the secret was created successfully | ||
if [ $? -ne 0 ]; then | ||
echo "langkit-api-secret secret creation failed; exiting" | ||
exit 1 | ||
fi | ||
|
||
kubectl create secret docker-registry langkit-gitlab-registry-secret \ | ||
--docker-server="registry.gitlab.com" \ | ||
--docker-username="${registry_username}" \ | ||
--docker-password="${registry_token}" \ | ||
--docker-email="${registry_username}@noreply.gitlab.com" \ | ||
--namespace=langkit | ||
|
||
# Verify the secret was created successfully | ||
if [ $? -ne 0 ]; then | ||
echo "langkit-gitlab-registry-secret secret creation failed; exiting" | ||
exit 1 | ||
fi | ||
|
||
# Download the langkit Helm chart | ||
helm pull \ | ||
oci://ghcr.io/whylabs/langkit \ | ||
--version "${chart_version}" | ||
|
||
# Check if helm pull was successful | ||
if [ $? -ne 0 ]; then | ||
echo "Helm chart download failed; exiting" | ||
exit 1 | ||
fi | ||
|
||
# Verify the Helm chart file exists at the expected path | ||
if [ ! -f "langkit-${chart_version}.tgz" ]; then | ||
echo "Helm chart not found; exiting" | ||
exit 1 | ||
fi | ||
|
||
# Install the langkit Helm chart | ||
helm upgrade --install \ | ||
--namespace default \ | ||
langkit "langkit-${chart_version}.tgz" | ||
|
||
# Check if Helm chart installation was successful | ||
if [ $? -ne 0 ]; then | ||
echo "Helm chart installation failed; exiting" | ||
exit 1 | ||
fi |
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,57 @@ | ||
# Fargate Deployment | ||
|
||
|
||
This guide describes how to set up an EKS cluster using Fargate for deploying | ||
Langkit. The process involves three separate scripts for better organization and | ||
maintainability. | ||
|
||
## Prerequisites | ||
|
||
- An AWS account with appropriate permissions for EKS and Fargate. | ||
- Git installed on your local machine. | ||
|
||
## Steps | ||
|
||
1. Clone this repository | ||
|
||
```shell | ||
git clone https://github.com/whylabs/charts.git | ||
|
||
( | ||
cd charts/langkit/docs | ||
chmod 755 prepare.sh | ||
chmod 755 deploy-fargate.sh | ||
chmod 755 deploy-langkit.sh | ||
) | ||
``` | ||
|
||
1. Install dependencies | ||
|
||
Navigate to the cloned directory and run the following command to install | ||
`eksctl` and `helm` for managing EKS clusters and Helm charts: | ||
|
||
```shell | ||
./prepare.sh | ||
``` | ||
|
||
1. Create EKS Fargate Cluster | ||
|
||
This script creates an EKS cluster configured to use Fargate for pod execution. | ||
By default, it creates a cluster named whylabs in the us-west-2 region: | ||
|
||
```shell | ||
./deploy-fargate.sh \ | ||
--cluster-name whylabs \ | ||
--aws-region us-west-2 | ||
``` | ||
|
||
1. Deploy Langkit | ||
|
||
```shell | ||
./deploy-langkit.sh \ | ||
--whylabs_api_key <key> \ | ||
--langkit_password <password> \ | ||
--registry_username <username> \ | ||
--registry_token <token> \ | ||
--chart_version <version> | ||
``` |
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,44 @@ | ||
#!/usr/bin/env bash | ||
|
||
# Setting common bash options | ||
set -o errexit # Exit on error | ||
set -o nounset # Treat unset variables as an error | ||
set -o pipefail # Consider errors in a pipeline | ||
|
||
# Determine the architecture | ||
ARCH=$(uname -m) | ||
case $ARCH in | ||
x86_64) | ||
ARCH=amd64 | ||
;; | ||
aarch64 | arm64) | ||
ARCH=arm64 | ||
;; | ||
*) | ||
echo "Unsupported architecture: $ARCH" | ||
exit 1 | ||
;; | ||
esac | ||
PLATFORM=$(uname -s)_$ARCH | ||
|
||
# Install eksctl | ||
curl -sLO "https://github.com/eksctl-io/eksctl/releases/latest/download eksctl_$PLATFORM.tar.gz" | ||
tar -xzf eksctl_$PLATFORM.tar.gz -C /tmp && rm eksctl_$PLATFORM.tar.gz | ||
sudo mv /tmp/eksctl /usr/local/bin | ||
|
||
# Validate eksctl installation | ||
if ! command -v eksctl &> /dev/null; then | ||
echo "eksctl could not be installed" | ||
exit 1 | ||
fi | ||
|
||
# Install helm | ||
curl -fsSL -o get_helm.sh https://raw.githubusercontent.com/helm/helm/main/scripts/get-helm-3 | ||
chmod 700 get_helm.sh | ||
./get_helm.sh | ||
|
||
# Validate Helm installation | ||
if ! command -v helm &> /dev/null; then | ||
echo "Helm could not be installed" | ||
exit 1 | ||
fi |
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