Git Product home page Git Product logo

helm-push's Introduction

helm cm-push plugin

GitHub Actions status

Helm plugin to push chart package to ChartMuseum

Install

Based on the version in plugin.yaml, release binary will be downloaded from GitHub:

$ helm plugin install https://github.com/chartmuseum/helm-push
Downloading and installing helm-push v0.10.1 ...
https://github.com/chartmuseum/helm-push/releases/download/v0.10.1/helm-push_0.10.1_darwin_amd64.tar.gz
Installed plugin: cm-push

Usage

Start by adding a ChartMuseum-backed repo via Helm CLI (if not already added)

$ helm repo add chartmuseum http://localhost:8080

For all available plugin options, please run

$ helm cm-push --help

Pushing a directory

Point to a directory containing a valid Chart.yaml and the chart will be packaged and uploaded:

$ cat mychart/Chart.yaml
name: mychart
version: 0.3.2
$ helm cm-push mychart/ chartmuseum
Pushing mychart-0.3.2.tgz to chartmuseum...
Done.

Pushing with a custom version

The --version flag can be provided, which will push the package with a custom version:

$ helm cm-push mychart/ --version="1.2.3" chartmuseum
Pushing mychart-1.2.3.tgz to chartmuseum...
Done.

If you want to enable something like --version="9.9.9-dev1", which you intend to push regularly, you will need to run your ChartMuseum server with ALLOW_OVERWRITE=true.

Push .tgz package

This workflow does not require the use of helm package, but pushing .tgzs is still supported:

$ helm cm-push mychart-0.3.2.tgz chartmuseum
Pushing mychart-0.3.2.tgz to chartmuseum...
Done.

Force push

If your ChartMuseum install is configured with ALLOW_OVERWRITE=true, chart versions will be automatically overwritten upon re-upload.

Otherwise, unless your install is configured with DISABLE_FORCE_OVERWRITE=true (ChartMuseum > v0.7.1), you can use the --force/-f option to to force an upload:

$ helm cm-push --force mychart-0.3.2.tgz chartmuseum
Pushing mychart-0.3.2.tgz to chartmuseum...
Done.

Pushing directly to URL

If the second argument provided resembles a URL, you are not required to add the repo prior to push:

$ helm cm-push mychart-0.3.2.tgz http://localhost:8080
Pushing mychart-0.3.2.tgz to http://localhost:8080...
Done.

Context Path

If you are running ChartMuseum behind a proxy that adds a route prefix, for example:

https://my.chart.repo.com/helm/v1/index.yaml -> http://chartmuseum-svc/index.yaml

You can use the --context-path= option or HELM_REPO_CONTEXT_PATH env var in order for the plugin to construct the upload URL correctly:

helm repo add chartmuseum https://my.chart.repo.com/helm/v1
helm cm-push --context-path=/helm/v1 mychart-0.3.2.tgz chartmuseum

Alternatively, you can add serverInfo.contextPath to your index.yaml:

apiVersion: v1
entries:{}
generated: "2018-08-09T11:08:21-05:00"
serverInfo:
  contextPath: /helm/v1

In ChartMuseum server (>0.7.1) this will automatically be added to index.yaml if the --context-path option is provided.

Authentication

Basic Auth

