Skip to content

Commit

Permalink
fixed readme for better-helm
Browse files Browse the repository at this point in the history
  • Loading branch information
wpernath committed Mar 15, 2022
1 parent 927dc67 commit de9372f
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 10 deletions.
19 changes: 11 additions & 8 deletions better-helm/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,20 +3,20 @@ In chapter 3 of my book `Getting GitOps. A Practical Platform with OpenShift, Ar

However, it really was a basic example which only focused on what’s necessary to create and deploy a Helm Chart.

This article is showing some more advanced techniques to create a chart which could be installed more than once in the same namespace. It also shows how you could easily install a dependent database.
This article is showing some more advanced techniques to create a chart which could be installed more than once in the same namespace. It also shows how you could easily install a dependent database with your chart.

The sources for this example can be found on [GitHub](https://github.com/wpernath/book-example/tree/main/better-helm).

## The use case
During the development of our `person-service` (see chapter one in the book), we were realizing that we need to have a dependent database installed with our chart. As we have discussed in chapter one, we have three options here:
1. We try to use the corresponding OpenShift Template to install the necessary PostgreSQL database
2. We use the [CrunchyData Postgres Operator](https://github.com/CrunchyData/postgres-operator/) for the database
3. We install a dependent Helm Chart with our chart. For example the [PostgreSQL chart by Bitnami](https://artifacthub.io/packages/helm/bitnami/postgresql)
2. We use the [CrunchyData Postgres Operator](https://github.com/CrunchyData/postgres-operator/) (or any other Operator defined PostgreSQL database extension) for the database
3. We install a dependent Helm chart with our chart. For example the [PostgreSQL chart by Bitnami](https://artifacthub.io/packages/helm/bitnami/postgresql)

Also, we want to make sure that our chart could be installed multiple times on each namespace.

The sources for this example can be found on [GitHub](https://github.com/wpernath/book-example/tree/main/better-helm).
Also, we want to make sure that our chart could be installed multiple times on each namespace.

## Making the Chart installable multiple times in the same namespace
The most important step to make sure your chart is installable multiple times in the same namespace is to use generated names for the manifest files. For this there is an object called `Release` with the following parameters:
The most important step to make sure your chart is installable multiple times in the same namespace is to use generated names for all the manifest files. Therefore there is an object called `Release` with the following properties:
- `Name`: The name of the release
- `Namespace`: Where are you going to install the chart
- `Revision`: Revision number of this release (1 on install and each update increments it by one)
Expand Down Expand Up @@ -211,7 +211,7 @@ Of course you now need to make sure, your `person-service` is able to connect to
[...]
```

This will map all values of the PostgresCluster secret to your deployment with a prefix of `DB_`, which are exactly those we need.
This will map all values of the PostgresCluster secret to your deployment with a prefix of `DB_`, which are exactly those you need.

Now your chart is ready to be packaged and can be installed in any namespace of OpenShift:

Expand Down Expand Up @@ -304,3 +304,6 @@ $ helm package -u better-helm/with-subchart
$ helm install ps1 person-service-sub.0.0.11.tgz
```

## Summary
Using Helm charts for your own projects is quite easy, even if you need to make sure certain dependencies are being installed as well. Thanks to the Helm dependency management, you’re able to easily use sub charts with your charts. And thanks to the flexibility of Helm, you’re also even able to either use a (processed) template or to quickly install a Kubernetes Operator before you’re proceeding.

4 changes: 2 additions & 2 deletions gitops/tekton/pipeline.sh
Original file line number Diff line number Diff line change
Expand Up @@ -97,11 +97,11 @@ while (( "$#" )); do
IMAGE_PASSWORD=$2
shift 2
;;
--git-user)
-a|--git-user)
GIT_USER=$2
shift 2
;;
--git-password)
-b|--git-password)
GIT_PASSWORD=$2
shift 2
;;
Expand Down

0 comments on commit de9372f

Please sign in to comment.