---
apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
  annotations:
    controller-gen.kubebuilder.io/version: v0.21.0
  name: meshmetrics.kuma.io
spec:
  group: kuma.io
  names:
    categories:
    - kuma
    kind: MeshMetric
    listKind: MeshMetricList
    plural: meshmetrics
    shortNames:
    - mm
    singular: meshmetric
  scope: Namespaced
  versions:
  - additionalPrinterColumns:
    - jsonPath: .spec.targetRef.kind
      name: TargetRef Kind
      type: string
    - jsonPath: .spec.targetRef.name
      name: TargetRef Name
      type: string
    name: v1alpha1
    schema:
      openAPIV3Schema:
        description: MeshMetric enables collection and export of service mesh metrics.
          It configures sidecar and application metrics scraping, allows customization
          of which metrics are published, and supports exporting to Prometheus or
          OpenTelemetry backends for monitoring and observability.
        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 MeshMetric resource.
            properties:
              default:
                description: MeshMetric configuration.
                properties:
                  applications:
                    description: |-
                      Applications is a list of applications that Dataplane Proxy will scrape.
                      Ignored on zone-proxy-only Dataplanes (zone ingress/egress exist without a co-located workload).
                    items:
                      properties:
                        address:
                          description: Address on which an application listens.
                          type: string
                        name:
                          description: Name of the application to scrape
                          type: string
                        path:
                          default: /metrics
                          description: Path on which an application expose HTTP endpoint
                            with metrics.
                          type: string
                        port:
                          description: Port on which an application expose HTTP endpoint
                            with metrics.
                          format: int32
                          type: integer
                      required:
                      - port
                      type: object
                    type: array
                  backends:
                    description: Backends list that will be used to collect metrics.
                    items:
                      properties:
                        openTelemetry:
                          description: OpenTelemetry backend configuration
                          properties:
                            backendRef:
                              description: |-
                                BackendRef is a reference to a MeshOpenTelemetryBackend resource that
                                defines the collector endpoint. Mutually exclusive with Endpoint.
                              properties:
                                kind:
                                  description: Kind of the backend resource.
                                  enum:
                                  - MeshOpenTelemetryBackend
                                  type: string
                                labels:
                                  additionalProperties:
                                    type: string
                                  description: |-
                                    Labels to match the referenced resource. When multiple resources match,
                                    the oldest by creation time wins.
                                  type: object
                              required:
                              - kind
                              type: object
                            endpoint:
                              default: ""
                              description: |-
                                Endpoint for OpenTelemetry collector.

                                Deprecated: use BackendRef instead.
                              type: string
                            refreshInterval:
                              description: RefreshInterval defines how frequent metrics
                                should be pushed to collector
                              type: string
                          type: object
                        prometheus:
                          description: Prometheus backend configuration.
                          properties:
                            clientId:
                              description: ClientId of the Prometheus backend. Needed
                                when using MADS for DP discovery.
                              type: string
                            path:
                              default: /metrics
                              description: Path on which a dataplane should expose
                                HTTP endpoint with Prometheus metrics.
                              type: string
                            port:
                              default: 5670
                              description: Port on which a dataplane should expose
                                HTTP endpoint with Prometheus metrics.
                              format: int32
                              type: integer
                            tls:
                              description: Configuration of TLS for prometheus listener.
                              properties:
                                mode:
                                  default: Disabled
                                  description: Configuration of TLS for Prometheus
                                    listener.
                                  enum:
                                  - Disabled
                                  - ProvidedTLS
                                  - ActiveMTLSBackend
                                  type: string
                              type: object
                          type: object
                        type:
                          description: Type of the backend that will be used to collect
                            metrics. At the moment only Prometheus backend is available.
                          enum:
                          - Prometheus
                          - OpenTelemetry
                          type: string
                      required:
                      - type
                      type: object
                    type: array
                  sidecar:
                    description: Sidecar metrics collection configuration
                    properties:
                      includeUnused:
                        description: |-
                          IncludeUnused if false will scrape only metrics that has been by sidecar (counters incremented
                          at least once, gauges changed at least once, and histograms added to at
                          least once). If true will scrape all metrics (even the ones with zeros).
                          If not specified then the default value is false.
                        type: boolean
                      profiles:
                        description: Profiles allows to customize which metrics are
                          published.
                        properties:
                          appendProfiles:
                            description: AppendProfiles allows to combine the metrics
                              from multiple predefined profiles.
                            items:
                              properties:
                                name:
                                  description: 'Name of the predefined profile, one
                                    of: all, basic, none'
                                  enum:
                                  - All
                                  - Basic
                                  - None
                                  type: string
                              required:
                              - name
                              type: object
                            type: array
                          exclude:
                            description: |-
                              Exclude makes it possible to exclude groups of metrics from a resulting profile.
                              Exclude is subordinate to Include.
                            items:
                              properties:
                                match:
                                  description: Match is the value used to match using
                                    particular Type
                                  type: string
                                type:
                                  description: 'Type defined the type of selector,
                                    one of: prefix, regex, exact'
                                  enum:
                                  - Prefix
                                  - Regex
                                  - Exact
                                  - Contains
                                  type: string
                              required:
                              - match
                              - type
                              type: object
                            type: array
                          include:
                            description: |-
                              Include makes it possible to include additional metrics in a selected profiles.
                              Include takes precedence over Exclude.
                            items:
                              properties:
                                match:
                                  description: Match is the value used to match using
                                    particular Type
                                  type: string
                                type:
                                  description: 'Type defined the type of selector,
                                    one of: prefix, regex, exact'
                                  enum:
                                  - Prefix
                                  - Regex
                                  - Exact
                                  - Contains
                                  type: string
                              required:
                              - match
                              - type
                              type: object
                            type: array
                        type: object
                    type: object
                type: object
              targetRef:
                description: |-
                  TargetRef is a reference to the resource the policy takes an effect on.
                  The resource could be either a real store object or virtual resource
                  defined in-place.
                properties:
                  kind:
                    description: Kind of the referenced resource
                    enum:
                    - Mesh
                    - MeshSubset
                    - MeshGateway
                    - MeshService
                    - MeshExternalService
                    - MeshMultiZoneService
                    - MeshServiceSubset
                    - MeshHTTPRoute
                    - Dataplane
                    type: string
                  labels:
                    additionalProperties:
                      type: string
                    description: |-
                      Labels are used to select group of MeshServices that match labels. Either Labels or
                      Name and Namespace can be used.
                    type: object
                  mesh:
                    description: Mesh is reserved for future use to identify cross
                      mesh resources.
                    type: string
                  name:
                    description: |-
                      Name of the referenced resource. Can only be used with kinds: `MeshService`,
                      `MeshServiceSubset` and `MeshGatewayRoute`
                    type: string
                  namespace:
                    description: |-
                      Namespace specifies the namespace of target resource. If empty only resources in policy namespace
                      will be targeted.
                    type: string
                  proxyTypes:
                    description: |-
                      ProxyTypes specifies the data plane types that are subject to the policy. When not specified,
                      all data plane types are targeted by the policy.
                    items:
                      enum:
                      - Sidecar
                      - Gateway
                      type: string
                    type: array
                  sectionName:
                    description: |-
                      SectionName is used to target specific section of resource.
                      For example, you can target port from MeshService.ports[] by its name. Only traffic to this port will be affected.
                    type: string
                  tags:
                    additionalProperties:
                      type: string
                    description: |-
                      Tags used to select a subset of proxies by tags. Can only be used with kinds
                      `MeshSubset` and `MeshServiceSubset`
                    type: object
                required:
                - kind
                type: object
            type: object
          status:
            description: Status is the current status of the Kuma MeshMetric 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
    subresources: {}
