kruize / autotune

Autonomous Performance Tuning for Kubernetes!
Apache License 2.0
165 stars 54 forks source link

Required validation for blank, invalid, multiple-sections of tunable value type #101

Open shruacha1234 opened 3 years ago

shruacha1234 commented 3 years ago

Required validation for blank, invalid, multiple-sections of tunable value type

blank-tunable-value-type yaml

apiVersion: "recommender.com/v1"
kind: "AutotuneConfig"
metadata:
  name: "blank-tunable-value-type"
layer_name: container
layer_level: 0
details: generic container tunables
layerPresence:
  # This layer is assumed to be available by default for all applications.
  presence: always
tunables:
  - name: memoryRequest
    value_type: " "
    upper_bound: '300M'
    lower_bound: '150M'
    queries:
      datasource:
        - name: 'prometheus'
          query: 'container_memory_working_set_bytes{$CONTAINER_LABEL$="", $POD_LABEL$="$POD$"}'
    sla_class:
      - response_time
      - throughput
      - resource_usage

  - name: cpuRequest
    value_type: double
    upper_bound: '3.0'
    lower_bound: '1.0'
    queries:
      datasource:
        - name: 'prometheus'
          query: '(container_cpu_usage_seconds_total{$CONTAINER_LABEL$!="POD", $POD_LABEL$="$POD$"}[1m])'
    sla_class:
      - response_time
      - throughput
      - resource_usage

invalid-tunable-value-type

apiVersion: "recommender.com/v1"
kind: "AutotuneConfig"
metadata:
  name: "invalid-tunable-value-type"
layer_name: container
layer_level: 0
details: generic container tunables
layerPresence:
  # This layer is assumed to be available by default for all applications.
  presence: always
tunables:
  - name: memoryRequest
    value_type: decimal
    upper_bound: '300M'
    lower_bound: '150M'
    queries:
      datasource:
        - name: 'prometheus'
          query: 'container_memory_working_set_bytes{$CONTAINER_LABEL$="", $POD_LABEL$="$POD$"}'
    sla_class:
      - response_time
      - throughput
      - resource_usage

  - name: cpuRequest
    value_type: double
    upper_bound: '3.0'
    lower_bound: '1.0'
    queries:
      datasource:
        - name: 'prometheus'
          query: '(container_cpu_usage_seconds_total{$CONTAINER_LABEL$!="POD", $POD_LABEL$="$POD$"}[1m])'
    sla_class:
      - response_time
      - throughput
      - resource_usage

multiple-tunable-value-type-sections

apiVersion: "recommender.com/v1"
kind: "AutotuneConfig"
metadata:
  name: "multiple-tunable-value-type-section"
layer_name: container
layer_level: 0
details: generic container tunables
layerPresence:
  # This layer is assumed to be available by default for all applications.
  presence: always
tunables:
  - name: memoryRequest
    value_type: double
    value_type: float
    upper_bound: '300M'
    lower_bound: '150M'
    queries:
      datasource:
        - name: 'prometheus'
          query: 'container_memory_working_set_bytes{$CONTAINER_LABEL$="", $POD_LABEL$="$POD$"}'
    sla_class:
      - response_time
      - throughput
      - resource_usage

  - name: cpuRequest
    value_type: double
    upper_bound: '3.0'
    lower_bound: '1.0'
    queries:
      datasource:
        - name: 'prometheus'
          query: '(container_cpu_usage_seconds_total{$CONTAINER_LABEL$!="POD", $POD_LABEL$="$POD$"}[1m])'
    sla_class:
      - response_time
      - throughput
      - resource_usage
ShishirH commented 3 years ago

In case of multiple entries, the last entry will be picked up and is expected behaviour from Kubernetes