If you have added your repo with the --username/--password flags (Helm 2.9+), or have added your repo with the basic auth username/password in the URL (e.g. https://myuser:[email protected]), no further setup is required.

The plugin will use the auth info located in ~/.helm/repository/repositories.yaml (for Helm 2) or ~/.config/helm/repositories.yaml (for Helm 3) in order to authenticate.

If you are running ChartMuseum with AUTH_ANONYMOUS_GET=true, and have added your repo without authentication, the plugin recognizes the following environment variables for basic auth on push operations:

$ export HELM_REPO_USERNAME="myuser"
$ export HELM_REPO_PASSWORD="mypass"

With this setup, you can enable people to use your repo for installing charts etc. without allowing them to upload to it.

Token

ChartMuseum token-auth is currently in progress. Please see auth-server-example for more info.

Although ChartMuseum server does not define or accept a token format (yet), if you are running it behind a proxy that accepts access tokens, you can provide the following env var:

$ export HELM_REPO_ACCESS_TOKEN="<token>"

This will result in all basic auth options above being ignored, and the plugin will send the token in the header:

Authorization: Bearer <token>

If you require a custom header to be used for passing the token, you can the following env var:

$ export HELM_REPO_AUTH_HEADER="<myheader>"

This will then be used in place of Authorization: Bearer:

<myheader>: <token>

Token config file (~/.cfconfig)

For users of Managed Helm Repositories (Codefresh), the plugin is able to auto-detect your API key from ~/.cfconfig. This file is managed by Codefresh CLI.

If detected, this API key will be used for token-based auth, overriding basic auth options described above.

The format of this file is the following:

contexts:
  default:
    name: default
    token: <token>
current-context: default

TLS Client Cert Auth

ChartMuseum server does not yet have options to setup TLS client cert authentication (please see chartmuseum#79).

If you are running ChartMuseum behind a frontend that does, the following options are available:

--ca-file string    Verify certificates of HTTPS-enabled servers using this CA bundle [$HELM_REPO_CA_FILE]
--cert-file string  Identify HTTPS client using this SSL certificate file [$HELM_REPO_CERT_FILE]
--key-file string   Identify HTTPS client using this SSL key file [$HELM_REPO_KEY_FILE]
--insecure          Connect to server with an insecure way by skipping certificate verification [$HELM_REPO_INSECURE]

Custom Downloader

This plugin also defines the cm:// protocol that you may specify when adding a repo:

$ helm repo add chartmuseum cm://my.chart.repo.com

The only real difference with this vs. simply using http/https, is that the environment variables above are recognized by the plugin and used to set the Authorization header appropriately. As in, if you do not add your repo in this way, you are unable to use token-based auth for GET requests (downloading index.yaml, chart .tgzs, etc).

By default, cm:// translates to https://. If you must use http://, you can set the following env var:

$ export HELM_REPO_USE_HTTP="true"

helm-push's People

Contributors

brcorbin avatar bryanstenson-okta avatar cbuto avatar czhujer avatar dellkeji avatar dependabot[bot] avatar emanuelflp avatar i5okie avatar jdolitsky avatar karuppiah7890 avatar leventyalcin avatar liuming-dev avatar mayank-verma048 avatar nerdeveloper avatar prabhu43 avatar r734 avatar rimusz avatar roberte3 avatar sathieu avatar scbizu avatar shizhmsft avatar stensonb avatar steven-zou avatar tariq1890 avatar thwhk avatar vadasambar avatar volker-raschek avatar zerosnake0 avatar

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  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  avatar  avatar  avatar  avatar  avatar  avatar  avatar

helm-push's Issues

helm push not putting quotes around scientific notation like numbers

With helm 2.16.1, helm-push 0.7.1 and chartmuseum 0.10.0, try the below

$ helm create old-chart
$ # change appVersion in Chart.yaml to "722225e2"
$ vi old-chart/Chart.yaml
$ # now push the chart to chartmuseum repo called "local"
$ helm push old-chart local
$ # check the index.yaml
$ curl http://localhost:8080/index.yaml
apiVersion: v1
entries:
old-chart:

  • apiVersion: v1
    appVersion: "7.22225e+07"
    created: "2019-12-04T22:16:19.562137212+05:30"
    description: A Helm chart for Kubernetes
    digest: 0b891b622bd0ab3e8e22302dab504481d10887a011bb92f38830097c44b3ccd3
    name: old-chart
    urls:
    • charts/old-chart-0.1.0.tgz
      version: 0.1.0
      generated: "2019-12-04T22:16:22+05:30"
      serverInfo: {}

Now if you see the appVersion, you notice that it's in some scientific notation form. This does not happen when directly curl is used to push charts this way -

$ helm package old-chart
$ # check the tar ball Chart.yaml, it will still be "722225e2" 
$ vi old-chart-0.1.0.tgz
$ curl --data-binary "@old-chart-0.1.0.tgz" http://localhost:8080/api/charts

The issue is in helm-push. When push is done, the chart contents are read (parsed), and then later pushed to chartmuseum. While parsing and then serializing, it removes the quotes (due to a yaml package bug) and then it pushes to the chartmusem, where the number is made into a string and put in double quotes, but it's converted a bit, compared to the original string

Updating yaml package to latest version solves the issue

Push force

Currently if the chart already exists, the push return a 409 error code:

/ # helm push yolo chartmuseum
Pushing yolo-0.1.0.tgz to chartmuseum...
Error: 409: yolo-0.1.0.tgz already exists
Error: plugin "push" exited with error

It would be nice to have a -f, --force option to overwrite the existing chart.

scripts/install_plugin.sh: 14: [: Linux: unexpected operator

Hi,

Trying to deploy on Centos 7 gives :

helm plugin install https://github.com/chartmuseum/helm-push

Downloading and installing helm-push v0.4.0 ...
scripts/install_plugin.sh: 14: [: Linux: unexpected operator
scripts/install_plugin.sh: 16: [: Linux: unexpected operator
https://github.com/chartmuseum/helm-push/releases/download/v0.4.0/helm-push_0.4.0_windows_amd64.tar.gz

Checked the scripts/install_plugin.sh script and saw that you are using == to compare strings.
Using = instead of == fixes the issue.

Based on my experience, == will not work on every shell, and = should be the way to go.

Keep up the good work!

helm plugin install gitrepo not working anymore with Kubernetes v1.16

Kubernetes: Microk8s v1.16

When installing helm-push plugin in kubernetes v1.16 getting the error:

$ helm plugin install https://github.com/chartmuseum/helm-push
Error: Unable to get repository: Cloning into '/home/pauloneves/.helm/cache/plugins/https-github.com-chartmuseum-helm-push'...
/usr/lib/git-core/git-remote-https: relocation error: /usr/lib/git-core/git-remote-https: symbol curl_global_sslset version CURL_GNUTLS_3 not defined in file libcurl-gnutls.so.4 with link time reference
: exit status 128

workaround:

$ git clone https://github.com/chartmuseum/helm-push https-github.com-chartmuseum-helm-push
$ helm plugin install https-github.com-chartmuseum-helm-push

Multiple API Sets Support

ChartMuseum is a well-known open-source Helm Chart Repository with support for multiple cloud storage backends. It not only is compatible with the helm repo command set at the API level but also provides an API set for uploading new chart packages and fetching existing ones. By leveraging that uploading API, the helm-push plugin provides an easy and quick way to push chart packages to a ChartMuseum server.

As time goes by, more and more cloud service provider like Microsoft Azure, Amazon Web Service, Google Cloud, and etc., may kick in and have their own Helm Chart Repository. Since there is no standard API for uploading a chart package to the cloud, cloud service providers may have their own API sets for pushing and pulling helm chart packages with/without provenance files. It would be nice and cool for helm-push plugin to support those API sets in addition to the ChartMuseum API. With multiple API sets support, open-source software users/developers will gain smoother and more convenient experiences.

In this issue, we propose two implementation directions:

  1. Use different API sets by analyzing the host name of the repository URL. If it belongs to a known cloud service provider, the helm-push plugin uses the API set specific to that cloud service provider for uploading the chart packages. Otherwise, the plugin uses the ChartMuseum API set as the default option.
  2. Have a config file or a command line flag to use a specific API set. For instance:
$ helm push --provider=microsoft mychart-0.3.2.tgz azure
Pushing mychart-0.3.2.tgz to azure...
Done.

Personally, the proposal 1 is preferable as it is transparent to the users.

.cfconfig token loading not working in container

I'm working on a Docker image that has helm, helm-push, and codefresh's CLI installed. I cannot seem to get the automatic .cfconfig token loading to work when I volume mount the host's .cfconfig file into the container. I repeatedly get 401 unauthorized errors. Yet, if I set HELM_REPO_ACCESS_TOKEN to the token in the file, things work fine. On the host machine (with the same versions of helm and helm-push installed), everything works fine.

In container, the user is root and the file is mounted at /root/.cfconfig.

I went through a rather long and convoluted troubleshooting process, including copying the .cfconfig loading code from this codebase into a tiny go POC and running it in the container. It worked. I tried it with go 1.10, the version of go listed in helm-push's CI files. Still worked.

Eventually, I just cloned helm-push locally and used the Makefile build-linux task to recompile the binary. I am using go 1.12.4. I copied it into my Docker container, and everything started working properly, loading the credentials from the volume-mounted .cfconfig file.

My host machine is Linux. I seem to recall some historical issues in go finding a user's home directory in certain scenarios. I'm not sure which version of go and on what OS the release helmpush binary was compiled with, but I'm wondering if it was an older version of go (I tried this and had no luck), or if it was compiled on a non-Linux OS and somehow during the cross-compilation process, homedir-related code was broken? I have done some googling and changelog reading and found this old issue. The way that the homedir finding code returns immediately on ANY error (even if the error was user: Current not implemented on linux/amd64) makes me think this is the problem. But that doesn't explain why this works fine on my host system, which is also Linux, just not in a container.

I don't have access to an OSX machine right now to test any of these theories, but I wanted to file an issue to see if I'm missing something obvious or to help other people with the same problem.

Update test TLS certs

Unable to run tests since the TLS certs appear to be expired:

main_test.go:224: unexpecting error uploading tarball: Post https://127.0.0.1:44907/x/y/z/api/charts: x509: certificate has expired or is not yet valid

helm push get some error

helm verison

helm version
version.BuildInfo{Version:"v3.0.1", GitCommit:"7c22ef9ce89e0ebeb7125ba2ebf7d421f3e82ffa", GitTreeState:"clean", GoVersion:"go1.13.4"}

my local repo.

$ helm repo list
NAME  	URL                                              
stable	https://kubernetes-charts.storage.googleapis.com/
local 	https://harbor.youpenglai.cn/chartrepo/junhsue

when get push

helm push goapp-0.1.0.tgz local
Error: Couldn't load repositories file (/root/.helm/repository/repositories.yaml).
You might need to run `helm init` (or `helm init --client-only` if tiller is already installed)
Error: plugin "push" exited with error

help ~~ ths

helm3 push giving error about not being able to find repositories.yaml

I currently installed helm3 along with the helm push plugin by running helm plugin install https://github.com/chartmuseum/helm-push

when i tried to do a helm push i get the following error:

Error: Couldn't load repositories file (/root/.local/share/helm/repository/repositories.yaml).

This path doesn't exist with helm3.

If i have helm2 install and i do the upgrade to helm3 i still have to do the following manual steps then helm3 push works fine:

mkdir /root/.local/share/helm/repository/
copy contents from /root/.helm/repository/ to /root/.local/share/helm/repository/

Has anyone else seen this issue and been able to solve it by just having helm3 (and not needing to do the helm2 to helm3 upgrade and doing manual steps)?

make helm-push to gather auth token automatically

Hi @jdolitsky , I've been watching this great project for a while. 😄

I wonder why we are not implementing this access token in the docker way.

Like you mentioned in the using-with-helm-push , user need to gain an access token using curl before using helm-push. It might be painful to some users.

So I implemented this GetAuthTokenFromResponse, tries to get an access token from the auth server returned by chartmuseum. How do you like it? Can I pr this feature?

Great thanks

Installation fails on ubuntu 16.04

Hello Chartmuseum folks,

I'm having trouble installing this plugin. It fails at line zero of the install script:

➜  helm-push git:(master) helm plugin install .
/bin/sh: 0: Illegal option -
Error: plugin install hook for "push" exited with error

I've tried changing the shebang to stuff I normally use (#!/usr/bin/env bash) but no luck. I've also tried to remove the -e flag. When I do that I get the following:

➜  helm-push git:(master) ✗ helm plugin install .
sh: 1: scripts/install_plugin.sh: not found
Error: plugin install hook for "push" exited with error
➜  helm-push git:(master) ✗ file scripts/install_plugin.sh
scripts/install_plugin.sh: POSIX shell script, ASCII text executable, with CRLF line terminators

So I'm confused about this. Help?

Why no new releases?

It's been quite some time. I do see that there's just one feature from last release - e6e7c32 - Adding flag to update dependencies before package. Do you think it's worth it to release?

There will also be another update, for this issue - #40 (PR - #41)

May be if we see some more features / bug fixes, we can wait for them, and then release sometime? @jdolitsky

Unable to install inside a container

Trying to automate our build process by using Helm inside a container and I can't seem to get the helm-push plugin to install. Not sure if this is a problem with my configuration, with the container image or with helm-push.

$ docker run -it --name helm --rm --entrypoint /bin/sh linkyard/docker-helm:2.9.1
/ # helm init --client-only
Creating /root/.helm
Creating /root/.helm/repository
Creating /root/.helm/repository/cache
Creating /root/.helm/repository/local
Creating /root/.helm/plugins
Creating /root/.helm/starters
Creating /root/.helm/cache/archive
Creating /root/.helm/repository/repositories.yaml
Adding stable repo with URL: https://kubernetes-charts.storage.googleapis.com
Adding local repo with URL: http://127.0.0.1:8879/charts
$HELM_HOME has been configured at /root/.helm.
Not installing Tiller due to 'client-only' flag having been set
Happy Helming!
/ # helm plugin install --debug https://github.com/chartmuseum/helm-push
[debug] cloning https://github.com/chartmuseum/helm-push to /root/.helm/cache/plugins/https-github.com-chartmuseum-helm-push
[debug] symlinking /root/.helm/cache/plugins/https-github.com-chartmuseum-helm-push to /root/.helm/plugins/helm-push
[debug] loading plugin from /root/.helm/plugins/helm-push
[debug] running install hook: &{/bin/sh [sh -c cd $HELM_PLUGIN_DIR; scripts/install_plugin.sh] []  <nil> <nil> <nil> [] %!s(*syscall.SysProcAttr=<nil>) %!s(*os.Process=<nil>) <nil> <nil> <nil> %!s(bool=false) [] [] [] [] %!s(chan error=<nil>) %!s(chan struct {}=<nil>)}
sh: scripts/install_plugin.sh: not found
Error: plugin install hook for "push" exited with error

I also tried to export HELM_PLUGIN_DIR="/root/.helm/plugins/helm-push" inside the container and got the same error. I can actually see the install_plugin.sh inside the plugin dir, so not sure what is wrong here. Any advice?

404: not found plugin "push" exited with error

So I deployed chartmuseum on my kubernetes. I have set it up to use my aws access key and secret key. I have this endpoint http://testhelm.test.com and I added this repo in my ec2 instance. I tried pushing my sample chart package using the push plugin:

helm push helloworld-0.1.6.tgz testhelm --context-path=/prod

Pushing helloworld-0.1.6.tgz to testhelm...
Error: 404: not found
Error: plugin "push" exited with error

**testhelm is the name of my helm repo

Any advice on this?

Getting 401 when running from nodejs

I'm getting 401 when running helm repo update from inside nodejs (6.13.1) via an execSync command.
When running helm repo update from the shell it's working fine.
The user running the nodejs app is the same user as the one running the helm command directly in shell.
Running codefresh get images works in both cases.
The execSync command runs with shell: true.

Helm push lose requirments.yaml file

HELM version
Client: &version.Version{SemVer:"v2.16.1", GitCommit:"bbdfe5e7803a12bbdf97e94cd847859890cf4050", GitTreeState:"clean"}
HELM push version: 0.8.0
After upgrade to helm push 0.8.0, The Charts pushed to chartmuseum, lose requirments.yaml.

dependencies:
- name: kube-state-metrics
  version: 2.2.1
  repository: https://kubernetes-charts.storage.googleapis.com
  condition: kube-state-metrics.enabled
- name: A
  version: 1.0.1 
  repository: "file://../A"
  condition: A.enabled

Steps to push

helm repo add chartmuseum https://charts.software.io
helm dep up software
helm dep build software
helm push software chartmuseum -v ">0.0.0-0" -f 

Steps to download

wget https://charts.software.io/charts/software-\>0.0.0-0.tgz 
tar zxvf software-\>0.0.0-0.tgz  -C ./dir
s dir
Chart.yaml  charts      templates   values.yaml

requirments.yaml and lock are lose.

Anyway, downgrade to 0.7.1 can workaround.

Helm push to cm:// is broken in version 8.1

With helm push version 8.1 pushing to repositories protected using chartmueum/auth JWT using the cm:// protocol (where the intention is the bearer token should be picked up from the HELM_REPO_ACCESS_TOKEN environment variable) is broken

helm push <my chart>.tgz <my-repo>
Error: could not find protocol handler for: cm
Error: plugin "push" exited with error```

Installation fails on windows 10

We have to run helm on windows 10. After install helm client using helm-v2.12.0-windows-amd64.zip,
I use helm plugin install command to install helm-push but failed.
The error as follows:
C:\WINDOWS\system32>helm plugin install https://github.com/chartmuseum/helm-push
Error: exec: "sh": executable file not found in %PATH%

It seem that helm-push plugin does not support windows.
Wish you response, thanks.

Install w/o internet access

Hi there,

Is it possible to install helm-push for helm 3.0 without internet access?

I installed it online and checked the plugin folder in /root/.cache/helm/plugins/https-github.com-chartmuseum-helm-push, it's different from unzip from helm-push_0.8.0_linux_amd64.tar.gz.

├── acceptance_tests
│   ├── 01-helm.robot
│   ├── 02-chartmuseum.robot
│   └── lib
│   ├── ChartMuseum.py
│   ├── common.py
│   ├── HelmPush.py
│   ├── Helm.py
│   └── init.py
├── bin
│   └── helmpush
├── cmd
│   └── helmpush
│   ├── main.go
│   └── main_test.go
├── go.mod
├── go.sum
├── LICENSE
├── Makefile
├── pkg
│   ├── chartmuseum
│   │   ├── client.go
│   │   ├── client_test.go
│   │   ├── download.go
│   │   ├── download_test.go
│   │   ├── option.go
│   │   ├── upload.go
│   │   └── upload_test.go
│   └── helm
│   ├── chart.go
│   ├── chart_test.go
│   ├── index.go
│   ├── index_test.go
│   ├── repo.go
│   ├── repo_test.go
│   ├── serverinfo.go
│   └── version.go
├── plugin.yaml
├── README.md
├── releases
│   ├── v0.8.0
│   │   ├── bin
│   │   ├── LICENSE
│   │   └── plugin.yaml
│   └── v0.8.0.tar.gz
├── scripts
│   ├── acceptance.sh
│   ├── install_plugin.sh
│   ├── setup_test_environment.sh
│   └── test.sh
└── testdata
├── charts
│   ├── helm2
│   │   └── mychart
│   │   ├── Chart.yaml
│   │   └── templates
│   │   └── pod.yaml
│   └── helm3
│   └── my-v3-chart
│   ├── Chart.yaml
│   ├── templates
│   │   ├── deployment.yaml
│   │   ├── _helpers.tpl
│   │   ├── ingress.yaml
│   │   ├── NOTES.txt
│   │   ├── serviceaccount.yaml
│   │   ├── service.yaml
│   │   └── tests
│   │   └── test-connection.yaml
│   └── values.yaml
├── pgp
│   ├── helm-test-key.pub
│   ├── helm-test-key.secret
│   └── NOTE.txt
└── tls
├── ca.crt
├── server_ca.crt
├── test_cert.crt
├── test_key.key
├── test_server.crt
└── test_server.key

[Question] Are we able to use this with jfrog?

I'm using JFrog for chartmuseum.
Ive tried setting the following
HELM_REPO_AUTH_HEADER="X-JFrog-Art-Api"
HELM_REPO_ACCESS_TOKEN=<MYAPIKEY>
then running a helm push . chartmuseum however i get back a 404 when ever i try push.
Is there something that i'm missing?

Go Test fails

When trying to run the go test utility in /helm-push/cmd/ on the current source code it fails on Mac OSX.


main_test.go:224: unexpecting error uploading tarball: no repo named "helm-push-test" found
FAIL
exit status 1
FAIL github.com/chartmuseum/helm-push/cmd/helmpush 0.670s


Support pushing the charts to the specified namespace when enabling multi-tenants

With chartmuseum, you can easily enable multiple tenants by setting depth > 0. But you need to helm repo add <name> <URL> to add the specified namespace as a separate helm repo (/:repo/index.yaml).

We have provided a unified single entry point (`/index.yaml') for all the namespaces(merge all the index.yaml into one with namespace prefix added) and then namespace info is required when pushing charts to the specified namespace through the single entry point. e.g.:

helm repo add myrepo https://repo-url/context

##
# The chart will be pushed to https://repo-url/context/library
helm push --namespace=library mychart-0.1.0.tgz myrepo

helm v3 repo add chartmuseum auth failed, unsupported protocol scheme "cm"

I am running a ChartMuseum that needs to be authenticated locally. When using helm v3 for repo add, I get an error message. The error message is

➜ repo add chartmuseum cm://localhost:8089 --debug
Error: looks like "cm://localhost:8089" is not a valid chart repository or cannot be reached: Get cm://localhost:8089/index.yaml: unsupported protocol scheme "cm"
helm.go:76: [debug] Get cm://localhost:8089/index.yaml: unsupported protocol scheme "cm"
looks like "cm://localhost:8089" is not a valid chart repository or cannot be reached
main.addRepository
        /go/src/helm.sh/helm/cmd/helm/repo_add.go:108
main.(*repoAddOptions).run
        /go/src/helm.sh/helm/cmd/helm/repo_add.go:73
main.newRepoAddCmd.func1
        /go/src/helm.sh/helm/cmd/helm/repo_add.go:57
helm.sh/helm/vendor/github.com/spf13/cobra.(*Command).execute
        /go/src/helm.sh/helm/vendor/github.com/spf13/cobra/command.go:762
helm.sh/helm/vendor/github.com/spf13/cobra.(*Command).ExecuteC
        /go/src/helm.sh/helm/vendor/github.com/spf13/cobra/command.go:850
helm.sh/helm/vendor/github.com/spf13/cobra.(*Command).Execute
        /go/src/helm.sh/helm/vendor/github.com/spf13/cobra/command.go:800
main.main
        /go/src/helm.sh/helm/cmd/helm/helm.go:75
runtime.main
        /usr/local/go/src/runtime/proc.go:200
runtime.goexit
        /usr/local/go/src/runtime/asm_amd64.s:1337

I guess helm push is not compatible with the use of helm v3

Is there any plan for this helm v3 compatibility?

Error: 308: could not properly parse response JSON:

when i use the helm-push plugin to push a chart to harbor charts repository with command helm push demo2 hillstone, i get the result as below:

<title>308 Permanent Redirect</title>

308 Permanent Redirect


nginx/1.13.8 ]]>.

helm version: v2.11.0
helm-push version: 0.7.1
harbor version: 1.7.0
and the chartmuseum version in harbor is 0.7.1

Helm push not updating the requirements during package

Actual Behaviour:

I created a chart which depends on some other charts. I mentioned those chart details in requirements.yaml. When I did helm push . to chart museum, it is packaging only the files that exists in the folder.

Expected behavior:

helm push should pull the dependency charts mentioned in requirements.yaml & then do package it.

Fix:

Currently, helm push does helm package, instead it should do helm package --dependency-update which will update the dependencies in requirements.yaml

Feature request: allow to set values

Similar to how we can set version, would be nice to be able to set other values,
allowing for something like:
helm push mychart/ --version="1.2.3" --set image.tag="1.2.3" --set image.imagePullPolicy="Always" chartmuseum etc.

the packaged chart would have the values set

net/http: request canceled

helm repo list

stable	https://kubernetes-charts.storage.googleapis.com
harbor	http://xx/chartrepo/library 

helm push harbor-1.1.1.tgz harbor

Pushing harbor-1.1.1.tgz to harbor...
Error: Post http://xx/api/chartrepo/library/charts: net/http: request canceled (Client.Timeout exceeded while awaiting headers)
Error: plugin "push" exited with error

I don't know what happend. help!

add pushed charts to cached index

when pushing a chart, it would be nice if the chart was added to the local repo index cache immediately, instead of requiring a slow helm repo update. My current CI workflow would speed up quite a bit if it didn't need to re-fetch the chart index it just pushed to to be able to pull the chart.

install behind a proxy with custom certificate

I tried to install helm push on a server behind a proxy.

However, it failed because the proxy has a custom certificate (HTTPS/TLS) interception.

The installation fails with:

$ helm plugin --debug --logtostderr  install https://github.com/chartmuseum/helm-push
[debug] cloning https://github.com/chartmuseum/helm-push to /home/test/.cache/helm/plugins/https-github.com-chartmuseum-helm-push
[debug] symlinking /home/test/.cache/helm/plugins/https-github.com-chartmuseum-helm-push to /home/test/.local/share/helm/plugins/helm-push
plugin_install.go:73: [debug] loading plugin from /home/test/.local/share/helm/plugins/helm-push
plugin.go:60: [debug] running install hook: /usr/bin/sh -c cd $HELM_PLUGIN_DIR; scripts/install_plugin.sh
Downloading and installing helm-push v0.7.1 ...
https://github.com/chartmuseum/helm-push/releases/download/v0.7.1/helm-push_0.7.1_linux_amd64.tar.gz
curl: (60) Peer's certificate issuer has been marked as not trusted by the user.
More details here: http://curl.haxx.se/docs/sslcerts.html

curl performs SSL certificate verification by default, using a "bundle"
 of Certificate Authority (CA) public keys (CA certs). If the default
 bundle file isn't adequate, you can specify an alternate file
 using the --cacert option.
If this HTTPS server uses a certificate signed by a CA represented in
 the bundle, the certificate verification probably failed due to a
 problem with the certificate (it might be expired, or the name might
 not match the domain name in the URL).
If you'd like to turn off curl's verification of the certificate, use
 the -k (or --insecure) option.
Error: plugin install hook for "push" exited with error
helm.go:76: [debug] plugin install hook for "push" exited with error
main.runHook
        /home/circleci/helm.sh/helm/cmd/helm/plugin.go:67
main.(*pluginInstallOptions).run
        /home/circleci/helm.sh/helm/cmd/helm/plugin_install.go:79
main.newPluginInstallCmd.func2
        /home/circleci/helm.sh/helm/cmd/helm/plugin_install.go:50
github.com/spf13/cobra.(*Command).execute
        /go/pkg/mod/github.com/spf13/[email protected]/command.go:826
github.com/spf13/cobra.(*Command).ExecuteC
        /go/pkg/mod/github.com/spf13/[email protected]/command.go:914
github.com/spf13/cobra.(*Command).Execute
        /go/pkg/mod/github.com/spf13/[email protected]/command.go:864
main.main
        /home/circleci/helm.sh/helm/cmd/helm/helm.go:75
runtime.main
        /usr/local/go/src/runtime/proc.go:203
runtime.goexit
        /usr/local/go/src/runtime/asm_amd64.s:1357

As a workaround, I have added --insecure option to curl command in this script (edit with vim):

~/.cache/helm/plugins/https-github.com-chartmuseum-helm-push/scripts/install_plugin.sh

Then I manually resumed the installation

$ cd ~/.cache/helm/plugins/https-github.com-chartmuseum-helm-push
$ bash     scripts/install_plugin.sh
Downloading and installing helm-push v0.7.1 ...
https://github.com/chartmuseum/helm-push/releases/download/v0.7.1/helm-push_0.7.1_linux_amd64.tar.gz

chart pushed by helm-push lost comments in values.yaml

I have a chart, there are comments in values.yaml

~/helm-app-sample » tree -L 1 .
.
├── Chart.yaml
├── README.md
├── charts
├── crds
├── templates
├── values.schema.json
└── values.yaml

3 directories, 4 files
-----------------------------------------------------------------------------------------------------------------------------------------------
~/helm-app-sample » cat values.yaml
# 应用挂在到roc树上哪一个目录下
rocDirectory: ""
# 应用的所有者/创建者
appOwner: ""
-----------------------------------------------------------------------------------------------------------------------------------------------

chart pushed to chartmuseum lost these comments

image

but chart upload from web page keep these comments

image

so I think it's necessary to keep these comments, this should be fixed.

Plugin installation will falsely "success" even if download fails

I am trying to install helm-push without public network, I transfer whole git repo to the machine and run:

helm plugin install ./helm-push

The install script will try to download release package, and it fails.
Then if I run:

helm plugin list

I got:

NAME    VERSION DESCRIPTION                      
push    0.8.1   Push chart package to ChartMuseum

How to push a new package

{"error":"not found"}

How to push a new package?

[root@lab1 helm]# helm repo list
NAME            URL                                                                                   
local           https://charts.test.com                                         
[root@lab1 helm]# helm push charts/mysqlha-0.3.0.tgz local
Pushing mysqlha-0.3.0.tgz to local...
Error: 404: not found
Error: plugin "push" exited with error

Helm push without agruments should output the same as --help

Hi,

I belive that most CLI tools, and more particularly helm itself, are printing the output of the same command with --help.

I think that adding that link might be good in terms of usability. Of course, this only works for commands that do need mandatory arguments, which is the case of helm push.
Shouldn't be complicated in terms of implementation, I'm not familiar with go and clis so I'd rather not give it a shot myself.

Regards!

Example:
helm repo:

his command consists of multiple subcommands to interact with chart repositories.

It can be used to add, remove, list, and index chart repositories.
Example usage:
    $ helm repo add [NAME] [REPO_URL]

Usage:
  helm repo [command]

Available Commands:
  add         add a chart repository
  index       generate an index file given a directory containing packaged charts
  list        list chart repositories
  remove      remove a chart repository
  update      update information of available charts locally from chart repositories

Flags:
  -h, --help   help for repo

helm repo --help:

his command consists of multiple subcommands to interact with chart repositories.

It can be used to add, remove, list, and index chart repositories.
Example usage:
    $ helm repo add [NAME] [REPO_URL]

Usage:
  helm repo [command]

Available Commands:
  add         add a chart repository
  index       generate an index file given a directory containing packaged charts
  list        list chart repositories
  remove      remove a chart repository
  update      update information of available charts locally from chart repositories

Flags:
  -h, --help   help for repo

Helm push returns a 401, but curl and helm search/fetch work

We have a Chartmuseum instance running in our Kubernetes cluster (deployed via the helm chart chartmuseum-1.6.0) and for some reason I'm getting a Error: 401: unauthorized with helm push chart_name repo_name. I've added the repo via helm repo add --username correct_username --password correct_password repo_name https://chartmuseum.somedomain.com. I can successfully do helm search repo_name and helm fetch repo_name/chart_name, so the credentials seem to work unless I try to helm push. I can also successfully upload charts with curl --data-binary "@chart_name-1.0.0.tar.gz" https://chartmuseum.somedomain.com/api/charts -u correct_username:correct_password.

Any idea why helm push chart_name repo_name would give me a 401 or any further steps I could take to debug this?

cannot push if repo URL contains a path

I set up my Chart Museum behind a proxy. And added it to my helm client:

$ helm repo add acme https://www.acme.com/charts

And my nginx on the server side, sends all /charts/ to the proper kubernetes service.

Querying works fine as https://www.acme.com/charts goes to http://pod_url:port/

I also tested with curl and httpie, I can upload a chart fine (following the apis in chartmuseum doc).

$ curl --data-binary "@zzz-0.0.1.tgz" https://www.acme.com/charts/api/charts

Later on a helm fetch acme/zzz works fine as well.

Now a helm push will fail:

$ helm push mypath/ acme
Error: 404: not found
Error: plugin "push" exited with error

On my nginx reverse proxy, I can see the URL path is wrong as it receives: POST /api/charts/charts instead of POST /charts/api/charts.

I have a feeling the push plugin does not respect the base path of the repo when it was added, or at least messes up the said path.

Or am I missing something?

Ability to push directly to repo URL

Should be able to use a repo URL in place of a repo name, which would not require the repo to be added locally:

$ helm push mychart/ https://mychartrepo.com

Detection can be based on prefix of "http://" or "https://" in the second positional arg.

Since the repo isnt added with helm repo add, we are unable to extract creds from ~/.helm/repository/repositories.yaml. Authentication mechanism can be determined by env vars, or user/pass on the url (e.g. https://user:[email protected]).

Support for alpine

It is actually impossible to install this plugin in an alpine image with helm.

The current workaround is to install bash but it would be great it scripts could be used from alpine sh shell.

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.