Skip to content

Commit

Permalink
updated docs for v0.1.3
Browse files Browse the repository at this point in the history
  • Loading branch information
Sami Alajrami committed Nov 26, 2017
1 parent 6695bf8 commit 3e271a3
Show file tree
Hide file tree
Showing 11 changed files with 270 additions and 22 deletions.
36 changes: 26 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
---
version: v0.1.2
version: v0.1.3
---

# What is Helmsman?
Expand All @@ -13,46 +13,62 @@ Helmsman was created to ease continous deployment of Helm charts. When you want

# Features

- **Idempotency**: As long your desired state file does not change, you can execute Helmsman several times and get the same result.
- **Continue from failures**: In the case of partial executions due to a specific chart deployment failure, fix your helm chart and execute Helmsman again without needing to rollback the partial successes first.
- **Built for CD**: Helmsman can be used as a docker image or a binary.
- **Applications as code**: describe your desired applications and manage them from a single version-controlled declarative file.
- **Easy to use**: knowledge of Helm CLI and Kubectl is NOT manadatory to use Helmsman.
- **Plan, View, apply**: you can run Helmsman to generate and view a plan with/without executing it.
- **Easy to use**: deep knowledge of Helm CLI and Kubectl is NOT manadatory to use Helmsman.
- **Plan, View, apply**: you can run Helmsman to generate and view a plan with/without executing it.
- **Portable**: Helmsman can be used to manage charts deployments on any k8s cluster.
- **Idempotency**: As long your desired state file does not change, you can execute Helmsman several times and get the same result.
- **Continue from failures**: In the case of partial deployment due to a specific chart deployment failure, fix your helm chart and execute Helmsman again without needing to rollback the partial successes first.

# Helmsman lets you:

