Skip to content

Commit

Permalink
fix: basic service port override when the service is set (#269)
Browse files Browse the repository at this point in the history
  • Loading branch information
shreddedbacon authored Nov 27, 2023
1 parent 3d23c2e commit e28968a
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion legacy/build-deploy-docker-compose.sh
Original file line number Diff line number Diff line change
Expand Up @@ -1128,8 +1128,20 @@ do

HELM_SERVICE_TEMPLATE="templates/service.yaml"
if [ -f /kubectl-build-deploy/helmcharts/${SERVICE_TYPE}/$HELM_SERVICE_TEMPLATE ]; then
SERVICE_OVERRIDES=()
if [[ "$SERVICE_TYPE" == "basic" ]] ||
[[ "$SERVICE_TYPE" == "basic-persistent" ]]; then
SERVICE_PORT_NUMBER=$(cat $DOCKER_COMPOSE_YAML | shyaml get-value services.$COMPOSE_SERVICE.labels.lagoon\\.service\\.port false)
if [ ! $SERVICE_PORT_NUMBER == "false" ]; then
# check if the port provided is actually a number
if ! [[ $SERVICE_PORT_NUMBER =~ ^[0-9]+$ ]] ; then
echo "Provided service port is not a number"; exit 1;
fi
SERVICE_OVERRIDES+=(--set "service.port=${SERVICE_PORT_NUMBER}")
fi
fi
cat /kubectl-build-deploy/values.yaml
helm template ${SERVICE_NAME} /kubectl-build-deploy/helmcharts/${SERVICE_TYPE} -s $HELM_SERVICE_TEMPLATE -f /kubectl-build-deploy/values.yaml "${HELM_ARGUMENTS[@]}" > $YAML_FOLDER/service-${SERVICE_NAME}.yaml
helm template ${SERVICE_NAME} /kubectl-build-deploy/helmcharts/${SERVICE_TYPE} -s $HELM_SERVICE_TEMPLATE -f /kubectl-build-deploy/values.yaml "${SERVICE_OVERRIDES[@]}" "${HELM_ARGUMENTS[@]}" > $YAML_FOLDER/service-${SERVICE_NAME}.yaml
fi

HELM_DBAAS_TEMPLATE="templates/dbaas.yaml"
Expand Down

0 comments on commit e28968a

Please sign in to comment.