Code Monkey home page Code Monkey logo

cfdot's Introduction

cfdot

cfdot is the CF Diego Operator Toolkit, a CLI tool designed to interact with Diego components.

At present, its commands focus on the Diego BBS API, the main public interface to a Diego deployment.

Current Commands

$ cfdot --help
A command-line tool to interact with a Cloud Foundry Diego deployment

Usage:
  cfdot [command]

Available Commands:
  actual-lrp-groups            List actual LRP groups
  actual-lrp-groups-for-guid   List actual LRP groups for a process guid
  create-desired-lrp           Create a desired LRP
  delete-desired-lrp           Delete a desired LRP
  desired-lrp                  Show the specified desired LRP
  desired-lrp-scheduling-infos List desired LRP scheduling infos
  desired-lrps                 List desired LRPs
  domains                      List domains
  retire-actual-lrp            Retire actual LRP by index and process guid
  set-domain                   Set domain
  task                         Display task
  update-desired-lrp           Update a desired LRP

Use "cfdot [command] --help" for more information about a command.

Running from a BOSH-deployed VM

cfdot is most useful in the context of a running Diego deployment. If you use the generate-deployment-manifest script in diego-release to generate your Diego manifest, cfdot is already available on the BOSH-deployed Diego VMs. To use it:

$ bosh ssh <DIEGO_JOB>/<INDEX>

$ source /var/vcap/jobs/cfdot/bin/setup

This setup script does 3 things:

  • Exports environment variables to target the BBS API in the deployment.
  • Puts the cfdot binary on the PATH.
  • Puts a jq binary on the PATH.

Basic Examples

# count the total number of desired instances
$ cfdot desired-lrp-scheduling-infos | jq '.instances' | jq -s 'add'
568

# show instance counts by state
$ cfdot actual-lrp-groups | jq '.instance, .evacuating | values' | jq -s -r 'group_by(.state)[] | .[0].state + ": " + (length | tostring)'
CRASHED: 36
RUNNING: 531
UNCLAIMED: 1

Building from Source

cfdot requires the Diego BBS client library. If you have already cloned diego-release, you can run the following commands using that diego-release directory as your GOPATH. Alternatively, run these commands with any other GOPATH and go get will automatically fetch the latest BBS code from diego-release.

# Get cfdot and required dependencies
go get code.cloudfoundry.org/cfdot
cd src/code.cloudfoundry.org/cfdot

# Build for Linux
GOOS=linux go build .

# Build for Mac
GOOS=darwin go build .

# Build for Windows
GOOS=windows go build .

Design Tenets

  • Execution is stateless: configuration is specified either as flags or as environment variables.
  • Conform to UNIX conventions of successful output on stdout and error messages on stderr.
  • For BBS API commands, output is a stream of JSON values, one per line, optimal for processing with jq and suitable for processing with bash and other line-based UNIX utilities.

cfdot's People

Contributors

joachimvaldez avatar jfmyers9 avatar jenspinney avatar jvshahid avatar caod123 avatar nimakaviani avatar emalm avatar bernerdschaefer avatar luan avatar

Watchers

James Cloos avatar Punal Patel 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.