apiVersion: helm.toolkit.fluxcd.io/v2
kind: HelmRelease
metadata:
  name: istio-config
  namespace: default
spec:
  dependsOn: []
  interval: 5m
  timeout: 10m
  values:
    global:
      env: d8-ugmk-prod
    environments:
      d8-ugmk-prod:
        istio:
          gateways:
            platform:
              name: platform-gateway
              namespace: default
              selector:
                istio.deckhouse.io/ingress-gateway-class: istio
              servers:
                - hosts:
                    - sarex.uralmine.com
                    - sarex-login.uralmine.com
                    - rabbitmq.sarex-k8s.uralmine.com
                    - camunda-keycloak.sarex-k8s.uralmine.com
                    - camunda-identity.sarex-k8s.uralmine.com
                    - camunda-operate.sarex-k8s.uralmine.com
                    - camunda-tasklist.sarex-k8s.uralmine.com
                    - camunda-optimize.sarex-k8s.uralmine.com
                    - sarex-stamp-verification.uralmine.com
                    - sarex-document-link.uralmine.com
                  tls:
                    credentialName: istio-ingress-tls
          virtualServices:
            platform:
              name: sarex-frontend-virt-service
              namespace: default
              hosts:
                - sarex.uralmine.com
              gateways:
                - default/platform-gateway
              routes:
                # - path:
                #     prefix: /admin/
                #   service: backend-svc.django.svc.cluster.local
                #   port: 80

                # - path:
                #     prefix: /api/
                #   service: backend-svc.django.svc.cluster.local
                #   port: 80

                - path:
                    prefix: /
                  service: frontend-svc.django.svc.cluster.local
                  port: 80
            filestream-api:
              name: documentations-filestream-virt-service
              namespace: default
              hosts:
                - sarex.uralmine.com
              gateways:
                - default/platform-gateway
              routes:
                - path:
                    prefix: /files/api/
                  rewrite: /api/
                  service: backend-filestream-svc.documentations.svc.cluster.local
                  port: 80
            iam-api:
              name: iam-virt-service
              namespace: default
              hosts:
                - sarex.uralmine.com
              gateways:
                - default/platform-gateway
              routes:
                - path:
                    prefix: /iam/api/
                  rewrite: /external/api/
                  service: iam-backend.iam.svc.cluster.local
                  port: 8000
            documentations-frontend:
              name: documentations-frontend-virt-service
              namespace: default
              hosts:
                - sarex.uralmine.com
              gateways:
                - default/platform-gateway
              routes:
                - path:
                    prefix: /documentations/static/
                  rewrite: /
                  service: frontend-svc.documentations.svc.cluster.local
                  port: 80
            rfi-frontend:
              name: rfi-frontend-virt-service
              namespace: default
              hosts:
                - sarex.uralmine.com
              gateways:
                - default/platform-gateway
              routes:
                - path:
                    prefix: /rfi/static/
                  rewrite: /
                  service: frontend-svc.rfi.svc.cluster.local
                  port: 80
            rfi-api:
              name: rfi-api-virt-service
              namespace: default
              hosts:
                - sarex.uralmine.com
              gateways:
                - default/platform-gateway
              routes:
                - path:
                    prefix: /rfi/api/
                  rewrite: /api/
                  service: backend-svc.rfi.svc.cluster.local
                  port: 80
            pm:
              name: pm-virt-service
              namespace: default
              hosts:
                - sarex.uralmine.com
              gateways:
                - default/platform-gateway
              routes:
                - path:
                    prefix: /pm/api/
                  rewrite: /api/
                  service: backend-svc.pm.svc.cluster.local
                  port: 8000
                - path:
                    prefix: /pm/
                  rewrite: /
                  service: frontend-svc.pm.svc.cluster.local
                  port: 80
            documentations-api:
              name: documentations-api-virt-service
              namespace: default
              hosts:
                - sarex.uralmine.com
              gateways:
                - default/platform-gateway
              routes:
                - path:
                    prefix: /documentations/api/
                  rewrite: /api/
                  service: backend-api-svc.documentations.svc.cluster.local
                  port: 80
            workspaces-api:
              name: workspaces-api-virt-service
              namespace: default
              hosts:
                - sarex.uralmine.com
              gateways:
                - default/platform-gateway
              routes:
                - path:
                    prefix: /workspaces/api/
                  rewrite: /api/
                  service: backend-svc.workspaces.svc.cluster.local
                  port: 80
            gateway-platform:
              name: pdm-virt-service
              namespace: default
              hosts:
                - sarex.uralmine.com
              gateways:
                - default/platform-gateway
              routes:
                - path:
                    prefix: /gateway/
                  rewrite: /
                  service: pdm-svc.documentations.svc.cluster.local
                  port: 80
            issues-api:
              name: issues-api-virt-service
              namespace: default
              hosts:
                - sarex.uralmine.com
              gateways:
                - default/platform-gateway
              routes:
                - path:
                    prefix: /issues/api/
                  rewrite: /api/
                  service: backend-svc.issues.svc.cluster.local
                  port: 80
            checklists-api:
              name: checklists-api-virt-service
              namespace: default
              hosts:
                - sarex.uralmine.com
              gateways:
                - default/platform-gateway
              routes:
                - path:
                    prefix: /checklists/api/
                  rewrite: /api/
                  service: backend-svc.checklists.svc.cluster.local
                  port: 80
            bim-api:
              name: bim-api-virt-service
              namespace: default
              hosts:
                - sarex.uralmine.com
              gateways:
                - default/platform-gateway
              routes:
                - path:
                    prefix: /bimv2/api/
                  rewrite: /api/
                  service: backend-svc.bim.svc.cluster.local
                  port: 80
            flows-api:
              name: flows-api-virt-service
              namespace: default
              hosts:
                - sarex.uralmine.com
              gateways:
                - default/platform-gateway
              routes:
                - path:
                    prefix: /flows/api/
                  rewrite: /api/
                  service: backend-svc.flows.svc.cluster.local
                  port: 80
            issues-frontend:
              name: issues-frontend-virt-service
              namespace: default
              hosts:
                - sarex.uralmine.com
              gateways:
                - default/platform-gateway
              routes:
                - path:
                    prefix: /issues/static/
                  rewrite: /
                  service: frontend-svc.issues.svc.cluster.local
                  port: 80
            remarks-frontend:
              name: remarks-frontend-virt-service
              namespace: default
              hosts:
                - sarex.uralmine.com
              gateways:
                - default/platform-gateway
              routes:
                - path:
                    prefix: /remarks/static/
                  rewrite: /
                  service: frontend-service.remarks.svc.cluster.local
                  port: 80
            resources-frontend:
              name: resources-frontend-virt-service
              namespace: default
              hosts:
                - sarex.uralmine.com
              gateways:
                - default/platform-gateway
              routes:
                - path:
                    prefix: /resources/static/
                  rewrite: /
                  service: resources-static-svc.pm.svc.cluster.local
                  port: 80
            auth-frontend:
              name: auth-frontend-virt-service
              namespace: default
              hosts:
                - sarex.uralmine.com
              gateways:
                - default/platform-gateway
              routes:
                - path:
                    prefix: /auth/callback
                  rewrite: /
                  service: frontend-svc.auth-flow.svc.cluster.local
                  port: 80
            flows-frontend:
              name: flows-frontend-virt-service
              namespace: default
              hosts:
                - sarex.uralmine.com
              gateways:
                - default/platform-gateway
              routes:
                - path:
                    prefix: /flows/static/
                  rewrite: /
                  service: frontend-svc.flows.svc.cluster.local
                  port: 80
            transmittal-frontend:
              name: transmittal-frontend-virt-service
              namespace: default
              hosts:
                - sarex.uralmine.com
              gateways:
                - default/platform-gateway
              routes:
                - path:
                    prefix: /transmittal/static/
                  rewrite: /
                  service: frontend-svc.transmittal.svc.cluster.local
                  port: 80
            workflows-api:
              name: workflows-virt-service
              namespace: default
              hosts:
                - sarex.uralmine.com
              gateways:
                - default/platform-gateway
              routes:
                - path:
                    prefix: /workflows/api/
                  rewrite: /api/
                  service: backend-svc.processing.svc.cluster.local
                  port: 80
            transmittals-api:
              name: transmittals-api-virt-service
              namespace: default
              hosts:
                - sarex.uralmine.com
              gateways:
                - default/platform-gateway
              routes:
                - path:
                    prefix: /transmittals/api/
                  rewrite: /api/
                  service: backend-svc.transmittal.svc.cluster.local
                  port: 80
            inspections-api:
              name: flows-api-virt-service
              namespace: default
              hosts:
                - sarex.uralmine.com
              gateways:
                - default/platform-gateway
              routes:
                - path:
                    prefix: /inspections/api/
                  rewrite: /api/
                  service: backend-svc.inspections.svc.cluster.local
                  port: 80
            reviews-frontend:
              name: reviews-frontend-virt-service
              namespace: default
              hosts:
                - sarex.uralmine.com
              gateways:
                - default/platform-gateway
              routes:
                - path:
                    prefix: /reviews/static/
                  rewrite: /
                  service: frontend-svc.reviews.svc.cluster.local
                  port: 80
            eav-api:
              name: eav-api-virt-service
              namespace: default
              hosts:
                - sarex.uralmine.com
              gateways:
                - default/platform-gateway
              routes:
                - path:
                    prefix: /eav/api/v0
                  rewrite: /api/v4
                  service: backend-svc.eav.svc.cluster.local
                  port: 80
                - path:
                    prefix: /eav/api/v2
                  rewrite: /api/v5
                  service: backend-svc.eav.svc.cluster.local
                  port: 80
                - path:
                    prefix: /eav/api/v3
                  rewrite: /api/v3
                  service: backend-svc.eav.svc.cluster.local
                  port: 80
                - path:
                    prefix: /eav/api/v4
                  rewrite: /api/v4
                  service: backend-svc.eav.svc.cluster.local
                  port: 80
                - path:
                    prefix: /eav/api/v1
                  rewrite: /api/v6
                  service: backend-svc.eav.svc.cluster.local
                  port: 80
                - path:
                    prefix: /eav/admin/
                  rewrite: /eav/admin/
                  service: backend-svc.eav.svc.cluster.local
                  port: 80
            cde-api:
              name: cde-api-virt-service
              namespace: default
              hosts:
                - sarex.uralmine.com
              gateways:
                - default/platform-gateway
              routes:
                - path:
                    prefix: /orchestrator/api/process/
                  rewrite: /api/process/
                  service: cde-svc.cde.svc.cluster.local
                  port: 80
                - path:
                    prefix: /orchestrator/api/sign
                  rewrite: /api/sign
                  service: cde-svc.cde.svc.cluster.local
                  port: 80
                - path:
                    prefix: /orchestrator/
                  rewrite: /api/
                  service: cde-svc.cde.svc.cluster.local
                  port: 80
            srx-admin-frontend:
              name: srx-admin-frontend-virt-service
              namespace: default
              hosts:
                - sarex.uralmine.com
              gateways:
                - default/platform-gateway
              routes:
                - path:
                    prefix: /control-interface/
                  rewrite: /
                  service: frontend-svc.control-interface.svc.cluster.local
                  port: 8080
            camunda-keycloak:
              namespace: default
              hosts:
                - camunda-keycloak.sarex-k8s.uralmine.com
              gateways:
                - default/platform-gateway
              routes:
                - path:
                    prefix: /
                  service: camunda-keycloak.camunda.svc.cluster.local
                  port: 80
            camunda-identity:
              namespace: default
              hosts:
                - camunda-identity.sarex-k8s.uralmine.com
              gateways:
                - default/platform-gateway
              routes:
                - path:
                    prefix: /
                  service: camunda-identity.camunda.svc.cluster.local
                  port: 80
            camunda-operate:
              namespace: default
              hosts:
                - camunda-operate.sarex-k8s.uralmine.com
              gateways:
                - default/platform-gateway
              routes:
                - path:
                    prefix: /
                  service: camunda-operate.camunda.svc.cluster.local
                  port: 80
            camunda-tasklist:
              namespace: default
              hosts:
                - camunda-tasklist.sarex-k8s.uralmine.com
              gateways:
                - default/platform-gateway
              routes:
                - path:
                    prefix: /
                  service: camunda-tasklist.camunda.svc.cluster.local
                  port: 80
            camunda-optimize:
              namespace: default
              hosts:
                - camunda-optimize.sarex-k8s.uralmine.com
              gateways:
                - default/platform-gateway
              routes:
                - path:
                    prefix: /
                  service: camunda-optimize.camunda.svc.cluster.local
                  port: 80
            rabbitmq:
              namespace: default
              hosts:
                - rabbitmq.sarex-k8s.uralmine.com
              gateways:
                - default/platform-gateway
              routes:
                - path:
                    prefix: /
                  service: rabbitmq.rabbitmq.svc.cluster.local
                  port: 15672
            zitadel:
              namespace: default
              hosts:
                - sarex-login.uralmine.com
              gateways:
                - default/platform-gateway
              routes:
                - path:
                    prefix: /
                  service: zitadel-idp-contour.zitadel.svc.cluster.local
                  port: 8080
            stamp-verification:
              namespace: default
              hosts:
                - sarex-stamp-verification.uralmine.com
              gateways:
                - default/platform-gateway
              routes:
                - path:
                    prefix: /
                  service: frontend-service.stamp-verification.svc.cluster.local
                  port: 80
            document-link:
              namespace: default
              hosts:
                - sarex-document-link.uralmine.com
              gateways:
                - default/platform-gateway
              routes:
                - path:
                    prefix: /
                  service: frontend-service.document-link.svc.cluster.local
                  port: 80
