prod deployment
This commit is contained in:
@@ -23,6 +23,7 @@ usage() {
|
||||
echo " relay-config - ZMQ relay configuration"
|
||||
echo " ingestor-config - CCXT ingestor configuration"
|
||||
echo " flink-config - Flink job configuration"
|
||||
echo " gateway-config - Gateway configuration (prod only; uses op inject)"
|
||||
echo ""
|
||||
echo "Examples:"
|
||||
echo " $0 # Update all dev configs"
|
||||
@@ -49,16 +50,18 @@ if [ ! -d "$CONFIG_DIR" ]; then
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Get kubectl context
|
||||
# Set kubectl command and warn for prod
|
||||
if [[ "$ENV" == "prod" ]]; then
|
||||
CONTEXT=$(kubectl config current-context)
|
||||
KUBECTL="kubectl --context=prod"
|
||||
echo -e "${YELLOW}⚠️ WARNING: Updating PRODUCTION configs!${NC}"
|
||||
echo -e "${YELLOW}Current kubectl context: $CONTEXT${NC}"
|
||||
echo -e "${YELLOW}kubectl context: prod${NC}"
|
||||
read -p "Are you sure you want to continue? (yes/no): " confirm
|
||||
if [[ "$confirm" != "yes" ]]; then
|
||||
echo "Aborted."
|
||||
exit 0
|
||||
fi
|
||||
else
|
||||
KUBECTL="kubectl"
|
||||
fi
|
||||
|
||||
apply_config() {
|
||||
@@ -71,9 +74,15 @@ apply_config() {
|
||||
fi
|
||||
|
||||
echo -e "${GREEN}→${NC} Creating/updating ConfigMap $config_name..."
|
||||
kubectl create configmap "$config_name" \
|
||||
--from-file=config.yaml="$config_file" \
|
||||
--dry-run=client -o yaml | kubectl apply -f -
|
||||
|
||||
if [[ "$ENV" == "prod" && "$config_name" == "gateway-config" ]]; then
|
||||
# gateway-config contains op:// references — resolve via op inject
|
||||
op inject -i "$config_file" | $KUBECTL apply -f -
|
||||
else
|
||||
$KUBECTL create configmap "$config_name" \
|
||||
--from-file=config.yaml="$config_file" \
|
||||
--dry-run=client -o yaml | $KUBECTL apply -f -
|
||||
fi
|
||||
echo -e "${GREEN}✓${NC} $config_name updated"
|
||||
|
||||
# Optionally restart pods that use this config
|
||||
@@ -88,11 +97,14 @@ apply_config() {
|
||||
flink-config)
|
||||
restart_pods="deployment/flink-jobmanager deployment/flink-taskmanager"
|
||||
;;
|
||||
gateway-config)
|
||||
restart_pods="deployment/gateway"
|
||||
;;
|
||||
esac
|
||||
|
||||
if [ -n "$restart_pods" ]; then
|
||||
echo -e "${YELLOW} Restarting pods...${NC}"
|
||||
kubectl rollout restart $restart_pods 2>/dev/null || echo -e "${YELLOW} (No pods found to restart)${NC}"
|
||||
$KUBECTL rollout restart $restart_pods 2>/dev/null || echo -e "${YELLOW} (No pods found to restart)${NC}"
|
||||
fi
|
||||
}
|
||||
|
||||
@@ -105,11 +117,20 @@ else
|
||||
echo -e "${GREEN}Updating all $ENV configs...${NC}"
|
||||
echo ""
|
||||
|
||||
CONFIGS=(
|
||||
"relay-config"
|
||||
"ingestor-config"
|
||||
"flink-config"
|
||||
)
|
||||
if [[ "$ENV" == "prod" ]]; then
|
||||
CONFIGS=(
|
||||
"relay-config"
|
||||
"ingestor-config"
|
||||
"flink-config"
|
||||
"gateway-config"
|
||||
)
|
||||
else
|
||||
CONFIGS=(
|
||||
"relay-config"
|
||||
"ingestor-config"
|
||||
"flink-config"
|
||||
)
|
||||
fi
|
||||
|
||||
FAILED=0
|
||||
for config in "${CONFIGS[@]}"; do
|
||||
|
||||
Reference in New Issue
Block a user