---
apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
  annotations:
    controller-gen.kubebuilder.io/version: v0.21.0
  name: meshopentelemetrybackends.kuma.io
spec:
  group: kuma.io
  names:
    categories:
    - kuma
    kind: MeshOpenTelemetryBackend
    listKind: MeshOpenTelemetryBackendList
    plural: meshopentelemetrybackends
    shortNames:
    - motb
    singular: meshopentelemetrybackend
  scope: Namespaced
  versions:
  - name: v1alpha1
    schema:
      openAPIV3Schema:
        description: |-
          MeshOpenTelemetryBackend defines a shared OTel collector endpoint for observability policies.
          An empty spec is valid and represents the node-local default flow
          (kuma-dp resolves the address at runtime using HOST_IP or 127.0.0.1).
        properties:
          apiVersion:
            description: |-
              APIVersion defines the versioned schema of this representation of an object.
              Servers should convert recognized schemas to the latest internal value, and
              may reject unrecognized values.
              More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources
            type: string
          kind:
            description: |-
              Kind is a string value representing the REST resource this object represents.
              Servers may infer this from the endpoint the client submits requests to.
              Cannot be updated.
              In CamelCase.
              More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds
            type: string
          metadata:
            type: object
          spec:
            description: Spec is the specification of the Kuma MeshOpenTelemetryBackend
              resource.
            properties:
              endpoint:
                description: |-
                  Endpoint optionally defines the OTel collector address and port.
                  When omitted, the CP defaults port to 4317 and leaves address empty;
                  kuma-dp resolves the address at runtime using HOST_IP or 127.0.0.1.
                properties:
                  address:
                    description: |-
                      Address of the OTel collector (hostname or IP).
                      When omitted, kuma-dp resolves it at runtime using HOST_IP or 127.0.0.1.
                    type: string
                  path:
                    description: |-
                      Path is an optional base path prefix for HTTP endpoints.
                      The CP appends signal-specific suffixes (/v1/traces, /v1/metrics, /v1/logs).
                      Non-empty value is rejected by validation when protocol is grpc.
                    type: string
                  port:
                    description: Port of the OTel collector. Defaults to 4317 when
                      omitted.
                    format: int32
                    type: integer
                type: object
              env:
                description: |-
                  Env controls whether standard OTEL exporter env vars participate in the
                  final exporter config for this backend.
                  Defaults to mode: Optional, precedence: EnvFirst, allowSignalOverrides: true
                  when omitted.
                properties:
                  allowSignalOverrides:
                    description: |-
                      AllowSignalOverrides controls whether per-signal OTEL env vars
                      (OTEL_EXPORTER_OTLP_TRACES_*, OTEL_EXPORTER_OTLP_METRICS_*,
                      OTEL_EXPORTER_OTLP_LOGS_*) may diverge from the shared
                      OTEL_EXPORTER_OTLP_* values.
                      true (default): per-signal vars override the shared values for that
                      signal.
                      false: per-signal vars are ignored; the shared values apply to all
                      signals. When per-signal overrides are dropped this way,
                      SignalOverridesDisallowed appears in blockedReasons (a soft block -
                      export still works via the shared config).
                    type: boolean
                  mode:
                    default: Optional
                    description: |-
                      Mode controls whether OTEL env vars participate in the merge.
                      Disabled: env vars are skipped entirely; only explicit backend fields and
                      built-in defaults apply.
                      Optional (default): env vars are used when present; absence is fine.
                      Required: env vars must supply the missing fields - if any required field
                      is missing the signal is blocked (state: missing, RequiredEnvMissing in
                      blockedReasons) even when an explicit value or default could fill it.
                    enum:
                    - Disabled
                    - Optional
                    - Required
                    type: string
                  precedence:
                    default: EnvFirst
                    description: |-
                      Precedence controls which source wins when both an explicit backend field
                      and an env var are present for the same field.
                      EnvFirst (default): env vars win; explicit backend fields fill gaps.
                      ExplicitFirst: explicit backend fields win; env vars fill gaps.
                      In either case, built-in defaults are the last fallback.
                    enum:
                    - ExplicitFirst
                    - EnvFirst
                    type: string
                type: object
              protocol:
                description: |-
                  Protocol selects gRPC or HTTP transport for the collector connection.
                  Defaults to grpc when omitted.
                enum:
                - grpc
                - http
                type: string
            type: object
          status:
            description: Status is the current status of the Kuma MeshOpenTelemetryBackend
              resource.
            properties:
              conditions:
                items:
                  properties:
                    message:
                      description: |-
                        message is a human readable message indicating details about the transition.
                        This may be an empty string.
                      maxLength: 32768
                      type: string
                    reason:
                      description: |-
                        reason contains a programmatic identifier indicating the reason for the condition's last transition.
                        Producers of specific condition types may define expected values and meanings for this field,
                        and whether the values are considered a guaranteed API.
                        The value should be a CamelCase string.
                        This field may not be empty.
                      maxLength: 1024
                      minLength: 1
                      pattern: ^[A-Za-z]([A-Za-z0-9_,:]*[A-Za-z0-9_])?$
                      type: string
                    status:
                      description: status of the condition, one of True, False, Unknown.
                      enum:
                      - "True"
                      - "False"
                      - Unknown
                      type: string
                    type:
                      description: type of condition in CamelCase or in foo.example.com/CamelCase.
                      maxLength: 316
                      pattern: ^([a-z0-9]([-a-z0-9]*[a-z0-9])?(\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*/)?(([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9])$
                      type: string
                  required:
                  - message
                  - reason
                  - status
                  - type
                  type: object
                type: array
            type: object
        type: object
    served: true
    storage: true
