kruize / autotune

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

Validate tunable datasource name #106

Open shruacha1234 opened 3 years ago

shruacha1234 commented 3 years ago

validate tunables-datasource-name for blank, invalid, multiple-sections, no-tunable-datasource-name, no-tunable-datasource-name-value, null, numerical values

blank-tunable-datasouce-name

apiVersion: "recommender.com/v1"
kind: "AutotuneConfig"
metadata:
  name: "blank-tunable-datasource-name"
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: '300M'
    lower_bound: '150M'
    queries:
      datasource:
        - name: ' '
          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
shruacha1234 commented 3 years ago

invalid

apiVersion: "recommender.com/v1"
kind: "AutotuneConfig"
metadata:
  name: "invalid-tunable-datasource-name"
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: '300M'
    lower_bound: '150M'
    queries:
      datasource:
        - name: 'prme'
          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
shruacha1234 commented 3 years ago

multiple-sections

apiVersion: "recommender.com/v1"
kind: "AutotuneConfig"
metadata:
  name: "multiple-tunable-datasource-name-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: '300M'
    lower_bound: '150M'
    queries:
      datasource:
        - name: 'prometheus'
        - name: 'graphite'
          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
shruacha1234 commented 3 years ago

no-tunable-datasource-name

apiVersion: "recommender.com/v1"
kind: "AutotuneConfig"
metadata:
  name: "no-tunable-datasource-name"
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: '300M'
    lower_bound: '150M'
    queries:
      datasource:
          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
shruacha1234 commented 3 years ago

no-tunable-datasource-name-value

apiVersion: "recommender.com/v1"
kind: "AutotuneConfig"
metadata:
  name: "no-tunable-datasource-name-val"
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: '300M'
    lower_bound: '150M'
    queries:
      datasource:
        - name: 
          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
shruacha1234 commented 3 years ago

null

apiVersion: "recommender.com/v1"
kind: "AutotuneConfig"
metadata:
  name: "null-tunable-datasource-name"
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: '300M'
    lower_bound: '150M'
    queries:
      datasource:
        - name: NULL
          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
shruacha1234 commented 3 years ago

numerical

apiVersion: "recommender.com/v1"
kind: "AutotuneConfig"
metadata:
  name: "numerical-tunable-datasource-name"
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: '300M'
    lower_bound: '150M'
    queries:
      datasource:
        - name: 135
          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
shruacha1234 commented 3 years ago

verified multiple-sections, no-tunable-datasource-name, no-tunable-datasource-name-value, null, numerical values and it is matching the expected result

chandrams commented 3 years ago

@shruacha1234 - What is not working here? If all issues are resolved close this one.

shruacha1234 commented 3 years ago

Blank and invalid tunable-datasource-name isn't working

rbadagandi commented 1 year ago

When I ran the tests for this issue, I still see 4 issues failed instead of 2.


Failed cases are :
          blank-datasource-name
          invalid-datasource-name
          valid-datasource-name
          invalid-direction-for-sloclass

Can I know why 'invalid-direction-for-sloclass' comes for 'datasource' name validation? Is this expected?
[app_autotune_yaml_tests.log](https://github.com/kruize/autotune/files/11048600/app_autotune_yaml_tests.log)