Files
flights_web/deployment/k8s/flights-ui.yaml
T
gnezim d43bfb3fcb
CI / ci (push) Failing after 31s
Deploy / build-and-deploy (push) Failing after 5s
Fix URL truncation from bash \${VAR:=default} with braces
Deployed build had MAP_TILE_URL truncated to 'https://.../tile/{z' —
Leaflet then URL-encoded it to '%7Bz' and fetched garbage tile paths.
Root cause: build-docker.sh used

    : "\${MAP_TILE_URL:=https://flights.test.aeroflot.ru/map/api/tile/{z}/{x}/{y}.jpeg}"

and bash parameter expansion terminates the default value at the
FIRST unescaped '}', leaving '{z' and discarding the rest. The env
passed to `pnpm build:standalone` was already truncated, so every
downstream step (base64 encode → HTML inject → client decode) faithfully
carried the broken value through.

Fix by moving the defaults to Dockerfile's ARG lines — ARG defaults
are plain strings, not shell-parsed — and simplify build-docker.sh to
only forward MAP_TILE_URL / API_BASE_URL as --build-arg when the
caller explicitly sets them. Quote the k8s env values for defensive
YAML hygiene as well.
2026-04-19 00:44:45 +03:00

47 lines
1.5 KiB
YAML

apiVersion: apps/v1
kind: Deployment
metadata:
name: $AFL_PRJ_NAME
spec:
selector:
matchLabels:
name: $AFL_PRJ_NAME
template:
metadata:
labels:
name: $AFL_PRJ_NAME
spec:
nodeSelector:
kubernetes.io/os: linux
containers:
- name: $AFL_PRJ_NAME
image: $REGISTRY_SERVER/aeroflot.$K8NAMESPACE.$ENVIRONMENT/$AFL_PRJ_NAME:v$VERSION.$BUILD_NUMBER
ports:
- containerPort: 8080
resources:
limits:
memory: "256Mi"
cpu: "1000m"
requests:
memory: "64Mi"
cpu: "100m"
env:
- name: NODE_ENV
value: production
- name: ENVIRONMENT
value: $ENVIRONMENT
# flights-ui.devwebzavod.ru has no /map/api/** or /api/** ingress
# rule, so point Leaflet and the API client at the upstream
# services that the real Aeroflot ingress terminates.
# Both MAP_TILE_URL and API_BASE_URL are also wired as docker
# build-args because Modern.js bakes html.tags into the HTML at
# build time; the k8s env still flows to the Node SSR process.
# Quoted explicitly to keep `{z}/{x}/{y}` out of YAML flow-mapping
# ambiguity — parsers are fine today but plain scalars starting
# close to `{` are best kept in quotes.
- name: MAP_TILE_URL
value: "https://flights.test.aeroflot.ru/map/api/tile/{z}/{x}/{y}.jpeg"
- name: API_BASE_URL
value: "https://flights.test.aeroflot.ru/api"
$IMAGE_PULL_SECRETS