- [install/delete/upgrade/rollback your helm charts from code](https://github.com/Praqma/helmsman/blob/master/docs/how_to/manipulate_apps.md).
- [pass secrets/user input to helm charts from environment variables](https://github.com/Praqma/helmsman/blob/master/docs/how_to/pass_secrets_from env_variables.md).
- [test releases when they are first installed](https://github.com/Praqma/helmsman/blob/master/docs/how_to/test_charts.md).
- [use public and private helm charts](https://github.com/Praqma/helmsman/blob/master/docs/how_to/use_private_helm_charts.md).
- [use locally developed helm charts (the tar archives)](https://github.com/Praqma/helmsman/blob/master/docs/how_to/use_local_charts.md).
- [define namespaces to be used in your cluster](https://github.com/Praqma/helmsman/blob/master/docs/how_to/define_namespaces.md).
- [move charts across namespaces](https://github.com/Praqma/helmsman/blob/master/docs/how_to/move_charts_across_namespaces.md).


# Usage

Helmsman can be used in three different settings:

- As a binary on local machine [with either a Minikube or a hosted cluster ]. See the docs [here](https://github.com/Praqma/helmsman/blob/master/docs/how_to/run_helmsman_with_minikube.md) for instructions on using Minikube and [here](https://github.com/Praqma/helmsman/blob/master/docs/how_to/run_helmsman_with_hosted_cluster.md) for using hosted cluster.
- As a docker image [in a CI system or local machine]. See the docs [here](https://github.com/Praqma/helmsman/blob/master/docs/how_to/run_helmsman_in_ci.md) for instructions.
- [As a binary with Minikube](https://github.com/Praqma/helmsman/blob/master/docs/how_to/run_helmsman_with_minikube.md).
- [As a binary with a hosted cluster](https://github.com/Praqma/helmsman/blob/master/docs/how_to/run_helmsman_with_hosted_cluster.md).
- [As a docker image in a CI system or local machine](https://github.com/Praqma/helmsman/blob/master/docs/how_to/run_helmsman_in_ci.md).


# How does it work?

Helmsman uses a simple declarative [TOML](https://github.com/toml-lang/toml) file to allow you to describe a desired state for your k8s applications as in the [example file](https://github.com/Praqma/helmsman/blob/master/example.toml).

The desired state file follows the [desired state specification](https://github.com/Praqma/helmsman/blob/master/docs/desired_state_specification.md).

Helmsman sees what you desire, validates that your desire makes sense (e.g. that the charts you desire are available in the repos you defined), compares it with the current state of Helm and figures out what to do to make your desire come true. Below is the result of executing the [example.toml](https://github.com/Praqma/helmsman/blob/master/example.toml)
Helmsman sees what you desire, validates that your desire makes sense (e.g. that the charts you desire are available in the repos you defined), compares it with the current state of Helm and figures out what to do to make your desire come true.

To plan without executing:
``` $ helmsman -f example.toml ```

To plan and execute the plan:
``` $ helmsman -apply -f example.toml ```

To debug the planning:
To show debugging details:
``` $ helmsman -debug -apply -f example.toml ```

Check the documentation for [how to manage an app from the desired state file](https://github.com/Praqma/helmsman/blob/master/docs/how_to/manipulate_apps.md).

# Installation

Install Helmsman for your OS from the [releases page](https://github.com/Praqma/Helmsman/releases). Available for Linux and MacOS.

Also available as a [docker image](https://hub.docker.com/r/praqma/helmsman/).

# Documentaion

Documentation and How-Tos can be found [here](https://github.com/Praqma/helmsman/blob/master/docs/).

# Contributing

Contribution and feeback/feature requests are welcome.
38 changes: 38 additions & 0 deletions docs/how_to/define_namespaces.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
---
version: v0.1.3
---

# define namespaces

You can define namespaces to be used in your cluster. If they don't exist, Helmsman will create them for you.

```
...
[namespaces]
staging = "staging"
production = "default"
myOtherNamespace = "namespaceX"
...
```

You can then tell Helmsman to put specific releases in a specific namespace:

```
...
[apps]
[apps.jenkins]
name = "jenkins"
description = "jenkins"
namespace = "myOtherNamespace" # this is the pointer to the namespace defined above -- i.e. it deploys to namespace 'namespaceX'
enabled = true
chart = "stable/jenkins"
version = "0.9.1"
valuesFile = ""
purge = false
test = true
...
```
38 changes: 36 additions & 2 deletions docs/how_to/manipulate_apps.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
---
version: v0.1.2
version: v0.1.3
---

# install releases

You can run helmsman with the [example.toml](https://github.com/Praqma/helmsman/blob/master/example.toml) file.

Expand All @@ -28,10 +29,14 @@ artifactory 1 Sun Nov 19 18:18:06 2017 DEPLOYED artifactory-6.2.0 staging
jenkins 1 Sun Nov 19 18:18:03 2017 DEPLOYED jenkins-0.9.1 staging
```

# delete releases

You can then change your desire, for example to disable the Jenkins release that was created above by setting `enabled = false` :

Then run Helmsman again and it will detect that you want to delete Jenkins:

> Note: deleting the jenkins app entry in example.toml WILL NOT resultin deleting the jenkins release. It simply means that Helmsman is no longer responsible for managing it.
```
$ helmsman -apply -f example.toml
2017/11/19 18:28:27 Parsed [[ example.toml ]] successfully and found [ 2 ] apps.
Expand All @@ -52,6 +57,30 @@ NAME REVISION UPDATED STATUS CHART NAMESPA
artifactory 2 Sun Nov 19 18:29:11 2017 DEPLOYED artifactory-6.2.0 staging
```

If you would like the release to be deleted along with its history, you can use the `purge` key in your desired state file as follows:

> NOTE: purge deleting a release means you can't roll it back.
```
...
[apps]
[apps.jenkins]
name = "jenkins"
description = "jenkins"
namespace = "staging"
enabled = false # this tells helmsman to delete it
chart = "stable/jenkins"
version = "0.9.1"
valuesFile = ""
purge = true # this means purge delete this release whenever it is required to be deleted
test = flase
...
```

# rollback releases

Similarly, if you change `enabled` back to `true`, it will figure out that you would like to roll it back.

```
Expand All @@ -68,5 +97,10 @@ DECISION: release [ artifactory ] is desired to be upgraded. Planing this for yo
2017/11/19 18:30:50 INFO: attempting: -- upgrading release [ artifactory ]
```

Similarly, You can also change the chart or chart version and specify a values.yaml file to override the default chart values.
# upgrade releases

Everytime you run Helmsman, it will upgrade existing deployed releases to the version you specified in the desired state file. It also applies the `values.yaml` file you specify with each install/upgrade. This means that when you don't change anything for a specific release, Helmsman would upgrade with the `values.yaml` file you provide (just in case it is a new file or you changed something there.)

If you change the chart, the existing release will be deleted and a new one with the same name will be created using the new chart.


59 changes: 59 additions & 0 deletions docs/how_to/move_charts_across_namespaces.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
---
version: v0.1.3
---

# move charts across namespaces

If you have a workflow for testing a release first in the `staging` namespace then move to the `production` namespace, Helmsman can help you.

```
...
[namespaces]
staging = "staging"
production = "default"
myOtherNamespace = "namespaceX"
[apps]
[apps.jenkins]
name = "jenkins"
description = "jenkins"
namespace = "staging" # this is where it is deployed
enabled = true
chart = "stable/jenkins"
version = "0.9.1"
valuesFile = ""
purge = false
test = true
...
```

Then if you change the namespace key for jenkins:

```
...
[namespaces]
staging = "staging"
production = "default"
myOtherNamespace = "namespaceX"
[apps]
[apps.jenkins]
name = "jenkins"
description = "jenkins"
namespace = "production" # we want to move it to production
enabled = true
chart = "stable/jenkins"
version = "0.9.1"
valuesFile = ""
purge = false
test = true
...
```

Helmsman will delete the jenkins release from the `staging` namespace and install it in the `production` namespace (default in the above setup).
29 changes: 29 additions & 0 deletions docs/how_to/pass_secrets_from env_variables.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
---
version: v0.1.3
---

# pass secrets from env. variables:

Starting from v0.1.3, Helmsman allows you to pass secrets and other user input to helm charts from environment variables as follows:

```
...
[apps]
[apps.jira]
name = "jira"
description = "jira"
namespace = "staging"
enabled = true
chart = "myrepo/jira"
version = "0.1.5"
valuesFile = "applications/jira-values.yaml"
purge = false
test = true
[apps.jira.set] # the format is [apps.<<release_name (as defined above)>>.set]
db_username= "$JIRA_DB_USERNAME" # pass any number of key/value pairs where the key is the input expected by the helm charts and the value is an env variable name starting with $
db_password= "$JIRA_DB_PASSWORD"
...
```

These input variables will be passed to the chart when it is deployed/upgraded using helm's `--set <<var_name>>=<<var_value_read_from_env_var>>`
2 changes: 1 addition & 1 deletion docs/how_to/run_helmsman_in_ci.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
---
version: v0.1.2
version: v0.1.3
---

# Run Helmsman in CI
Expand Down
12 changes: 6 additions & 6 deletions docs/how_to/run_helmsman_with_hosted_cluster.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
---
version: v0.1.2
version: v0.1.3
---

You can manage Helm charts deployment on a hosted K8S cluster in the cloud or on-prem. You need to include the required information to connect to the cluster in your state file. Below is an example:

**IMPORTANT**: Only Certificates and private helm repos in S3 buckets are currently supported. Helmsman needs valid AWS access keys to be able to retrieve private charts or certificates from your s3 buckets. It expects the keys to be in the following environemnt variables:
**IMPORTANT**: Certificates can be used from S3 buckets or local file system. If you use s3 buckets, Helmsman needs valid AWS access keys to be able to retrieve private charts or certificates from your s3 buckets. It expects the keys to be in the following environemnt variables:

- AWS_ACCESS_KEY_ID
- AWS_SECRET_ACCESS_KEY
Expand All @@ -19,8 +19,8 @@ maintainer = "k8s-admin"
# Certificates are used to connect to the cluster. Currently, they can only be retrieved from s3 buckets.
[certificates]
caCrt = "s3://your-bucket/ca.crt"
caKey = "s3://your-bucket/ca.key"
caCrt = "s3://your-bucket/ca.crt" # s3 bucket
caKey = "../../ca.key" # relative file path
[settings]
kubeContext = "mycontext"
Expand All @@ -41,7 +41,7 @@ myrepo = "s3://my-private-repo/charts"
[apps.jenkins]
name = "jenkins"
description = "jenkins"
env = "staging"
namespace = "staging"
enabled = true
chart = "stable/jenkins"
version = "0.9.1"
Expand All @@ -53,7 +53,7 @@ myrepo = "s3://my-private-repo/charts"
[apps.artifactory]
name = "artifactory"
description = "artifactory"
env = "staging"
namespace = "staging"
enabled = true
chart = "stable/artifactory"
version = "6.2.0"
Expand Down
6 changes: 3 additions & 3 deletions docs/how_to/run_helmsman_with_minikube.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
---
version: v0.1.2
version: v0.1.3
---

You can run Helmsman local as a binary application with Minikube, you just need to skip all the cluster connection settings in your desired state file. Below is the example.toml desired state file adapted to work with Minikube.
Expand All @@ -25,7 +25,7 @@ incubator = "http://storage.googleapis.com/kubernetes-charts-incubator"
[apps.jenkins]
name = "jenkins"
description = "jenkins"
env = "staging"
namespace = "staging"
enabled = true
chart = "stable/jenkins"
version = "0.9.1"
Expand All @@ -37,7 +37,7 @@ incubator = "http://storage.googleapis.com/kubernetes-charts-incubator"
[apps.artifactory]
name = "artifactory"
description = "artifactory"
env = "staging"
namespace = "staging"
enabled = true
chart = "stable/artifactory"
version = "6.2.0"
Expand Down
25 changes: 25 additions & 0 deletions docs/how_to/test_charts.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
---
version: v0.1.3
---

# test charts

You can specifiy that you would like a chart to be tested whenever it is installed for the first time using the `test` key as follows:

```
...
[apps]
[apps.jenkins]
name = "jenkins"
description = "jenkins"
namespace = "staging"
enabled = true
chart = "stable/jenkins"
version = "0.9.1"
valuesFile = ""
purge = false
test = true # setting this to true, means you want the charts tests to be run on this release when it is intalled.
...
```
Loading

0 comments on commit 3e271a3

Please sign in to comment.