Skip to content
Closed
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
2 changes: 1 addition & 1 deletion deployment/crs-architecture.sh
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

set defaults to MINIKUBE_* vars if not present. On a production deployment you probably don't evan care about setting those vars in the env file

Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ up() {
;;
*)
echo -e "${BLU}Deploying minikube cluster${NC}"
minikube status | grep -q "Running" || minikube start --force --extra-config=kubeadm.skip-phases=preflight --cpus=8 --memory=32g --disk-size=80g --driver=docker --kubernetes-version=stable
minikube status | grep -q "Running" || minikube start --force --extra-config=kubeadm.skip-phases=preflight --cpus=${MINIKUBE_CPUS} --memory=${MINIKUBE_MEMORY} --disk-size=${MINIKUBE_DISK_SIZE} --driver=docker --kubernetes-version=stable
echo -e "${GRN}Minikube cluster status:${NC}"
minikube status

Expand Down
36 changes: 36 additions & 0 deletions deployment/env.template
Original file line number Diff line number Diff line change
Expand Up @@ -82,3 +82,39 @@ export ANTHROPIC_API_KEY="<your-anthropic-api-key>"

# Docker build arguments, useful for local deployment
export FUZZER_BASE_IMAGE="gcr.io/oss-fuzz-base/base-runner"

# Minikube cluster resource allocation
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Explain a bit more how/when these are used, saying they are for the minikube environment only. Also, maybe make these commented out by default and enable them in the detect-resources script?! WDYT?

export MINIKUBE_CPUS=8
export MINIKUBE_MEMORY=32g
export MINIKUBE_DISK_SIZE=80g

# Pod replica counts
export BUILD_BOT_REPLICAS=4
export LITELLM_REPLICAS=1

# Pod resource limits
export BUILD_BOT_CPU_LIMIT=500m
export BUILD_BOT_MEMORY_LIMIT=512Mi
export BUILD_BOT_CPU_REQUEST=250m
export BUILD_BOT_MEMORY_REQUEST=256Mi

export DIND_CPU_LIMIT=4000m
export DIND_MEMORY_LIMIT=16Gi
export DIND_CPU_REQUEST=500m
export DIND_MEMORY_REQUEST=1Gi

export SCHEDULER_CPU_LIMIT=500m
export SCHEDULER_MEMORY_LIMIT=512Mi
export SCHEDULER_CPU_REQUEST=250m
export SCHEDULER_MEMORY_REQUEST=256Mi

export REDIS_CPU_LIMIT=250m
export REDIS_MEMORY_LIMIT=512Mi
export REDIS_CPU_REQUEST=100m
export REDIS_MEMORY_REQUEST=256Mi

export SCRATCH_CLEANER_CPU_LIMIT=500m
export SCRATCH_CLEANER_MEMORY_LIMIT=1Gi
export SCRATCH_CLEANER_CPU_REQUEST=100m
export SCRATCH_CLEANER_MEMORY_REQUEST=256Mi

48 changes: 48 additions & 0 deletions deployment/k8s/values-upstream-minikube.template
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,54 @@ redis:
master:
persistence:
enabled: false
resources:
limits:
cpu: ${REDIS_CPU_LIMIT}
memory: ${REDIS_MEMORY_LIMIT}
requests:
cpu: ${REDIS_CPU_REQUEST}
memory: ${REDIS_MEMORY_REQUEST}

# Service-specific configurations with dynamic resource allocation
build-bot:
replicaCount: ${BUILD_BOT_REPLICAS}
resources:
limits:
cpu: ${BUILD_BOT_CPU_LIMIT}
memory: ${BUILD_BOT_MEMORY_LIMIT}
requests:
cpu: ${BUILD_BOT_CPU_REQUEST}
memory: ${BUILD_BOT_MEMORY_REQUEST}

scheduler:
resources:
limits:
cpu: ${SCHEDULER_CPU_LIMIT}
memory: ${SCHEDULER_MEMORY_LIMIT}
requests:
cpu: ${SCHEDULER_CPU_REQUEST}
memory: ${SCHEDULER_MEMORY_REQUEST}

dind-daemon:
resources:
limits:
cpu: ${DIND_CPU_LIMIT}
memory: ${DIND_MEMORY_LIMIT}
requests:
cpu: ${DIND_CPU_REQUEST}
memory: ${DIND_MEMORY_REQUEST}

scratch-cleaner:
resources:
limits:
cpu: ${SCRATCH_CLEANER_CPU_LIMIT}
memory: ${SCRATCH_CLEANER_MEMORY_LIMIT}
requests:
cpu: ${SCRATCH_CLEANER_CPU_REQUEST}
memory: ${SCRATCH_CLEANER_MEMORY_REQUEST}

litellm-helm:
replicaCount: ${LITELLM_REPLICAS}

litellm:
masterKey: "${LITELLM_MASTER_KEY}"
Expand Down
31 changes: 31 additions & 0 deletions scripts/common.sh
Original file line number Diff line number Diff line change
Expand Up @@ -565,6 +565,37 @@ check_config() {
fi
}

# Function to configure pod resources and replica counts
configure_pod_resources() {
print_status "Configuring pod resources and replica counts..."

# Only run resource detection for minikube deployments
local cluster_type="${CLUSTER_TYPE:-minikube}"
if [ "$cluster_type" != "minikube" ]; then
print_status "Non-minikube deployment detected (${cluster_type}), using default resource values"
return 0
fi

# Check if the resource detection script exists
local detect_script="$SCRIPT_DIR/detect-resources.sh"
if [ ! -f "$detect_script" ]; then
print_warning "Resource detection script not found, using default values"
return 0
fi

# Run the resource detection script to update deployment/env
if [ -f "deployment/env" ]; then
print_status "Running automatic resource detection for minikube deployment..."
if bash "$detect_script" "deployment/env"; then
print_success "Pod resources automatically configured based on system capabilities"
else
print_warning "Resource detection failed, using default values from template"
fi
else
print_warning "deployment/env not found, skipping resource detection"
fi
}

# Function to check AKS configuration
check_aks_config() {
print_status "Checking AKS configuration..."
Expand Down
Loading
Loading