---
apiVersion: helm.toolkit.fluxcd.io/v2beta1
kind: HelmRelease
metadata:
  name: osdu-partition
  namespace: osdu-core
  annotations:
    clusterconfig.azure.com/use-managed-source: "true"
spec:
  dependsOn:
    - name: osdu-developer-base-core
      namespace: default
  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
    - kind: ConfigMap
      name: configmap-repo-override
      optional: true
      valuesKey: repository.yaml
  values:
    nameOverride: partition
    installationType: osduCore
    subset: m24
    replicaCount: 1
    service:
      type: ClusterIP
      port: 80
    configuration:
      - service: partition
        path: /api/partition/v1/
        hosts:
          - "*"
        gateways:
          - istio-system/internal-gateway
          - istio-system/external-gateway
        repository: community.opengroup.org:5555/osdu/platform/system/partition/partition-
        tag: latest
        probe:
          path: /actuator/health
          port: 8081
          liveness:
            delay: 250
            seconds: 10
        keyvault: true
        auth:
          disable:
            - "*/actuator/health"
            - "*/health"
            - "*/_ah/**"
            - "*/configuration/ui"
            - "*/configuration/security"
            - "/api/partition/v1/info"
            - "/api/partition/v1/swagger*"
            - "/api/partition/v1/api-docs*"
            - "/api/partition/v1/webjars/*"
            - "/api/partition/v1/liveness_check*"
        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/partition/v1/"
          - name: SERVER_PORT
            value: "80"
          - name: ACCEPT_HTTP
            value: "true"
          - name: SPRING_APPLICATION_NAME
            value: "partition"
          - name: REDIS_DATABASE
            value: "1"
          - name: PARTITION_SPRING_LOGGING_LEVEL
            value: "DEBUG"
---
# Retrigger:  kubectl annotate helmrelease osdu-partition-init fluxcd.io/retrigger=$(date +%s) -n osdu-core
apiVersion: helm.toolkit.fluxcd.io/v2beta1
kind: HelmRelease
metadata:
  name: osdu-partition-init
  namespace: osdu-core
  annotations:
    clusterconfig.azure.com/use-managed-source: "true"
    fluxcd.io/retrigger: "initial"  # Update this to a new value each time
spec:
  dependsOn:
    - name: osdu-partition
      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: true
      entitlementInit: false
      userInit: false
      elasticInit: false
      schemaInit: false
    partition: opendes
  valuesFrom:
    - kind: ConfigMap
      name: configmap-software
      valuesKey: value.yaml
    - kind: Secret
      name: active-directory
      targetPath: clientId
      valuesKey: msi-clientid
    - 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