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
