apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
  #name must match the spec fields below, and be in the form: <plural>.<group>
  name: autotuneconfigs.recommender.com
spec:
  # group name to use for REST API: /apis/<group>/<version>
  group: "recommender.com"
  names:
    plural: autotuneconfigs
    singular: autotuneconfig
    #types can be identified with this tag
    kind: AutotuneConfig
  scope: Namespaced
  versions:
  - name: v1
    served: true
    storage: true
    schema:
      openAPIV3Schema:
        type: object
        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
          layer_name:
            description: 'Name of the layer'
            type: string
          layer_level:
            description: 'Denotes the level of tunables offered by the layer. 0 = container, 1 = runtime'
            type: integer
          details:
            description: 'Description of the layer'
            type: string
          layer_presence:
            type: object
            properties:
              presence:
                description: 'Set presence to always for the layer to apply to all applications'
                type: string
              queries:
                description: 'Query to detect the applications matching the layer'
                type: array
                items:
                  type: object
                  properties:
                    datasource:
                      description: 'Name of the datasource'
                      type: string
                    query:
                      description: 'Query for the datasource'
                      type: string
                    key:
                      description: 'Key to search for in the query response'
                      type: string
                  required:
                  - datasource
                  - query
                  - key
              label:
                description: 'Label used to detect the presence of the layer for the application for the datasource'
                type: array
                items:
                  type: object
                  properties:
                    name:
                      description: 'Name of the label'
                      type: string
                    value:
                      description: 'Value for the label'
                      type: string
          tunables:
            description: 'List of tunables affected by the query'
            type: array
            items:
              type: object
              properties:
                name:
                  description: 'Name of the tunable'
                  type: string
                description:
                  type: string
                upper_bound:
                  description: 'Upper bound of the recommendations generated for the tunable'
                  type: string
                lower_bound:
                  description: 'Lower bound of the recommendations generated for the tunable'
                  type: string
                value_type:
                  description: 'Value type of the query response (double, string, int)'
                  type: string
                step:
                  description: 'Step of the tunable'
                  type: number
                queries:
                  description: 'List of queries for the tunable'
                  type: array
                  items:
                    type: object
                    properties:
                      datasource:
                        description: 'Name of the datasource'
                        type: string
                      query:
                        description: 'Query for the datasource'
                        type: string
                    required:
                    - datasource
                    - query
                slo_class:
                  description: 'slo class of the tunable'
                  type: array
                  items:
                    type: string
              required:
              - name
              - upper_bound
              - lower_bound
              - value_type
              - slo_class
        required:
        - layer_name
        - layer_level
        - layer_presence
        - tunables
