Skip to content

Commit 2dac325

Browse files
authored
Merge pull request #5 from gruntwork-io/yori-chart-development-proposal
RDD: Some initial guidelines on chart development
2 parents a728cfe + ab964b7 commit 2dac325

File tree

2 files changed

+59
-1
lines changed

2 files changed

+59
-1
lines changed

CONTRIBUTING.md

Lines changed: 25 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,19 +10,22 @@ https://help.github.com/articles/about-pull-requests/) for contributions, subjec
1010
1. [Create a pull request](#create-a-pull-request)
1111
1. [Merge and release](#merge-and-release)
1212

13+
1314
## File a GitHub issue
1415

1516
Before starting any work, we recommend filing a GitHub issue in this repo. This is your chance to ask questions and
1617
get feedback from the maintainers and the community before you sink a lot of time into writing (possibly the wrong)
1718
code. If there is anything you're unsure about, just ask!
1819

20+
1921
## Update the documentation
2022

2123
We recommend updating the documentation *before* updating any code (see [Readme Driven
2224
Development](http://tom.preston-werner.com/2010/08/23/readme-driven-development.html)). This ensures the documentation
2325
stays up to date and allows you to think through the problem at a high level before you get lost in the weeds of
2426
coding.
2527

28+
2629
## Update the tests
2730

2831
We also recommend updating the automated tests *before* updating any code (see [Test Driven
@@ -33,6 +36,7 @@ functionality you're adding in your contribution. Check out the
3336
[tests](https://github.com/gruntwork-io/helm-kubernetes-services/tree/master/test) folder for instructions on running
3437
the automated tests.
3538

39+
3640
## Update the code
3741

3842
At this point, make your code changes and use your new test case to verify that everything is working. As you work,
@@ -59,6 +63,25 @@ Bear in mind that the Helm charts in this Module are used by real companies to r
5963
production, and certain types of changes could cause downtime. If downtime cannot be avoided, please make sure to call
6064
that out when you submit a pull request.
6165

66+
### Code style
67+
68+
We follow [the official Chart best practices](https://docs.helm.sh/chart_best_practices/) documented by the community.
69+
Please read through the guidelines if you have not already.
70+
71+
Additionally, Gruntwork has a few extra guidelines not stated in the best practices guide:
72+
73+
- Chart `values.yaml` should separate required inputs from optional inputs. Required inputs should be documented as
74+
comments.
75+
- Provide example required inputs in a separate `linter_values.yaml` file so that `helm lint` can be used to lint the
76+
charts.
77+
- Any input value that is rendered directly in the yaml templates (using `toYaml`) should be explicitly called out in
78+
the `values.yaml` file.
79+
- Any input value that is a map should explicitly call out the expected fields. Additionally, the fields should be
80+
labeled by type and whether or not the value is required.
81+
- Any required input that is a map, or optional input that is a map with an empty default, should have an example in the
82+
comments.
83+
- Every chart should have both helm tests and terratests. The helm tests test if the chart came up successfully in an
84+
install, while the terratest is used for integration testing of the chart before releasing the chart.
6285

6386
### Formatting and pre-commit hooks
6487

@@ -70,7 +93,7 @@ using pre-commit hooks managed using [pre-commit](http://pre-commit.com/):
7093
1. Make sure you have the helm client installed. See [the official docs](https://docs.helm.sh/using_helm/#install-helm)
7194
for instructions.
7295

73-
That's it! Now just write your code, and every time you commit, `helm lint` will be run on the charts that you modify.
96+
Now write your code, and every time you commit, `helm lint` will be run on the charts that you modify.
7497

7598

7699
## Create a pull request
@@ -85,6 +108,7 @@ to include the following:
85108
test output so we can verify that everything is working.
86109
1. Any notes on backwards incompatibility or downtime.
87110

111+
88112
## Merge and release
89113

90114
The maintainers for this repo will review your code and provide feedback. If everything looks good, they will merge the

README.md

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,39 @@ The following charts are available in this package:
4545
-->
4646

4747

48+
## How do you install the charts in this Package?
49+
50+
The charts in this Package are distributed in the Gruntwork Helm Repo. You can access these charts by adding the
51+
Gruntwork Helm Repo to your client:
52+
53+
```bash
54+
$ helm repo add gruntwork https://helmcharts.gruntwork.io
55+
```
56+
57+
Then, you can access any of the charts under the `gruntwork` name. For example, you can find all the Gruntwork charts by
58+
searching for `gruntwork`:
59+
60+
```bash
61+
$ helm search gruntwork
62+
```
63+
64+
In general, each of the charts document the required and optional input values in the corresponding `values.yaml` file.
65+
You can access the `values.yaml` of a Chart either by inspecting this repository, or using the `helm inspect` command.
66+
For example, to see the values of the `k8s-service` chart, you can run:
67+
68+
```bash
69+
$ helm inspect values gruntwork/k8s-service
70+
```
71+
72+
Once you know what values the chart requires, you can install the chart by defining your own `values.yaml` file with the
73+
required values defined. Then, you can install the chart to your Kubernetes cluster using `helm install`:
74+
75+
```bash
76+
$ helm install -f values.yaml gruntwork/k8s-service
77+
```
78+
79+
See the `helm install` help text for more configuration options.
80+
4881

4982
## What is Kubernetes?
5083

@@ -80,6 +113,7 @@ release, the helm client essentially packages up the values and charts as a rele
80113
Tiller will then generate Kubernetes YAML files from the packaged release, and then apply the generated Kubernetes YAML
81114
file from the charts on the cluster.
82115

116+
83117
## How do you run applications on Kubernetes?
84118

85119
There are three different ways you can schedule your application on a Kubernetes cluster. In all three, your application

0 commit comments

Comments
 (0)