github.com/munnerz/test-infra@v0.0.0-20190108210205-ce3d181dc989/velodrome/token-counter/README.md (about)

     1  Overview
     2  ========
     3  
     4  Token-counter is a program that polls github to see how much of a token's
     5  ratelimit has been used.
     6  
     7  Github doesn't report how many requests you've used, and instead reports
     8  how many request you have left before the rate-limit resets.
     9  In order to do that, we poll more and more aggressively as we get near to the reset
    10  time. Once the reset happens, we compute the difference between `Limit` and
    11  `Remaining` giving us how much we've used in the last hour.
    12  
    13  Deploying
    14  =========
    15  
    16  token-counter is fairly easy to deploy, and can keep track of multiple keys at
    17  the same time. The result will be pushed to an InfluxDB.
    18  
    19  Make a `github-tokens` secret with each of your tokens in there:
    20  ```
    21  kubectl create secret generic github-tokens --from-file=token1=token1 ...
    22  ```
    23  
    24  Change `deployment.yaml` to have `--token=token1` for each of your token. Also
    25  make sure the influxdb is properly configured.
    26  
    27  Deploy the token-counter:
    28  ```
    29  kubectl apply -f deployment.yaml
    30  ```