---
apiVersion: helm.toolkit.fluxcd.io/v2beta1
kind: HelmRelease
metadata:
  name: osdu-schema
  namespace: osdu-core
  annotations:
    clusterconfig.azure.com/use-managed-source: "true"
spec:
  dependsOn:
  - name: osdu-indexer-service
    namespace: osdu-core
  - name: osdu-indexer-queue
    namespace: osdu-core
  targetNamespace: osdu-core
  chart:
    spec:
      chart: ./charts/osdu-developer-service
      sourceRef:
        kind: GitRepository
        name: flux-system
        namespace: flux-system
  interval: 5m0s
  timeout: 6m
  install:
    remediation:
      retries: 3
  valuesFrom:
    - kind: ConfigMap
      name: configmap-software
      valuesKey: value.yaml
  values:
    nameOverride: schema
    installationType: osduCore
    subset: m24
    replicaCount: 1
    service:
      type: ClusterIP
      port: 80
    configuration:
    - service: schema
      path: /api/schema-service/v1/
      hosts:
        - "*"
      cors:
        - "http://localhost:8080"
      gateways:
        - istio-system/internal-gateway
        - istio-system/external-gateway
      repository: community.opengroup.org:5555/osdu/platform/system/schema-service/schema-service-
      tag: latest
      probe:
        path: /actuator/health
        port: 8081
      keyvault: true
      auth:
        disable:
        - "*/actuator/health"
        - "*/health"
        - "*/_ah/**"
        - "*/configuration/ui"
        - "*/configuration/security"
        - "/api/schema-service/v1/info"
        - "/api/schema-service/v1/swagger*"
        - "/api/schema-service/v1/api-docs*"
        - "/api/schema-service/v2/webjars/*"
      env:
      - name: KEYVAULT_URI
        secret:
          name: azure-resources
          key: keyvault-uri
      - name: AAD_CLIENT_ID
        secret:
          name: active-directory
          key: principal-clientid
      - name: APPINSIGHTS_KEY
        secret:
          name: azure-resources
          key: insights-key
      - name: APPLICATIONINSIGHTS_CONNECTION_STRING
        secret:
          name: azure-resources
          key: insights-connection
      - name: AZURE_ISTIOAUTH_ENABLED
        value: "true"
      - name: AZURE_PAAS_WORKLOADIDENTITY_ISENABLED
        value: "true"
      - name: SERVER_SERVLET_CONTEXTPATH
        value: "/api/schema-service/v1/"
      - name: SERVER_PORT
        value: "80"
      - name: ACCEPT_HTTP
        value: "true"
      - name: SPRING_APPLICATION_NAME
        value: "schema"
      - name: COSMOSDB_DATABASE
        value: "osdu-db"
      - name: LOG_PREFIX
        value: "schema"
      - name: AZURE_SYSTEM_STORAGECONTAINERNAME
        value: "system"
      - name: SERVICEBUS_TOPIC_NAME
        value: "schemachangedtopic"
      - name: EVENT_GRID_ENABLED
        value: 'false'
      - name: EVENT_GRID_TOPIC
        value: "schemachangedtopic"
      - name: SERVICE_BUS_ENABLED
        value: 'true'
      - name: PARTITION_SERVICE_ENDPOINT
        value: "http://partition/api/partition/v1"
      - name: ENTITLEMENTS_SERVICE_ENDPOINT
        value: "http://entitlements/api/entitlements/v2"
      - name: ENTITLEMENTS_SERVICE_API_KEY
        value: "OBSOLETE"
---
apiVersion: helm.toolkit.fluxcd.io/v2beta1
kind: HelmRelease
metadata:
  name: osdu-init-schema
  namespace: osdu-core
  annotations:
    clusterconfig.azure.com/use-managed-source: "true"
spec:
  dependsOn:
    - name: osdu-schema
      namespace: osdu-core
  targetNamespace: osdu-core
  chart:
    spec:
      chart: ./charts/osdu-developer-init
      sourceRef:
        kind: GitRepository
        name: flux-system
        namespace: flux-system
  interval: 5m0s
  install:
    remediation:
      retries: 3
  values:
    installationType: osduCore
    jobs:
      partitionInit: false
      entitlementInit: false
      userInit: false
      schemaInit: true
      elasticInit: false
    partition: opendes
    clientSecret:
      name: active-directory
      key: principal-clientpassword
  valuesFrom:
    - kind: ConfigMap
      name: configmap-software
      valuesKey: value.yaml
    - kind: ConfigMap
      name: configmap-services
      targetPath: clientId
      valuesKey: client_id
    - kind: ConfigMap
      name: configmap-services
      targetPath: tenantId
      valuesKey: tenant_id
    - kind: ConfigMap
      name: configmap-services
      targetPath: serviceBus
      valuesKey: partition_servicebus_name_0   ## This is the first data partition service bus name