kruize / autotune

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

Tunables upper bound can not be blank and can not have multiple sections #103

Open shruacha1234 opened 3 years ago

shruacha1234 commented 3 years ago

Required validation for upper bound

blank-tunable-upper-bound yaml

apiVersion: "recommender.com/v1"
kind: "AutotuneConfig"
metadata:
  name: "blank-tunable-upper-bound"
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
    upper_bound: ' '
    lower_bound: 150
    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-upper-bound-sections yaml

apiVersion: "recommender.com/v1"
kind: "AutotuneConfig"
metadata:
  name: "multiple-tunable-upper-bound-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
    upper_bound: 300
    upper_bound: 400
    lower_bound: 150
    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-upper-bound yaml

apiVersion: "recommender.com/v1"
kind: "AutotuneConfig"
metadata:
  name: "invalid-tunable-upper-bound"
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
    upper_bound: -100
    lower_bound: 150
    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

shruacha1234 commented 3 years ago

blank-upper-bound is tested and it is fixed For invaid-upper-bound object create message is printed along with the error message in autotune log. Can we have both error message and object create message for the same object invalid-tunable-upper-bound-autotune.log

ozer550 commented 1 year ago

I ran the tests locally and its failing blank-tunable-upper-bound tests for me.

image