Skip to content

Scrapes Goldilocks VPA pages to easily add its recommendations to your deployment.

License

Notifications You must be signed in to change notification settings

stephanGarland/goldilocks-scraper

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Goldilocks Recommendation Scraper

Acknowledgement

This would be an utterly useless tool without Goldilocks.

Why does this exist?

While Goldilocks does have a CLI that can output JSON, it doesn't clean up after itself, and is scoped to a single namespace.

Couldn't you have just run that in a for loop with kubectl get namespaces?

Go away.

Limitations

This does not change your k8s resource limits or requests, nor does it edit files for you. Honestly, that's probably a good thing. If you want to extend this to calling kubectl apply, be my guest, and be sure to post your prod disaster story later.

Prerequisites

  • Python 3.6+ for Typing and f-strings
  • Goldilocks installed in at least one cluster
  • A .kubeconfig file or some other method of authenticating with the cluster.
  • Packages from requirements.txt

Usage

usage: goldilocks_getter.py [-h] -d DOMAIN -f FILE [-m] \
       [-l {min,max,mean,median}] [-r {min,max,mean,median}] [-t]

This script scrapes recommendations from Goldilocks for all SOAs
in all namespaces, in all clusters available in the user's .kubeconfig.

optional arguments:
  -h, --help            show this help message and exit
  -d DOMAIN, --domain DOMAIN
                        domain where goldilocks is installed, 
                        e.g. foo.net
  -f FILE, --file FILE  Output file to store recommendations in
  -m, --mib             Use MiB instead of GiB for memory units
  -l {min,max,mean,median}, --limit {min,max,mean,median}
                        Stat to use for limits - defaults to max
  -r {min,max,mean,median}, --request {min,max,mean,median}
                        Stat to use for requests - defaults to median
  -t, --test            Only collect information from the first 
                        cluster to speed up testing

Example output

soa_1:
  resources:
    limits:
      cpu: 151.0m
      memory: 2.13Gi
    requests:
      cpu: 62.0m
      memory: 2.01Gi
soa_2:
  resources:
    limits:
      cpu: 25.0m
      memory: 0.24Gi
    requests:
      cpu: 25.0m
      memory: 0.24Gi

About

Scrapes Goldilocks VPA pages to easily add its recommendations to your deployment.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages