apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
  name: keptnmetrics.metrics.keptn.sh
  annotations:
    controller-gen.kubebuilder.io/version: v0.16.5
    {{- with .Values.global.caInjectionAnnotations }}
    {{- toYaml . | nindent 4 }}
    {{- end }}
    {{- include "common.annotations" ( dict "context" . ) }}
  labels:
    app.kubernetes.io/part-of: keptn
    crdGroup: metrics.keptn.sh
    keptn.sh/inject-cert: "true"
{{- include "common.labels.standard" ( dict "context" . ) | nindent 4 }}
spec:
  group: metrics.keptn.sh
  names:
    kind: KeptnMetric
    listKind: KeptnMetricList
    plural: keptnmetrics
    singular: keptnmetric
  scope: Namespaced
  versions:
  - additionalPrinterColumns:
    - jsonPath: .spec.provider.name
      name: Provider
      type: string
    - jsonPath: .spec.query
      name: Query
      type: string
    - jsonPath: .spec.range.interval
      name: Interval
      type: string
    - jsonPath: .status.value
      name: Value
      type: string
    - jsonPath: .spec.range.step
      name: Step
      type: string
    - jsonPath: .spec.range.aggregation
      name: Aggregation
      type: string
    name: v1
    schema:
      openAPIV3Schema:
        description: KeptnMetric is the Schema for the keptnmetrics API
        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: KeptnMetricSpec defines the desired state of KeptnMetric
            properties:
              fetchIntervalSeconds:
                description: FetchIntervalSeconds represents the update frequency
                  in seconds that is used to update the metric
                type: integer
              provider:
                description: Provider represents the provider object
                properties:
                  name:
                    description: Name of the provider
                    type: string
                required:
                - name
                type: object
              query:
                description: Query represents the query to be run
                type: string
              range:
                description: Range represents the time range for which data is to
                  be queried
                properties:
                  aggregation:
                    description: 'Aggregation defines the type of aggregation function
                      to be applied on the data. Accepted values: p90, p95, p99, max,
                      min, avg, median'
                    enum:
                    - p90
                    - p95
                    - p99
                    - max
                    - min
                    - avg
                    - median
                    type: string
                  interval:
                    default: 5m
                    description: Interval specifies the duration of the time interval
                      for the data query
                    type: string
                  step:
                    description: Step represents the query resolution step width for
                      the data query
                    type: string
                  storedResults:
                    description: StoredResults indicates the upper limit of how many
                      past results should be stored in the status of a KeptnMetric
                    maximum: 255
                    type: integer
                type: object
            required:
            - fetchIntervalSeconds
            - provider
            - query
            type: object
          status:
            description: KeptnMetricStatus defines the observed state of KeptnMetric
            properties:
              errMsg:
                description: ErrMsg represents the error details when the query could
                  not be evaluated
                type: string
              intervalResults:
                description: IntervalResults contain a slice of all the interval results
                items:
                  properties:
                    errMsg:
                      description: ErrMsg represents the error details when the query
                        could not be evaluated
                      type: string
                    lastUpdated:
                      description: LastUpdated represents the time when the status
                        data was last updated
                      format: date-time
                      type: string
                    range:
                      description: Range represents the time range for which this
                        data was queried
                      properties:
                        aggregation:
                          description: 'Aggregation defines the type of aggregation
                            function to be applied on the data. Accepted values: p90,
                            p95, p99, max, min, avg, median'
                          enum:
                          - p90
                          - p95
                          - p99
                          - max
                          - min
                          - avg
                          - median
                          type: string
                        interval:
                          default: 5m
                          description: Interval specifies the duration of the time
                            interval for the data query
                          type: string
                        step:
                          description: Step represents the query resolution step width
                            for the data query
                          type: string
                        storedResults:
                          description: StoredResults indicates the upper limit of
                            how many past results should be stored in the status of
                            a KeptnMetric
                          maximum: 255
                          type: integer
                      type: object
                    value:
                      description: Value represents the resulting value
                      type: string
                  required:
                  - lastUpdated
                  - range
                  - value
                  type: object
                type: array
              lastUpdated:
                description: LastUpdated represents the time when the status data
                  was last updated
                format: date-time
                type: string
              rawValue:
                description: RawValue represents the resulting value in raw format
                format: byte
                type: string
              value:
                description: Value represents the resulting value
                type: string
            type: object
        type: object
    served: true
    storage: true
    subresources:
      status: {}
  - additionalPrinterColumns:
    - jsonPath: .spec.provider.name
      name: Provider
      type: string
    - jsonPath: .spec.query
      name: Query
      type: string
    - jsonPath: .status.value
      name: Value
      type: string
    name: v1alpha1
    schema:
      openAPIV3Schema:
        description: KeptnMetric is the Schema for the keptnmetrics API
        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: KeptnMetricSpec defines the desired state of KeptnMetric
            properties:
              fetchIntervalSeconds:
                description: FetchIntervalSeconds represents the update frequency
                  in seconds that is used to update the metric
                type: integer
              provider:
                description: Provider represents the provider object
                properties:
                  name:
                    description: Name of the provider
                    type: string
                required:
                - name
                type: object
              query:
                description: Query represents the query to be run
                type: string
            required:
            - fetchIntervalSeconds
            - provider
            - query
            type: object
          status:
            description: KeptnMetricStatus defines the observed state of KeptnMetric
            properties:
              lastUpdated:
                description: LastUpdated represents the time when the status data
                  was last updated
                format: date-time
                type: string
              rawValue:
                description: RawValue represents the resulting value in raw format
                format: byte
                type: string
              value:
                description: Value represents the resulting value
                type: string
            required:
            - lastUpdated
            - rawValue
            - value
            type: object
        type: object
    served: true
    storage: false
    subresources:
      status: {}
  - additionalPrinterColumns:
    - jsonPath: .spec.provider.name
      name: Provider
      type: string
    - jsonPath: .spec.query
      name: Query
      type: string
    - jsonPath: .status.value
      name: Value
      type: string
    name: v1alpha2
    schema:
      openAPIV3Schema:
        description: KeptnMetric is the Schema for the keptnmetrics API
        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: KeptnMetricSpec defines the desired state of KeptnMetric
            properties:
              fetchIntervalSeconds:
                description: FetchIntervalSeconds represents the update frequency
                  in seconds that is used to update the metric
                type: integer
              provider:
                description: Provider represents the provider object
                properties:
                  name:
                    description: Name of the provider
                    type: string
                required:
                - name
                type: object
              query:
                description: Query represents the query to be run
                type: string
            required:
            - fetchIntervalSeconds
            - provider
            - query
            type: object
          status:
            description: KeptnMetricStatus defines the observed state of KeptnMetric
            properties:
              lastUpdated:
                description: LastUpdated represents the time when the status data
                  was last updated
                format: date-time
                type: string
              rawValue:
                description: RawValue represents the resulting value in raw format
                format: byte
                type: string
              value:
                description: Value represents the resulting value
                type: string
            required:
            - lastUpdated
            - rawValue
            - value
            type: object
        type: object
    served: true
    storage: false
    subresources:
      status: {}
  - additionalPrinterColumns:
    - jsonPath: .spec.provider.name
      name: Provider
      type: string
    - jsonPath: .spec.query
      name: Query
      type: string
    - jsonPath: .spec.range.interval
      name: Interval
      type: string
    - jsonPath: .status.value
      name: Value
      type: string
    name: v1alpha3
    schema:
      openAPIV3Schema:
        description: KeptnMetric is the Schema for the keptnmetrics API
        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: KeptnMetricSpec defines the desired state of KeptnMetric
            properties:
              fetchIntervalSeconds:
                description: FetchIntervalSeconds represents the update frequency
                  in seconds that is used to update the metric
                type: integer
              provider:
                description: Provider represents the provider object
                properties:
                  name:
                    description: Name of the provider
                    type: string
                required:
                - name
                type: object
              query:
                description: Query represents the query to be run
                type: string
              range:
                description: Range represents the time range for which data is to
                  be queried
                properties:
                  aggregation:
                    description: 'Aggregation defines the type of aggregation function
                      to be applied on the data. Accepted values: p90, p95, p99, max,
                      min, avg, median'
                    enum:
                    - p90
                    - p95
                    - p99
                    - max
                    - min
                    - avg
                    - median
                    type: string
                  interval:
                    default: 5m
                    description: Interval specifies the duration of the time interval
                      for the data query
                    type: string
                  step:
                    description: Step represents the query resolution step width for
                      the data query
                    type: string
                  storedResults:
                    description: StoredResults indicates the upper limit of how many
                      past results should be stored in the status of a KeptnMetric
                    maximum: 255
                    type: integer
                type: object
            required:
            - fetchIntervalSeconds
            - provider
            - query
            type: object
          status:
            description: KeptnMetricStatus defines the observed state of KeptnMetric
            properties:
              errMsg:
                description: ErrMsg represents the error details when the query could
                  not be evaluated
                type: string
              intervalResults:
                description: IntervalResults contain a slice of all the interval results
                items:
                  properties:
                    errMsg:
                      description: ErrMsg represents the error details when the query
                        could not be evaluated
                      type: string
                    lastUpdated:
                      description: LastUpdated represents the time when the status
                        data was last updated
                      format: date-time
                      type: string
                    range:
                      description: Range represents the time range for which this
                        data was queried
                      properties:
                        aggregation:
                          description: 'Aggregation defines the type of aggregation
                            function to be applied on the data. Accepted values: p90,
                            p95, p99, max, min, avg, median'
                          enum:
                          - p90
                          - p95
                          - p99
                          - max
                          - min
                          - avg
                          - median
                          type: string
                        interval:
                          default: 5m
                          description: Interval specifies the duration of the time
                            interval for the data query
                          type: string
                        step:
                          description: Step represents the query resolution step width
                            for the data query
                          type: string
                        storedResults:
                          description: StoredResults indicates the upper limit of
                            how many past results should be stored in the status of
                            a KeptnMetric
                          maximum: 255
                          type: integer
                      type: object
                    value:
                      description: Value represents the resulting value
                      type: string
                  required:
                  - lastUpdated
                  - range
                  - value
                  type: object
                type: array
              lastUpdated:
                description: LastUpdated represents the time when the status data
                  was last updated
                format: date-time
                type: string
              rawValue:
                description: RawValue represents the resulting value in raw format
                format: byte
                type: string
              value:
                description: Value represents the resulting value
                type: string
            type: object
        type: object
    served: true
    storage: false
    subresources:
      status: {}
  - additionalPrinterColumns:
    - jsonPath: .spec.provider.name
      name: Provider
      type: string
    - jsonPath: .spec.query
      name: Query
      type: string
    - jsonPath: .spec.range.interval
      name: Interval
      type: string
    - jsonPath: .status.value
      name: Value
      type: string
    - jsonPath: .spec.range.step
      name: Step
      type: string
    - jsonPath: .spec.range.aggregation
      name: Aggregation
      type: string
    name: v1beta1
    schema:
      openAPIV3Schema:
        description: KeptnMetric is the Schema for the keptnmetrics API
        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: KeptnMetricSpec defines the desired state of KeptnMetric
            properties:
              fetchIntervalSeconds:
                description: FetchIntervalSeconds represents the update frequency
                  in seconds that is used to update the metric
                type: integer
              provider:
                description: Provider represents the provider object
                properties:
                  name:
                    description: Name of the provider
                    type: string
                required:
                - name
                type: object
              query:
                description: Query represents the query to be run
                type: string
              range:
                description: Range represents the time range for which data is to
                  be queried
                properties:
                  aggregation:
                    description: 'Aggregation defines the type of aggregation function
                      to be applied on the data. Accepted values: p90, p95, p99, max,
                      min, avg, median'
                    enum:
                    - p90
                    - p95
                    - p99
                    - max
                    - min
                    - avg
                    - median
                    type: string
                  interval:
                    default: 5m
                    description: Interval specifies the duration of the time interval
                      for the data query
                    type: string
                  step:
                    description: Step represents the query resolution step width for
                      the data query
                    type: string
                  storedResults:
                    description: StoredResults indicates the upper limit of how many
                      past results should be stored in the status of a KeptnMetric
                    maximum: 255
                    type: integer
                type: object
            required:
            - fetchIntervalSeconds
            - provider
            - query
            type: object
          status:
            description: KeptnMetricStatus defines the observed state of KeptnMetric
            properties:
              errMsg:
                description: ErrMsg represents the error details when the query could
                  not be evaluated
                type: string
              intervalResults:
                description: IntervalResults contain a slice of all the interval results
                items:
                  properties:
                    errMsg:
                      description: ErrMsg represents the error details when the query
                        could not be evaluated
                      type: string
                    lastUpdated:
                      description: LastUpdated represents the time when the status
                        data was last updated
                      format: date-time
                      type: string
                    range:
                      description: Range represents the time range for which this
                        data was queried
                      properties:
                        aggregation:
                          description: 'Aggregation defines the type of aggregation
                            function to be applied on the data. Accepted values: p90,
                            p95, p99, max, min, avg, median'
                          enum:
                          - p90
                          - p95
                          - p99
                          - max
                          - min
                          - avg
                          - median
                          type: string
                        interval:
                          default: 5m
                          description: Interval specifies the duration of the time
                            interval for the data query
                          type: string
                        step:
                          description: Step represents the query resolution step width
                            for the data query
                          type: string
                        storedResults:
                          description: StoredResults indicates the upper limit of
                            how many past results should be stored in the status of
                            a KeptnMetric
                          maximum: 255
                          type: integer
                      type: object
                    value:
                      description: Value represents the resulting value
                      type: string
                  required:
                  - lastUpdated
                  - range
                  - value
                  type: object
                type: array
              lastUpdated:
                description: LastUpdated represents the time when the status data
                  was last updated
                format: date-time
                type: string
              rawValue:
                description: RawValue represents the resulting value in raw format
                format: byte
                type: string
              value:
                description: Value represents the resulting value
                type: string
            type: object
        type: object
    served: true
    storage: false
    subresources:
      status: {}
