name: "observability"
description: "Оbservability cluster: VictoriaMetrics storage + Grafana consumer, wired with Prometheus/VictoriaLogs datasources."
schema_version: 1
version: "0.0.1-dev+20260828134229.53572e58"
api_version: "v1"

requirements:
  core:
    from_version: "0.0.0"
  victoriaaas:
    from_version: "0.0.0"
  grafanaaas:
    from_version: "0.0.0"

resources:

  # Profile-backed default disk sizes for the observability Victoria instance.
  # The values are selected per active core profile (develop/small/medium/
  # large/legacy), mirroring the default_cores/default_ram pattern from
  # core.yaml.j2. The profiles themselves are imported from core (see the
  # profile_* imports below).
  $core.vs.variables:
    metrics_disk_size:
      name: "metrics_disk_size"
      project_id: "12345678-c625-4fee-81d5-f691897b8142"
      setter:
        kind: profile
        element: null
        fallback_strategy: ignore
        profiles:
          - profile: $observability.imports.$profile_develop:uuid
            value: 10
          - profile: $observability.imports.$profile_small:uuid
            value: 20
          - profile: $observability.imports.$profile_medium:uuid
            value: 50
          - profile: $observability.imports.$profile_large:uuid
            value: 100
          - profile: $observability.imports.$profile_legacy:uuid
            value: 10
    logs_disk_size:
      name: "logs_disk_size"
      project_id: "12345678-c625-4fee-81d5-f691897b8142"
      setter:
        kind: profile
        element: null
        fallback_strategy: ignore
        profiles:
          - profile: $observability.imports.$profile_develop:uuid
            value: 10
          - profile: $observability.imports.$profile_small:uuid
            value: 20
          - profile: $observability.imports.$profile_medium:uuid
            value: 50
          - profile: $observability.imports.$profile_large:uuid
            value: 100
          - profile: $observability.imports.$profile_legacy:uuid
            value: 10

  $victoriaaas.types.victoria.instances:
    victoria:
      name: "victoria"
      project_id: "12345678-c625-4fee-81d5-f691897b8142"
      cpu: $observability.imports.$var_default_cores:value
      ram: $observability.imports.$var_default_ram:value
      metrics_disk_size: $core.vs.variables.$metrics_disk_size:value
      logs_disk_size: $core.vs.variables.$logs_disk_size:value
      retention_period: "30d"
      replicas: 1
      version_ref: $observability.imports.$victoria_v1:version_ref

  # Grafana admin password — generated and stored by the Core Secret
  # Manager as a URL-safe base64 string (AUTO_URL_SAFE). The instance
  # references the password value via $core.secret.passwords.$...:value,
  # so it is never hardcoded in the manifest.
  $core.secret.passwords:
    grafana_admin_password:
      name: "grafana_admin_password"
      description: "Grafana admin password"
      project_id: "12345678-c625-4fee-81d5-f691897b8142"
      method: "AUTO_URL_SAFE"
      constructor:
        kind: plain
      default_length: 32

  $grafanaaas.types.grafana.instances:
    grafana:
      name: "grafana"
      project_id: "12345678-c625-4fee-81d5-f691897b8142"
      cpu: $observability.imports.$var_default_cores:value
      ram: $observability.imports.$var_default_ram:value
      root_disk_size: 20
      replicas: 1
      admin_password: $core.secret.passwords.$grafana_admin_password:value
      version_ref: $observability.imports.$grafana_v13:version_ref

  # Pre-packaged dashboard artifacts shipped with the observability element.
  # The node-exporter-full dashboard (#1860 from grafana.com) provides
  # host-level CPU/memory/disk/network metrics for the node_exporter.
  $grafanaaas.types.grafana.dashboards:
    node_exporter_full:
      name: "node-exporter-full"
      project_id: "12345678-c625-4fee-81d5-f691897b8142"
      source:
        kind: bundled
        dashboard_id: 1860
        revision: 31

  # Wire the Grafana instance's datasources at the shared Victoria
  # instance's metrics/logs endpoints. Both instances are declared in this
  # same manifest, so this is a plain intra-manifest field reference — no
  # imports: entry is needed for it.
  $grafanaaas.types.grafana.instances.$grafana.datasources:
    victoria_metrics_ds:
      name: "victoria-metrics"
      project_id: "12345678-c625-4fee-81d5-f691897b8142"
      instance: $grafanaaas.types.grafana.instances.$grafana:uuid
      type: "prometheus"
      url: $victoriaaas.types.victoria.instances.$victoria:metrics_endpoint
      is_default: true
    victoria_logs_ds:
      name: "victoria-logs"
      project_id: "12345678-c625-4fee-81d5-f691897b8142"
      instance: $grafanaaas.types.grafana.instances.$grafana:uuid
      type: "victoriametrics-logs-datasource"
      url: $victoriaaas.types.victoria.instances.$victoria:logs_endpoint
      is_default: false

  # Bind the node-exporter-full dashboard artifact to the Grafana
  # instance. The builder resolves the version_ref to fetch the dashboard
  # JSON from the Grafana community catalog and provisions it on the DP.
  $grafanaaas.types.grafana.instances.$grafana.dashboards:
    node_exporter:
      name: "node-exporter-full"
      project_id: "12345678-c625-4fee-81d5-f691897b8142"
      instance: $grafanaaas.types.grafana.instances.$grafana:uuid
      folder: ""
      version_ref: $grafanaaas.types.grafana.dashboards.$node_exporter_full:version_ref

  # DNS records for the observability cluster, both pointing at the
  # first node IP of their respective instances:
  #   - observability.local.genesis-core.tech  -> Grafana UI
  #   - victoria-storage.local.genesis-core.tech -> Victoria storage
  $observability.imports.$core_local_domain.records:
    observability:
      domain: "$observability.imports.$core_local_domain:uuid"
      project_id: "12345678-c625-4fee-81d5-f691897b8142"
      type: "A"
      record:
        kind: "A"
        name: "observability"
        address: $grafanaaas.types.grafana.instances.$grafana:index(ipsv4, 0)
    victoria_storage:
      domain: "$observability.imports.$core_local_domain:uuid"
      project_id: "12345678-c625-4fee-81d5-f691897b8142"
      type: "A"
      record:
        kind: "A"
        name: "victoria-storage"
        address: $victoriaaas.types.victoria.instances.$victoria:index(ipsv4, 0)

