New 🌊 wave for @helm

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 Executor
4141
42-## Todo:
43-
44-- buy a domain
45-- make docs
4642
4743 ## πŸ“₯ Installation
4844
@@ -53,497 +49,14 @@
5349 $ mv helmwave /usr/local/bin/
5450 ```
5551
56-### Install with go ![GitHub go.mod Go version](https://img.shields.io/github/go-mod/go-version/zhilyaev/helmwave)
57-
58-```bash
59-$ GO111MODULE=on go get github.com/helmwave/helmwave/cmd/[email protected]
60-```
6152
6253 ### Run as a container ![Docker Pulls](https://img.shields.io/docker/pulls/diamon/helmwave)
6354
6455 ```
65-$ docker run diamon/helmwave:0.9.1
66-$ docker run --entrypoint=ash -it --rm --name helmwave diamon/helmwave:0.9.1
67-```
68-
69-### Build with ![GitHub go.mod Go version](https://img.shields.io/github/go-mod/go-version/zhilyaev/helmwave)
70-
71-```bash
72-$ git clone [email protected]:zhilyaev/helmwave.git
73-$ cd helmwave
74-$ go build ./cmd/helmwave
75-$ mv helmwave /usr/local/bin/
76-```
77-
78-## πŸ”° Getting Started
79-
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-```yaml
85-project: my-project
86-version: 0.9.1
87-
88-
89-repositories:
90- - name: bitnami
91- url: https://charts.bitnami.com/bitnami
92-
93-
94-.options: &options
95- install: true
96- namespace: my-namespace
97-
98-
99-releases:
100- - name: redis-a
101- chart: bitnami/redis
102- options:
103- <<: *options
104-
105- - name: redis-b
106- chart: bitnami/redis
107- options:
108- <<: *options
109-```
110-
111-```shell script
112-$ helmwave deploy
113-```
114-
115-Congratulations!
116-
117-```shell script
118-$ helm list -n my-namespace
119-NAME NAMESPACE REVISION UPDATED STATUS CHART APP VERSION
120-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 AGE
125-redis-a-master-0 1/1 Running 0 64s
126-redis-a-slave-0 1/1 Running 0 31s
127-redis-a-slave-1 1/1 Running 0 62s
128-redis-b-master-0 1/1 Running 0 59s
129-redis-b-slave-0 1/1 Running 0 32s
130-redis-b-slave-1 1/1 Running 0 51s
131-```
132-
133-## Articles
134-
135-### RU
136-
137-- [HelmWave v0.5.0 – GitOps для Ρ‚Π²ΠΎΠ΅Π³ΠΎ Kubernetes](https://habr.com/ru/post/532596/)
138-- HelmWave v0.8.3 – Kubedog рядом
139-
140-## EN
141-
142-- WIP
143-
144-## [Documentation](https://zhilyaev.github.io/helmwave/)
145-
146-### Annotations
147-
148-> inspired by [werf annotations](https://werf.io/documentation/reference/deploy_annotations.html)
149-
150-```yaml
151- template:
152- metadata:
153- {{- with .Values.podAnnotations }}
154- annotations:
155- helmwave.dev/show-service-messages: true
156- {{- 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 the
165- resource having this annotation. Since this mode is enabled by default, the deployment process would wait for all
166- 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-mode
170-
171-Defines how helmwave will handle a resource failure condition which occured after failures threshold has been reached
172-for the resource during deploy process:
173-
174-- `FailWholeDeployProcessImmediately` (default) β€” the entire deploy process will fail with an error if an error occurs
175- for some resource.
176-- `HopeUntilEndOfDeployProcess` β€” when an error occurred for the resource, set this resource into the β€œhope” mode, and
177- continue tracking other resources. If all remained resources are ready or in the β€œhope” mode, transit the resource
178- 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-replica
182-
183-By default, one error per replica is allowed before considering the whole deployment process unsuccessful. This setting
184-defines a threshold of failures after which resource will be considered as failed and helmwave will handle this
185-situation using fail mode.
186-
187-- NUMBER
188-
189-#### helmwave.dev/log-regex
190-
191-Defines a Re2 regex template that applies to all logs of all containers of all Pods owned by a resource with this
192-annotation. helmwave would show only those log lines that fit the specified regex template. By default, helmwave shows
193-all log lines.
194-
195-- RE2_REGEX
196-
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 this
200-annotation. helmwave would show only those log lines that fit the specified regex template. By default, helmwave shows
201-all log lines.
202-
203-- RE2_REGEX
204-
205-#### helmwave.dev/skip-logs
206-
207-Set to "true" to turn off printing logs of all containers of all Pods owned by a resource with this annotation. This
208-annotation is disabled by default.
209-
210-- "true"|"false"
211-
212-#### helmwave.dev/skip-logs-for-containers
213-
214-Turn off printing logs of specified containers of all Pods owned by a resource with this annotation. This annotation is
215-disabled by default.
216-
217-- string with `,` as a separator
218-
219-#### helmwave.dev/show-logs-only-for-containers
220-
221-Turn off printing logs of all containers except specified of all Pods owned by a resource with this annotation. This
222-annotation is disabled by default.
223-
224-- string with `,` as a separator
225-
226-#### helmwave.dev/show-service-messages
227-
228-Set to "true" to enable additional real-time debugging info (including Kubernetes events) for a resource during
229-tracking. By default, helmwave would show these service messages only if the resource has failed the entire deploy
230-process.
231-
232-- "true"|"false"
233-
234-### Examples
235-
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 releases
247-
248-### [🧬 Full `helmwave.yml` config](docs/helmwave.yml.md)
249-
250-All Options
251-
252-## πŸ›  CLI Reference
253-
254-```console (k8s-sbs/stage)
255-NAME:
256- helmwave - composer for helm
257-
258-USAGE:
259- helmwave [global options] command [command options] [arguments...]
260-
261-VERSION:
262- 0.9.1
263-
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.yml
272- planfile, plan πŸ“œ Generate planfile to plandir
273- deploy, apply, sync, release πŸ›₯ Deploy your helmwave!
274- help, h Shows a list of commands or help for one command
275-
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-### yml
294-
295-Transform helmwave.yml.tpl to helmwave.yml
296-
297-Suppose the `helmwave.yml.tpl` looks like:
298-
299-```yaml
300-project: {{ env "CI_PROJECT_NAME" }}
301-version: 0.9.1
302-
303-
304-repositories:
305-- name: your-private-git-repo-hosted-charts
306- url: https://{{ env "GITHUB_TOKEN"}}@raw.githubusercontent.com/foo/bar/master/
307-
308-
309-.options: &options
310- install: true
311- namespace: {{ env "NS" }}
312-
313-
314-releases:
315- - name: redis-a
316- chart: bitnami/redis
317- options:
318- <<: *options
319-```
320-
321-This command will render `helmwave.yml.tpl` to `helmwave.yml`
322-
323-```shell script
324-$ export NS=stage
325-$ export CI_PROJECT_NAME=my-project
326-$ export GITHUB_TOKEN=my-secret-token
327-$ helmwave yml
328-```
329-
330-Once applied, your `helmwave.yml` will look like:
331-
332-```yaml
333-project: my-project
334-version: 0.9.1
335-
336-
337-repositories:
338-- name: your-private-git-repo-hosted-charts
339- url: https://[email protected]/foo/bar/master/
340-
341-
342-.options: &options
343- install: true
344- namespace: stage
345-
346-
347-releases:
348- - name: redis-a
349- chart: bitnami/redis
350- options:
351- <<: *options
56+$ docker run diamon/helmwave
57+$ docker run --entrypoint=ash -it --rm --name helmwave diamon/helmwave
35258 ```
35359
354-### planfile, plan
355-
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- ```yaml
364- project: my-project
365- version: 0.9.1
366- repositories:
367- - name: bitnami
368- url: https://charts.bitnami.com/bitnami
369- username: ""
370- password: ""
371- certfile: ""
372- keyfile: ""
373- cafile: ""
374- insecureskiptlsverify: false
375- force: false
376- releases:
377- - name: redis-a
378- chart: bitnami/redis
379- tags: []
380- values: []
381- options:
382- chartpathoptions:
383- cafile: ""
384- certfile: ""
385- keyfile: ""
386- insecureskiptlsverify: false
387- keyring: ""
388- password: ""
389- repourl: ""
390- username: ""
391- verify: false
392- version: ""
393- install: true
394- devel: false
395- namespace: my-namespace
396- skipcrds: false
397- timeout: 0s
398- wait: false
399- disablehooks: false
400- dryrun: false
401- force: false
402- resetvalues: false
403- reusevalues: false
404- recreate: false
405- maxhistory: 0
406- atomic: false
407- cleanuponfail: false
408- subnotes: false
409- description: ""
410- postrenderer: null
411- disableopenapivalidation: false
412- - name: redis-b
413- chart: bitnami/redis
414- tags: []
415- values: []
416- options:
417- chartpathoptions:
418- cafile: ""
419- certfile: ""
420- keyfile: ""
421- insecureskiptlsverify: false
422- keyring: ""
423- password: ""
424- repourl: ""
425- username: ""
426- verify: false
427- version: ""
428- install: true
429- devel: false
430- namespace: my-namespace
431- skipcrds: false
432- timeout: 0s
433- wait: false
434- disablehooks: false
435- dryrun: false
436- force: false
437- resetvalues: false
438- reusevalues: false
439- recreate: false
440- maxhistory: 0
441- atomic: false
442- cleanuponfail: false
443- subnotes: false
444- description: ""
445- postrenderer: null
446- disableopenapivalidation: false
447- ```
448-
449-</details>
450-
451-## πŸ“„ Templating
452-
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 several
456-advanced functions:
457-
458-- `toYaml` marshals a map into a string
459-- `fromYaml` reads a golang string and generates a map
460-- `readFile` get file as string
461-- `hasKey` get true if field is exists
462-- `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_VALUE
464-- `requiredEnv` The requiredEnv function allows you to declare a particular environment variable as required for
465- template rendering. If the environment variable is unset or empty, the template rendering will fail with an error
466- message.
467-
468-#### readFile
469-
470-<details>
471- <summary>my-releases.yml</summary>
472-
473- ```yaml
474-releases:
475- - name: redis
476- repo: bitnami
477- - name: memcached
478- repo: bitnami
479- ```
480-
481-</details>
482-
483-<details>
484- <summary>helmwave.yml.tpl</summary>
485-
486- ```yaml
487- project: my
488- version: 0.9.1
489-
490-
491- repositories:
492- - name: bitnami
493- url: https://charts.bitnami.com/bitnami
494-
495-
496- .global: &global
497- install: true
498-
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- <<: *global
507- {{- end }}
508- {{- end }}
509- ```
510-
511-</details>
512-
513-```bash
514-$ helmwave yml
515-```
516-
517-<details>
518- <summary>helmwave.yml</summary>
519-
520- ```yaml
521- project: my
522- version: 0.9.1
523-
524- repositories:
525- - name: bitnami
526- url: https://charts.bitnami.com/bitnami
527-
528- .global: &global
529- install: true
530-
531- releases:
532- - name: redis
533- chart: bitnami/redis
534- options:
535- <<: *global
536- - name: memcached
537- chart: bitnami/memcached
538- options:
539- <<: *global
540- ```
541-
542-</details>
543-
544-
545-
546-
547-
60+## πŸ“– [Documentation](https://helmwave.github.io/)
54861
54962