1.2.44 • Published 7 years ago

peopledata-cli v1.2.44

Weekly downloads
1
License
ISC
Repository
github
Last release
7 years ago

peopledata-cli

A collection of utilities that help us do development, CI and CD. Specifically on GCP/GKE and Kubernetes.

Getting started

Do a global install... npm install -g peopledata-cli

Kubernetes

A bunch of common kubernetes commands are wrapped, however we do output the underlying kubernetes command that is being executed - just so that people know what is going on.

Applications

We use the term 'app', but app is synologous with 'pod' for the purposes of this documentation.

Listing Apps

$ pdata app list
 -> kubectl get pods --output=json

┌───────────────────────────────┬──────────┬──────────────────┐
│ Pod Name                      │ Status   │ Labels           │
├───────────────────────────────┼──────────┼──────────────────┤
│ gocd-agent-2493599176-bycc5   │ Running  │ app=gocd-agent   │
│ gocd-agent-2493599176-scvc7   │ Running  │ app=gocd-agent   │
│ gocd-master-1388090259-9tkmm  │ Running  │ app=gocd-master  │
│ gocd-nginx-2641456012-3ts30   │ Running  │ app=gocd-nginx   │
└───────────────────────────────┴──────────┴──────────────────┘

Deploying Apps

We use GKE Registry and have images for each build of our docker image, and they're tagged with the build number. For example eu.gcr.io/yourteam/yourapp:buildnumber. As a result, we wanted to be able to template the kubernetes .yml files with environment variables, so we can CI/CD everything. You do this by using {{ENV.THING}} in your file, for example:

containers:
- name: master
  image: eu.gcr.io/yourteam/yourapp:{{ENV.GO_PIPELINE_COUNTER}}

You can deploy a single .yml file with pdata app deploy yourfile.yml, or you can deploy all .yml files in the current directory with pdata app deploy --all.

Other flags you might be interested in are:

  • --brutal, this will delete and recreate resources, rather than doing an apply.
  • --secrets, this is quite team specific, but will deploy any secrets found in $pwd/secrets/$APP_ENV. I'm still not totally happy with secret management from a CI CD perspective.
  • --wait-for-deployment, this will wait for a Kubernetes deployment to complete and all pods to be up before passing the build.

Destroying an App

The general idea here is that an app is composed of numerous kubernetes components, be it pods, persistent volumes, services etc. By convention, if you tag them all with app= you can bulk destroy them too with pdata app destroy label.

Entering an app

Entering pods with kubernetes pre 1.3.0 is kind of annoying, as the terminal is set at a fixed size of 80x24. This script will detect your current terminal window and pass those sizes through.

You can also enter a pod with a partial pod name, rather than needing the whole lengthy thing:

$ pdata pods enter nginx
 -> kubectl get pods --output=json
 -> kubectl exec -it gocd-nginx-2641456012-3ts30 env COLUMNS=204 LINES=56 TERM=xterm bash

[root@gocd-nginx-2641456012-3ts30 storage]# exit
1.2.44

7 years ago

1.2.43

7 years ago

1.2.42

7 years ago

1.2.41

7 years ago

1.2.40

7 years ago

1.2.39

7 years ago

1.2.38

7 years ago

1.2.37

7 years ago

1.2.36

7 years ago

1.2.35

7 years ago

1.2.33

7 years ago

1.2.32

7 years ago

1.2.31

7 years ago

1.2.30

7 years ago

1.2.29

7 years ago

1.2.28

7 years ago

1.2.27

7 years ago

1.2.26

7 years ago

1.2.25

7 years ago

1.2.24

7 years ago

1.2.23

7 years ago

1.2.22

7 years ago

1.2.21

7 years ago

1.2.20

7 years ago

1.2.19

7 years ago

1.2.18

7 years ago

1.2.17

7 years ago

1.2.16

7 years ago

1.2.15

7 years ago

1.2.14

7 years ago

1.2.13

7 years ago

1.2.11

7 years ago

1.2.10

7 years ago

1.2.9

7 years ago

1.2.7

7 years ago

1.2.6

7 years ago

1.2.5

7 years ago

1.2.4

8 years ago

1.1.3

8 years ago

1.1.28

8 years ago

1.1.27

8 years ago

1.1.26

8 years ago

1.1.25

8 years ago

1.1.24

8 years ago

1.1.23

8 years ago

1.1.22

8 years ago

1.1.21

8 years ago

1.1.19

8 years ago

1.1.18

8 years ago

1.1.17

8 years ago

1.1.16

8 years ago

1.1.15

8 years ago

1.1.14

8 years ago

1.1.12

8 years ago

1.1.11

8 years ago

1.0.11

8 years ago

1.1.0

8 years ago

1.0.10

8 years ago

1.0.9

8 years ago

1.0.8

8 years ago

1.0.7

8 years ago

1.0.3

8 years ago

1.0.1

8 years ago

1.0.0

8 years ago