imports:
  victoria_v1:
    element: "$victoriaaas"
    kind: "resource"
    link: "$victoriaaas.types.victoria.versions.$v1"
  grafana_v13:
    element: "$grafanaaas"
    kind: "resource"
    link: "$grafanaaas.types.grafana.versions.$v13"
  core_local_domain:
    element: "$core"
    kind: "resource"
    link: "$core.dns.domains.$local_domain"
  var_default_cores:
    element: "$core"
    kind: "resource"
    link: "$core.vs.variables.$default_cores"
  var_default_ram:
    element: "$core"
    kind: "resource"
    link: "$core.vs.variables.$default_ram"
  profile_develop:
    element: "$core"
    kind: "resource"
    link: "$core.vs.profiles.$develop"
  profile_small:
    element: "$core"
    kind: "resource"
    link: "$core.vs.profiles.$small"
  profile_medium:
    element: "$core"
    kind: "resource"
    link: "$core.vs.profiles.$medium"
  profile_large:
    element: "$core"
    kind: "resource"
    link: "$core.vs.profiles.$large"
  profile_legacy:
    element: "$core"
    kind: "resource"
    link: "$core.vs.profiles.$legacy"

exports:
  victoria_instance:
    link: "$victoriaaas.types.victoria.instances.$victoria"
  grafana_instance:
    link: "$grafanaaas.types.grafana.instances.$grafana"