Commit aa5b004a
aa5b004a2493Merged
zhilyaev <[email protected]> Β· 5 years ago Β· 1 file Β· ~1 modified
Description
strim readme
Details
- Commit
- aa5b004a2493
- Parent
- cb5f73b9b9c3
README.mdmodifiedView file
@@ -39,10 +39,6 @@
3939
Sprig | β
|β
4040
Call helm | via Golang Module | Shell Executor4141
42-
## Todo:43-
44-
- buy a domain45-
- make docs4642
4743
## π₯ Installation4844
@@ -53,497 +49,14 @@
5349
$ mv helmwave /usr/local/bin/5450
```5551
56-
### Install with go 57-
58-
```bash59-
$ GO111MODULE=on go get github.com/helmwave/helmwave/cmd/[email protected]60-
```6152
6253
### Run as a container 6354
6455
```65-
$ docker run diamon/helmwave:0.9.166-
$ docker run --entrypoint=ash -it --rm --name helmwave diamon/helmwave:0.9.167-
```68-
69-
### Build with 70-
71-
```bash72-
$ git clone [email protected]:zhilyaev/helmwave.git73-
$ cd helmwave74-
$ go build ./cmd/helmwave75-
$ mv helmwave /usr/local/bin/76-
```77-
78-
## π° Getting Started79-
80-
Let's start with a simple **helmwave** and gradually improve it to fit your use-case!81-
82-
Suppose the `helmwave.yml.tpl` representing the desired state of your helm releases looks like:83-
84-
```yaml85-
project: my-project86-
version: 0.9.187-
88-
89-
repositories:90-
- name: bitnami91-
url: https://charts.bitnami.com/bitnami92-
93-
94-
.options: &options95-
install: true96-
namespace: my-namespace97-
98-
99-
releases:100-
- name: redis-a101-
chart: bitnami/redis102-
options:103-
<<: *options104-
105-
- name: redis-b106-
chart: bitnami/redis107-
options:108-
<<: *options109-
```110-
111-
```shell script112-
$ helmwave deploy113-
```114-
115-
Congratulations!116-
117-
```shell script118-
$ helm list -n my-namespace119-
NAME NAMESPACE REVISION UPDATED STATUS CHART APP VERSION120-
redis-a my-namespace 1 2020-10-31 17:05:35.829766 +0300 MSK deployed redis-11.2.3 6.0.9 121-
redis-b my-namespace 1 2020-10-31 17:05:39.437556 +0300 MSK deployed redis-11.2.3 6.0.9 122-
123-
$ k get po -n my-namespace 124-
NAME READY STATUS RESTARTS AGE125-
redis-a-master-0 1/1 Running 0 64s126-
redis-a-slave-0 1/1 Running 0 31s127-
redis-a-slave-1 1/1 Running 0 62s128-
redis-b-master-0 1/1 Running 0 59s129-
redis-b-slave-0 1/1 Running 0 32s130-
redis-b-slave-1 1/1 Running 0 51s131-
```132-
133-
## Articles134-
135-
### RU136-
137-
- [HelmWave v0.5.0 β GitOps Π΄Π»Ρ ΡΠ²ΠΎΠ΅Π³ΠΎ Kubernetes](https://habr.com/ru/post/532596/)138-
- HelmWave v0.8.3 β Kubedog ΡΡΠ΄ΠΎΠΌ139-
140-
## EN141-
142-
- WIP143-
144-
## [Documentation](https://zhilyaev.github.io/helmwave/)145-
146-
### Annotations147-
148-
> inspired by [werf annotations](https://werf.io/documentation/reference/deploy_annotations.html)149-
150-
```yaml151-
template:152-
metadata:153-
{{- with .Values.podAnnotations }}154-
annotations:155-
helmwave.dev/show-service-messages: true156-
{{- toYaml . | nindent 8 }}157-
{{- end }}158-
```159-
160-
#### `helmwave.dev/track-termination-mode`161-
162-
Defines a condition when helmwave should stop tracking of the resource:163-
164-
- `WaitUntilResourceReady` (default) β the entire deployment process would monitor and wait for the readiness of the165-
resource having this annotation. Since this mode is enabled by default, the deployment process would wait for all166-
resources to be ready.167-
- `NonBlocking` β the resource is tracked only if there are other resources that are not yet ready.168-
169-
#### helmwave.dev/fail-mode170-
171-
Defines how helmwave will handle a resource failure condition which occured after failures threshold has been reached172-
for the resource during deploy process:173-
174-
- `FailWholeDeployProcessImmediately` (default) β the entire deploy process will fail with an error if an error occurs175-
for some resource.176-
- `HopeUntilEndOfDeployProcess` β when an error occurred for the resource, set this resource into the βhopeβ mode, and177-
continue tracking other resources. If all remained resources are ready or in the βhopeβ mode, transit the resource178-
back to βnormalβ and fail the whole deploy process if an error for this resource occurs once again.179-
- `IgnoreAndContinueDeployProcess` β resource errors do not affect the deployment process.180-
181-
#### helmwave.dev/failures-allowed-per-replica182-
183-
By default, one error per replica is allowed before considering the whole deployment process unsuccessful. This setting184-
defines a threshold of failures after which resource will be considered as failed and helmwave will handle this185-
situation using fail mode.186-
187-
- NUMBER188-
189-
#### helmwave.dev/log-regex190-
191-
Defines a Re2 regex template that applies to all logs of all containers of all Pods owned by a resource with this192-
annotation. helmwave would show only those log lines that fit the specified regex template. By default, helmwave shows193-
all log lines.194-
195-
- RE2_REGEX196-
197-
#### helmwave.dev/log-regex-for-{container}198-
199-
Defines a Re2 regex template that applies to all logs of specified container of all Pods owned by a resource with this200-
annotation. helmwave would show only those log lines that fit the specified regex template. By default, helmwave shows201-
all log lines.202-
203-
- RE2_REGEX204-
205-
#### helmwave.dev/skip-logs206-
207-
Set to "true" to turn off printing logs of all containers of all Pods owned by a resource with this annotation. This208-
annotation is disabled by default.209-
210-
- "true"|"false"211-
212-
#### helmwave.dev/skip-logs-for-containers213-
214-
Turn off printing logs of specified containers of all Pods owned by a resource with this annotation. This annotation is215-
disabled by default.216-
217-
- string with `,` as a separator218-
219-
#### helmwave.dev/show-logs-only-for-containers220-
221-
Turn off printing logs of all containers except specified of all Pods owned by a resource with this annotation. This222-
annotation is disabled by default.223-
224-
- string with `,` as a separator225-
226-
#### helmwave.dev/show-service-messages227-
228-
Set to "true" to enable additional real-time debugging info (including Kubernetes events) for a resource during229-
tracking. By default, helmwave would show these service messages only if the resource has failed the entire deploy230-
process.231-
232-
- "true"|"false"233-
234-
### Examples235-
236-
- [How to pass `image.tag` to release?](docs/examples/CI_COMMIT_TAG/README.md)237-
- [How to pass `podAnnotations.gitCommit` to release?](docs/examples/CI_COMMIT_SHORT_SHA/README.md)238-
- [How to use environments for your release?](docs/examples/CI_ENVIRONMENT_NAME/README.md)239-
240-
### [π° Store](docs/store.md)241-
242-
It allows pass you custom values to render release.243-
244-
### [π° Tags](docs/tags.md)245-
246-
Use tags for choose specific releases247-
248-
### [𧬠Full `helmwave.yml` config](docs/helmwave.yml.md)249-
250-
All Options251-
252-
## π CLI Reference253-
254-
```console (k8s-sbs/stage)255-
NAME:256-
helmwave - composer for helm257-
258-
USAGE:259-
helmwave [global options] command [command options] [arguments...]260-
261-
VERSION:262-
0.9.1263-
264-
DESCRIPTION:265-
π This tool helps you compose your helm releases!266-
267-
AUTHOR:268-
π Dmitriy Zhilyaev <[email protected]>269-
270-
COMMANDS:271-
yml π Render helmwave.yml.tpl -> helmwave.yml272-
planfile, plan π Generate planfile to plandir273-
deploy, apply, sync, release π₯ Deploy your helmwave!274-
help, h Shows a list of commands or help for one command275-
276-
GLOBAL OPTIONS:277-
--tpl value Main tpl file (default: "helmwave.yml.tpl") [$HELMWAVE_TPL_FILE]278-
--file value, -f value Main yml file (default: "helmwave.yml") [$HELMWAVE_FILE, $HELMWAVE_YAML_FILE, $HELMWAVE_YML_FILE]279-
--plan-dir value It keeps your state via planfile (default: ".helmwave/") [$HELMWAVE_PLAN_DIR]280-
--tags value, -t value It allows you choose releases for sync. Example: -t tag1 -t tag3,tag4 [$HELMWAVE_TAGS]281-
--parallel helm install It allows you call helm install in parallel mode (default: true) [$HELMWAVE_PARALLEL]282-
--log-format value You can set: [ text | json | pad | emoji ] (default: "emoji") [$HELMWAVE_LOG_FORMAT]283-
--log-level value You can set: [ debug | info | warn | fatal | panic | trace ] (default: "info") [$HELMWAVE_LOG_LEVEL, $HELMWAVE_LOG_LVL]284-
--log-color Force color (default: true) [$HELMWAVE_LOG_COLOR]285-
--kubedog Enable/Disable kubedog (default: true) [$HELMWAVE_KUBEDOG, $HELMWAVE_KUBEDOG_ENABLED]286-
--kubedog-status-interval value Interval of kubedog status messages (default: 5s) [$HELMWAVE_KUBEDOG_STATUS_INTERVAL]287-
--kubedog-start-delay value Delay kubedog start (default: 1s) [$HELMWAVE_KUBEDOG_START_DELAY]288-
--kubedog-timeout value Timout of kubedog multitrackers (default: 5m0s) [$HELMWAVE_KUBEDOG_TIMEOUT]289-
--help, -h show help (default: false)290-
--version, -v print the version (default: false)291-
```292-
293-
### yml294-
295-
Transform helmwave.yml.tpl to helmwave.yml296-
297-
Suppose the `helmwave.yml.tpl` looks like:298-
299-
```yaml300-
project: {{ env "CI_PROJECT_NAME" }}301-
version: 0.9.1302-
303-
304-
repositories:305-
- name: your-private-git-repo-hosted-charts306-
url: https://{{ env "GITHUB_TOKEN"}}@raw.githubusercontent.com/foo/bar/master/307-
308-
309-
.options: &options310-
install: true311-
namespace: {{ env "NS" }}312-
313-
314-
releases:315-
- name: redis-a316-
chart: bitnami/redis317-
options:318-
<<: *options319-
```320-
321-
This command will render `helmwave.yml.tpl` to `helmwave.yml`322-
323-
```shell script324-
$ export NS=stage325-
$ export CI_PROJECT_NAME=my-project326-
$ export GITHUB_TOKEN=my-secret-token327-
$ helmwave yml328-
```329-
330-
Once applied, your `helmwave.yml` will look like:331-
332-
```yaml333-
project: my-project334-
version: 0.9.1335-
336-
337-
repositories:338-
- name: your-private-git-repo-hosted-charts339-
url: https://[email protected]/foo/bar/master/340-
341-
342-
.options: &options343-
install: true344-
namespace: stage345-
346-
347-
releases:348-
- name: redis-a349-
chart: bitnami/redis350-
options:351-
<<: *options56+
$ docker run diamon/helmwave57+
$ docker run --entrypoint=ash -it --rm --name helmwave diamon/helmwave35258
```35359
354-
### planfile, plan355-
356-
This command will generate helmwave.plan.357-
358-
`helmwave.plan` is an object save to yaml.359-
360-
<details>361-
<summary>helmwave.plan looks like</summary>362-
363-
```yaml364-
project: my-project365-
version: 0.9.1366-
repositories:367-
- name: bitnami368-
url: https://charts.bitnami.com/bitnami369-
username: ""370-
password: ""371-
certfile: ""372-
keyfile: ""373-
cafile: ""374-
insecureskiptlsverify: false375-
force: false376-
releases:377-
- name: redis-a378-
chart: bitnami/redis379-
tags: []380-
values: []381-
options:382-
chartpathoptions:383-
cafile: ""384-
certfile: ""385-
keyfile: ""386-
insecureskiptlsverify: false387-
keyring: ""388-
password: ""389-
repourl: ""390-
username: ""391-
verify: false392-
version: ""393-
install: true394-
devel: false395-
namespace: my-namespace396-
skipcrds: false397-
timeout: 0s398-
wait: false399-
disablehooks: false400-
dryrun: false401-
force: false402-
resetvalues: false403-
reusevalues: false404-
recreate: false405-
maxhistory: 0406-
atomic: false407-
cleanuponfail: false408-
subnotes: false409-
description: ""410-
postrenderer: null411-
disableopenapivalidation: false412-
- name: redis-b413-
chart: bitnami/redis414-
tags: []415-
values: []416-
options:417-
chartpathoptions:418-
cafile: ""419-
certfile: ""420-
keyfile: ""421-
insecureskiptlsverify: false422-
keyring: ""423-
password: ""424-
repourl: ""425-
username: ""426-
verify: false427-
version: ""428-
install: true429-
devel: false430-
namespace: my-namespace431-
skipcrds: false432-
timeout: 0s433-
wait: false434-
disablehooks: false435-
dryrun: false436-
force: false437-
resetvalues: false438-
reusevalues: false439-
recreate: false440-
maxhistory: 0441-
atomic: false442-
cleanuponfail: false443-
subnotes: false444-
description: ""445-
postrenderer: null446-
disableopenapivalidation: false447-
```448-
449-
</details>450-
451-
## π Templating452-
453-
HelmWave uses [Go templates](https://godoc.org/text/template) for templating.454-
455-
Helmwave supports all built-in functions, [Sprig library](https://godoc.org/github.com/Masterminds/sprig), and several456-
advanced functions:457-
458-
- `toYaml` marshals a map into a string459-
- `fromYaml` reads a golang string and generates a map460-
- `readFile` get file as string461-
- `hasKey` get true if field is exists462-
- `get` (Sprig's original `get` is available as `sprigGet`)463-
- `setValueAtPath` PATH NEW_VALUE traverses a golang map, replaces the value at the PATH with NEW_VALUE464-
- `requiredEnv` The requiredEnv function allows you to declare a particular environment variable as required for465-
template rendering. If the environment variable is unset or empty, the template rendering will fail with an error466-
message.467-
468-
#### readFile469-
470-
<details>471-
<summary>my-releases.yml</summary>472-
473-
```yaml474-
releases:475-
- name: redis476-
repo: bitnami477-
- name: memcached478-
repo: bitnami479-
```480-
481-
</details>482-
483-
<details>484-
<summary>helmwave.yml.tpl</summary>485-
486-
```yaml487-
project: my488-
version: 0.9.1489-
490-
491-
repositories:492-
- name: bitnami493-
url: https://charts.bitnami.com/bitnami494-
495-
496-
.global: &global497-
install: true498-
499-
500-
releases:501-
{{- with readFile "my-releases.yml" | fromYaml | get "releases" }}502-
{{- range $v := . }}503-
- name: {{ $v | get "name" }}504-
chart: {{ $v | get "repo" }}/{{ $v | get "name" }}505-
options:506-
<<: *global507-
{{- end }}508-
{{- end }}509-
``` 510-
511-
</details>512-
513-
```bash514-
$ helmwave yml515-
```516-
517-
<details>518-
<summary>helmwave.yml</summary>519-
520-
```yaml521-
project: my522-
version: 0.9.1523-
524-
repositories:525-
- name: bitnami526-
url: https://charts.bitnami.com/bitnami527-
528-
.global: &global529-
install: true530-
531-
releases:532-
- name: redis533-
chart: bitnami/redis534-
options:535-
<<: *global536-
- name: memcached537-
chart: bitnami/memcached538-
options:539-
<<: *global540-
``` 541-
542-
</details>543-
544-
545-
546-
547-
60+
## π [Documentation](https://helmwave.github.io/)54861
54962