Coder Social home page Coder Social logo

chartify's Introduction

chartify

chartify converts anything to a Helm chart and modifies a chart in-place so that you don't need to fork an upstream helm chart only for a few custom requirements.

chartify is a Go library that is primarily used by helmfile to let it convert Kuberntes resource YAMLs or kustomize into a helm chart, and apply various modifications to the resulting chart.

chartify is intended to be run immediately before running helm upgrade --install. For example, instead of forking a helm chart, you should be able to prepend a chartify step into your deployment job in your CD pipeline. chartify isn't intended to create a fork of a chart. The output of chartify is a helm chart that is pre-rendered with all the helm values provided to chartify.

CLI

Beyond it's usage with helmfile, it also provides a basic CLI application that can be run independently.

The simplest usage of the command is:

$ chartify $RELEASE $CHART -o $OUTPUT_DIR

See chartify -h or go run ./cmd/chartify -h for more information.

chartify's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

chartify's Issues

Guidance in how to use this app

Hi!
The description of the app looks promising, but I'm finding hard to know how to use it.

Maybe a little readme with an example will help other people to use this app.

Thanks!

Can I move this repository to the Helmfile org?

Can we move this repository to https://github.com/helmfile so that not only me but also all Helmfile maintainers can co-maintain this project?
We can generally say that the more hands there are, the more the project will be maintained well.
Also, to be clear, note that I'm one of the maintainers of the Helmfile project and Helmfile is the biggest public dependent of this project, as far as I know. I believe those two points would justify the move to the Helmfile org if moving it to somewhere is okay in the first place.

cannot unmarshal !!str `FOO ---...` into chartify.res]

I had a bug report here roboll/helmfile#2086, but I think the problem is from our library

https://github.com/variantdev/chartify/blob/0b1378d379b91a5a1f60132ad80ff8dd3f91f447/patch.go#L210

Description

When transformers is used, and the helm value is cert-folded, as below

  FOO: |
    -----BEGIN CERTIFICATE-----
    FOO
    -----END CERTIFICATE-----

helmfile will raise an exception

err: [processing all.patched.yaml: parsing yaml doc from "    FOO\n    -----END CERTIFICATE--": yaml: unmarshal errors:
  line 1: cannot unmarshal !!str `FOO ---...` into chartify.res]
in ./helmfile.yaml: [processing all.patched.yaml: parsing yaml doc from "    FOO\n    -----END CERTIFICATE--": yaml: unmarshal errors:
  line 1: cannot unmarshal !!str `FOO ---...` into chartify.res]

Test code

$ git clone https://github.com/icy/helmfile-bug.git
$ cd helmfile-bug/one
$  helmfile  --version
helmfile version v0.143.0
$ helmfile template

Logs

The output of helmfile --debug template command is found here https://github.com/icy/helmfile-bug/blob/main/one/debug.log.txt

Generating /tmp/chartify3660731556/test/all.patched.yaml
running kustomize build /tmp/chartify3660731556/test --output /tmp/chartify3660731556/test/all.patched.yaml
Removed /tmp/helmfile1974484501/test-values-6c8cc986b7
err: [processing all.patched.yaml: parsing yaml doc from "    FOO\n    -----END CERTIFICATE--": yaml: unmarshal errors:
  line 1: cannot unmarshal !!str `FOO ---...` into chartify.res]
in ./helmfile.yaml: [processing all.patched.yaml: parsing yaml doc from "    FOO\n    -----END CERTIFICATE--": yaml: unmarshal errors:
  line 1: cannot unmarshal !!str `FOO ---...` into chartify.res]

The command kustomize runs well, but its output was trapping the next step processing all.patched.yaml

Chartify does not work with Chart.yaml v2

Hi,

Chartify only handles requirements.yaml from the chart folder which is a part of v1 Helm Charts. In Helm Charts v2 API dependencies are moved to Chart.yaml file but Chartify does not handle it and temp chart cannot be deployed.

STDERR:
  Error: found in Chart.yaml, but missing in charts/ directory: common

It also should have an option to --skip-deps if everything is packed in the Helm Chart (part of helmfile).

What would be the flow in order to this issue? In the end, kustomize integration with helmfile does not work.

Thanks

Kustomize version 4.5.5 unknown flag --load_restrictor

It appears that the Kustomize version parsing is no longer working as expected. When running this on helmfile, it throws the following error message:

 COMMAND:
  kustomize -o /tmp/chartify146105240/foo/bar/templates/kustomized.yaml build --load_restrictor=none --enable_alpha_plugins /tmp/chartify146105240/foo/bar
  
OUTPUT:
  Error: unknown flag: --load_restrictor]

It looks like Kustomize changed the version string format in for the command version --short which is causing this issue. It may be worthwhile to default to version 4 instead of the current behavior which is to default to version 3 in the case that the version string is not parsed correctly.

helmfile destroy not working

Hi

While using helmfile destroy i observed following error:

