apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization

metadata:
  name: bakery-ia-dev

# NOTE: Do NOT set a global namespace here.
# Each resource already has its namespace explicitly defined.
# A global namespace would incorrectly transform cluster-scoped resources
# like cert-manager namespaces.

resources:
  - ../../../environments/common/configs
  # NOTE: nominatim is NOT included here - it's deployed manually via Tilt trigger 'nominatim-helm'
  # - ../../../platform/nominatim
  - ../../../platform/gateway
  - ../../../platform/cert-manager
  - ../../../platform/networking/ingress/overlays/dev
  - ../../../platform/storage
  - ../../../services/databases
  - ../../../services/microservices
  # NOTE: cicd is NOT included here - it's deployed manually via Tilt triggers
  # Run 'tilt trigger tekton-install' followed by 'tilt trigger tekton-pipelines-deploy'
  # - ../../../cicd
  - dev-certificate.yaml



# Dev-specific patches
patches:
  - target:
      kind: ConfigMap
      name: bakery-config
    patch: |-
      - op: replace
        path: /data/ENVIRONMENT
        value: "development"
      - op: replace
        path: /data/DEBUG
        value: "true"
  # NOTE: nominatim patches removed - nominatim is now deployed via Helm (tilt trigger nominatim-helm)


labels:
  - includeSelectors: true
    pairs:
      environment: development
      tier: local

# Dev image overrides - use Kind registry to avoid Docker Hub rate limits
# IMPORTANT: All image names must be lowercase (Docker requirement)
# The prepull-base-images.sh script pushes images to localhost:5000/ with format: <repo>_<tag>
# Format: localhost:5000/<package-name>_<tag>:latest
images:
  # Database images
  - name: postgres
    newName: localhost:5000/postgres_17_alpine
    newTag: latest
  - name: redis
    newName: localhost:5000/redis_7_4_alpine
    newTag: latest
  - name: rabbitmq
    newName: localhost:5000/rabbitmq_4_1_management_alpine
    newTag: latest
  # Utility images
  - name: busybox
    newName: localhost:5000/busybox_1_36
    newTag: latest
  - name: curlimages/curl
    newName: localhost:5000/curlimages_curl_latest
    newTag: latest
  - name: bitnami/kubectl
    newName: localhost:5000/bitnami_kubectl_latest
    newTag: latest

  # Alpine variants
  - name: alpine
    newName: localhost:5000/alpine_3_19
    newTag: latest
  - name: alpine/git
    newName: localhost:5000/alpine_git_2_43_0
    newTag: latest
  # CI/CD images (cached in Kind registry for consistency)
  - name: gcr.io/kaniko-project/executor
    newName: localhost:5000/gcr_io_kaniko_project_executor_v1_23_0
    newTag: latest
  - name: gcr.io/go-containerregistry/crane
    newName: localhost:5000/gcr_io_go_containerregistry_crane_latest
    newTag: latest
  - name: registry.k8s.io/kustomize/kustomize
    newName: localhost:5000/registry_k8s_io_kustomize_kustomize_v5_3_0
    newTag: latest
  # Storage images
  - name: minio/minio
    newName: localhost:5000/minio_minio_release_2024_11_07t00_52_20z
    newTag: latest
  - name: minio/mc
    newName: localhost:5000/minio_mc_release_2024_11_17t19_35_25z
    newTag: latest
  # NOTE: nominatim image override removed - nominatim is now deployed via Helm
  # Python base image
  - name: python
    newName: localhost:5000/python_3_11_slim
    newTag: latest
