Git Product home page Git Product logo

opstools's Introduction

Opstools

Tools for Operations.

Setup

Read and run the setup script:

./bin/setup

Run Scripts

To run a script with environment files loaded (using Foreman):

foreman run --env .env.shared,.env python src/...

Testing

Unit tests

make test

or

pytest <dir>
ptw <dir>

Test scripts that interact with Staging/Production Kubernetes cluster

Some scripts (e.g. kubernetes_export) interact with Staging/Production Kubernetes clusters. The scripts are usually run by Kubernetes as CronJobs that are tied to opstools Kubernetes service account which has the required permissions for the work.

When you test run the script locally, your kubectl authenticates to Kubernetes by KubernetesDev IAM role which ultimately maps to permissions that are much more than that of opstools service account. Therefore, you may find that the script works locally but when run in Staging/Production, it lacks permissions.

To make local testing accurate, we have created a KubernetesOpstools IAM role which ultimately maps to the same permissions that opstools service account has. So before testing, switch your kubectl to KubernetesOpstools role as follows:

  • Download config-opstools Kubeconfig file from S3 to ~/.kube directory. See setup script.
  • Symlink ~/.kube/config to ~/.kube/config-opstools.
  • Run the script that you wish to test, for example:
    python src/kubernetes_export/export.py staging
    
  • When done with testing, switch Kubeconfig back.

opstools's People

Contributors

artsyjian avatar joeyaghion avatar ovasdi avatar mc-jones avatar dependabot[bot] avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.