Executing command: helmfile -f ./helmfile/helmfile.yaml -n namespace destroy                                          
using requirements.yaml:                                                                                                   
dependencies:                                                                                                              
    - name: postgresql                                                                                                     
      repository: https://company.net/artifactory/helm-virtual                                               
      condition: postgresql.installdep.enable                                                                              
      version: 8.6.2                  
    - name: rabbitmq                                                                                                       
      repository: https://company.net/artifactory/helm-virtual                                               
      condition: rabbitmq.installdep.enable                                                                                
      version: 7.5.6                                                                                                       
    - name: elasticsearch                                                                                                  
      repository: https://company.net/artifactory/helm-virtual                                               
      condition: elasticsearch.installdep.enable                                                                           
      version: 7.6.1                                                                                                       
    - name: minio                                                                                                          
      repository: https://company.net/artifactory/helm-virtual                                               
      condition: minio.installdep.enable                                                                                   
      version: 5.0.33                                                                                                      
                                                                                                                           
Skipping `helm dependency up` on release reportportal's chart due to that you've set SkipDeps=true.                        
This may result in outdated chart dependencies.                                                      
options: {false [/tmp/helmfile734628079/namespace-reportportal-values-8dc575594] [] namespace true}             
running helm template --debug=false --include-crds --output-dir /tmp/chartify563159426/namespace-reportportal-5bf78b5f
f9/helmx.1.rendered -f /tmp/chartify563159426/namespace-reportportal-5bf78b5ff9/values.yaml -f /tmp/helmfile734628079/
namespace-reportportal-values-8dc575594 --namespace namespace reportportal /tmp/chartify563159426/namespace-
reportportal-5bf78b5ff9                                     
Error: found in Chart.yaml, but missing in charts/ directory: postgresql, rabbitmq, elasticsearch, minio                   
                                                                                                                           
in helmfile/helmfile.yaml: [exit status 1                                                                                  
                                                                                                                           
COMMAND:                                                                                                                   
  helm template --debug=false --include-crds --output-dir /tmp/chartify563159426/namespace-reportportal-5bf78b5ff9/hel
mx.1.rendered -f /tmp/chartify563159426/namespace-reportportal-5bf78b5ff9/values.yaml -f /tmp/helmfile734628079/namespace-reportportal-values-8dc575594 --namespace namespace reportportal /tmp/chartify563159426/namespace-report
portal-5bf78b5ff9   

Basically i can install but cant uninstall with destroy since it says that SkipDeps=true.

using image: roboll/helmfile:helm3-v0.138.7

Offering my help again.

Add support for `helm template --api-versions`

chartify already accepts the Validate option to enable passing --validate to helm template which is required to populate .Capabilities.ApiVersions with data from a real cluster.

But for anyone who wants to avoid accessing the real cluster to render the chart templates, it should be still useful to support --api-versions, too.

See also: roboll/helmfile#2031

How to use it?

Hello, everyone!
I tried to use the tool, but I'm a little confused.
In the Makefile, I don't see any build section, and in the readme, there are no instructions about how to build and run it.
How can I run it?

helmfile chart with dependency is not working

When using helmfile to install influxdb with transformer i bumped to following issue:

helmfile:

{{$namespace := "namespace-dev"}}

helmDefaults:
  createNamespace: false
  tillerless: true
  verify: false
  wait: false

releases:
  - name: influxdb
    chart: helm-virtual/influxdb
    namespace: {{$namespace}}
    transformers:
      - transformers/influxdb/route-op.yaml
      - transformers/influxdb/route-content.yaml
    values:
      - values/influxdb-values.yaml.gotmpl

command helmfile -n namespace-dev sync produce error:

FAILED RELEASES:NAMEinfluxdbin .helmfile/helmfile.yaml: failed processing release influxdb: command "/usr/local/bin/helm" exited with non-zero status:PATH:/usr/local/bin/helmARGS:0: helm (4 bytes)1: upgrade (7 bytes)2: --install (9 bytes)3: --reset-values (14 bytes)4: influxdb (8 bytes)5: /tmp/chartify977795748/playground-dev-influxdb-fd4f57f48/influxdb (65 bytes)6: --namespace (11 bytes)7: playground-dev (14 bytes)8: --values (8 bytes)9: /tmp/helmfile493291101/playground-dev-influxdb-values-7f57666f59 (64 bytes)10: --history-max (13 bytes)11: 10 (2 bytes)

Error: found in Chart.yaml, but missing in charts/ directory: common

Looks to me like dependency that is defined in Chart.yaml is not fetched:

dependencies:
- name: common
  repository: https://charts.bitnami.com/bitnami
  tags:
  - bitnami-common
  version: 1.x.x

The issue occurs as soon as i start to use transformers.

helmfile version:

user@host:~> docker run roboll/helmfile:helm3-v0.138.7 helmfile version
helmfile version v0.138.7

Offering my support here but didnt got any response on previous issues nor on PR that i raised to close one issue. Please let me know if i can help with fix.

helmfile cli namespace param

Hi

While using helmfile and setting namespace by cli the namespace after kustomization is set to default.

$ helmfile version
helmfile version v0.138.7

The code works if namespace is defined in helmfile.yaml under release, BUT if i define such command helmfile -n namespace-dev template then the namespace resolved by {{ .Release.Namespace }} is default.

I assume that it has something to do with chartify.go

// Do set namespace if and only if the manifest has no `metadata.namespace` set
		if overrideNamespace == "" && u.Namespace != "" {
			overrideNamespace = u.Namespace
		} 

Is that a bug? And if so can I support here to take it up?

Thanks

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.