-
Notifications
You must be signed in to change notification settings - Fork 402
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit 0cfa253
Showing
43 changed files
with
3,100 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
FROM alpine:3.6 | ||
RUN apk add --no-cache ca-certificates | ||
COPY bin/linux/amd64/chartmuseum /chartmuseum | ||
ENTRYPOINT ["/chartmuseum"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
The MIT License (MIT) | ||
|
||
Copyright (c) 2017 ChartMuseum | ||
|
||
Permission is hereby granted, free of charge, to any person obtaining a copy | ||
of this software and associated documentation files (the "Software"), to deal | ||
in the Software without restriction, including without limitation the rights | ||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
copies of the Software, and to permit persons to whom the Software is | ||
furnished to do so, subject to the following conditions: | ||
|
||
The above copyright notice and this permission notice shall be included in | ||
all copies or substantial portions of the Software. | ||
|
||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN | ||
THE SOFTWARE. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,84 @@ | ||
# Change this and commit to create new release | ||
VERSION=0.1.0 | ||
REVISION := $(shell git rev-parse --short HEAD;) | ||
|
||
HAS_GLIDE := $(shell command -v glide;) | ||
HAS_PIP := $(shell command -v pip;) | ||
HAS_VENV := $(shell command -v virtualenv;) | ||
HAS_GOVIZ := $(shell command -v goviz;) | ||
HAS_DOT := $(shell command -v dot;) | ||
HAS_AWS := $(shell command -v aws;) | ||
|
||
.PHONY: bootstrap | ||
bootstrap: | ||
ifndef HAS_GLIDE | ||
@go get -u github.com/Masterminds/glide | ||
endif | ||
@glide install --strip-vendor | ||
|
||
.PHONY: build | ||
build: export GOARCH=amd64 | ||
build: export CGO_ENABLED=0 | ||
build: | ||
@GOOS=linux go build -v -i --ldflags="-w -X main.Version=$(VERSION) -X main.Revision=$(REVISION)" \ | ||
-o bin/linux/amd64/chartmuseum cmd/chartmuseum/main.go # linux | ||
@GOOS=darwin go build -v -i --ldflags="-w -X main.Version=$(VERSION) -X main.Revision=$(REVISION)" \ | ||
-o bin/darwin/amd64/chartmuseum cmd/chartmuseum/main.go # mac osx | ||
|
||
.PHONY: clean | ||
clean: | ||
@git status --ignored --short | grep '^!! ' | sed 's/!! //' | xargs rm -rf | ||
|
||
.PHONY: setup-test-environment | ||
setup-test-environment: | ||
ifndef HAS_PIP | ||
@sudo apt-get update && sudo apt-get install -y python-pip | ||
endif | ||
ifndef HAS_VENV | ||
@sudo pip install virtualenv | ||
endif | ||
@./scripts/setup_test_environment.sh | ||
|
||
.PHONY: test | ||
test: setup-test-environment | ||
@./scripts/test.sh | ||
|
||
.PHONY: testcloud | ||
testcloud: export TEST_CLOUD_STORAGE=1 | ||
testcloud: test | ||
|
||
.PHONY: covhtml | ||
covhtml: | ||
@go tool cover -html=.cover/cover.out | ||
|
||
.PHONY: acceptance | ||
acceptance: setup-test-environment | ||
@./scripts/acceptance.sh | ||
|
||
.PHONY: run | ||
run: | ||
@rm -rf .chartstorage/ | ||
@bin/darwin/amd64/chartmuseum --debug --port=8080 --storage="local" \ | ||
--storage-local-rootdir=".chartstorage/" | ||
|
||
.PHONY: tree | ||
tree: | ||
@tree -I vendor | ||
|
||
# https://github.com/hirokidaichi/goviz/pull/8 | ||
.PHONY: goviz | ||
goviz: | ||
ifndef HAS_GOVIZ | ||
@go get -u github.com/RobotsAndPencils/goviz | ||
endif | ||
ifndef HAS_DOT | ||
@sudo apt-get update && sudo apt-get install -y graphviz | ||
endif | ||
@goviz -i github.com/chartmuseum/chartmuseum/cmd/chartmuseum -l | dot -Tpng -o goviz.png | ||
|
||
.PHONY: release | ||
release: | ||
ifndef HAS_AWS | ||
@sudo pip install awscli | ||
endif | ||
@scripts/release.sh $(VERSION) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,150 @@ | ||
# ChartMuseum | ||
<img align="right" src="https://github.com/chartmuseum/chartmuseum/raw/master/logo.png"> | ||
|
||
[![CircleCI](https://circleci.com/gh/chartmuseum/chartmuseum.svg?style=svg)](https://circleci.com/gh/chartmuseum/chartmuseum) | ||
[![Go Report Card](https://goreportcard.com/badge/github.com/chartmuseum/chartmuseum)](https://goreportcard.com/report/github.com/chartmuseum/chartmuseum) | ||
[![GoDoc](https://godoc.org/github.com/chartmuseum/chartmuseum?status.svg)](https://godoc.org/github.com/chartmuseum/chartmuseum) | ||
<sub>**_"Preserve your precious artifacts... in the cloud!"_**<sub> | ||
|
||
*ChartMuseum* is an open-source **[Helm Chart Repository](https://github.com/kubernetes/helm/blob/master/docs/chart_repository.md)** written in Go (Golang), with support for cloud storage backends, including [Google Cloud Storage](https://cloud.google.com/storage/) and [Amazon S3](https://aws.amazon.com/s3/). | ||
|
||
Works as a valid Helm Chart Repository, and also provides an API for uploading new chart packages to storage etc. | ||
|
||
<img width="60" align="right" src="https://github.com/golang-samples/gopher-vector/raw/master/gopher-side_color.png"> | ||
<img width="20" align="right" src="https://github.com/golang-samples/gopher-vector/raw/master/gopher-side_color.png"> | ||
|
||
Powered by some great Go technology: | ||
- [Kubernetes Helm](https://github.com/kubernetes/helm) - for working with charts, generating repository index | ||
- [Gin Web Framework](https://github.com/gin-gonic/gin) - for HTTP routing | ||
- [cli](https://github.com/urfave/cli) - for command line option parsing | ||
- [zap](https://github.com/uber-go/zap) - for logging | ||
|
||
## API | ||
### Helm Chart Repository | ||
- `GET /index.yaml` - retrieved when you run `helm repo add chartmuseum http://localhost:8080/` | ||
- `GET /charts/mychart-0.1.0.tgz` - retrieved when you run `helm install chartmuseum/mychart` | ||
- `GET /charts/mychart-0.1.0.tgz.prov` - retrieved when you run `helm install` with the `--verify` flag | ||
|
||
### Chart Manipulation | ||
- `POST /api/charts` - upload a new chart version | ||
- `POST /api/prov` - upload a new provenance file | ||
- `DELETE /api/charts/<name>/<version>` - delete a chart version (and corresponding provenance file) | ||
- `GET /api/charts` - list all charts | ||
- `GET /api/charts/<name>` - list all versions of a chart | ||
- `GET /api/charts/<name>/<version>` - describe a chart version | ||
|
||
## Uploading a Chart Package | ||
<sub>*Follow **"How to Run"** section below to get ChartMuseum up and running at ht<span>tp:/</span>/localhost:8080*<sub> | ||
|
||
First create `mychart-0.1.0.tgz` using the [Helm CLI](https://docs.helm.sh/using_helm/#installing-helm): | ||
``` | ||
cd mychart/ | ||
helm package . | ||
``` | ||
|
||
Upload `mychart-0.1.0.tgz`: | ||
```bash | ||
curl --data-binary "@mychart-0.1.0.tgz" http://localhost:8080/api/charts | ||
``` | ||
|
||
If you've signed your package and generated a [provenance file](https://github.com/kubernetes/helm/blob/master/docs/provenance.md), upload it with: | ||
```bash | ||
curl --data-binary "@mychart-0.1.0.tgz.prov" http://localhost:8080/api/prov | ||
``` | ||
|
||
## Installing Charts into Kubernetes | ||
Add the URL to your *ChartMuseum* installation to the local repository list: | ||
```bash | ||
helm repo add chartmuseum http://localhost:8080 | ||
``` | ||
|
||
Search for charts: | ||
```bash | ||
helm search chartmuseum/ | ||
``` | ||
|
||
Install chart: | ||
```bash | ||
helm install chartmuseum/mychart | ||
``` | ||
|
||
## How to Run | ||
### CLI | ||
#### Installation | ||
Install the binary: | ||
```bash | ||
# on Linux | ||
curl -LO https://s3.amazonaws.com/chartmuseum/release/latest/bin/linux/amd64/chartmuseum | ||
|
||
# on macOS | ||
curl -LO https://s3.amazonaws.com/chartmuseum/release/latest/bin/darwin/amd64/chartmuseum | ||
|
||
chmod +x ./chartmuseum | ||
mv ./chartmuseum /usr/local/bin | ||
``` | ||
Using `latest` in URLs above will get the latest binary (built from master branch). | ||
|
||
Replace `latest` with `$(curl -s https://s3.amazonaws.com/chartmuseum/release/stable.txt)` to automatically determine the latest stable release (e.g. `v0.1.0`). | ||
|
||
Show all CLI options with `chartmuseum --help` and determine version with `chartmuseum --version` | ||
|
||
#### Using with Amazon S3 | ||
Make sure your environment is properly setup to access `my-s3-bucket` | ||
```bash | ||
chartmuseum --debug --port=8080 \ | ||
--storage="amazon" \ | ||
--storage-amazon-bucket="my-s3-bucket" \ | ||
--storage-amazon-prefix="" \ | ||
--storage-amazon-region="us-east-1" | ||
``` | ||
|
||
#### Using with Google Cloud Storage | ||
Make sure your environment is properly setup to access `my-gcs-bucket` | ||
```bash | ||
chartmuseum --debug --port=8080 \ | ||
--storage="google" \ | ||
--storage-google-bucket="my-gcs-bucket" \ | ||
--storage-google-prefix="" | ||
``` | ||
|
||
#### Using with local filesystem storage | ||
Make sure you have read-write access to `./chartstorage` (will create if doesn't exist) | ||
```bash | ||
chartmuseum --debug --port=8080 \ | ||
--storage="local" \ | ||
--storage-local-rootdir="./chartstorage" | ||
``` | ||
|
||
### Docker Image | ||
Available via [Docker Hub](https://hub.docker.com/r/chartmuseum/chartmuseum/). | ||
|
||
Example usage (S3): | ||
```bash | ||
docker run --rm -it \ | ||
-p 8080:8080 \ | ||
-v ~/.aws:/root/.aws:ro \ | ||
chartmuseum/chartmuseum:latest \ | ||
--debug --port=8080 \ | ||
--storage="amazon" \ | ||
--storage-amazon-bucket="my-s3-bucket" \ | ||
--storage-amazon-prefix="" \ | ||
--storage-amazon-region="us-east-1" | ||
``` | ||
|
||
## Notes on index.yaml | ||
The repository index (index.yaml) is dynamically generated based on packages found in storage. If you store your own version of index.yaml, it will be completely ignored. | ||
|
||
`GET /index.yaml` occurs when you run `helm repo add chartmuseum http://localhost:8080/` or `helm repo update`. | ||
|
||
If you manually add/remove a .tgz package from storage, it will be immediately reflected in `GET /index.yaml`. | ||
|
||
You are no longer required to maintain your own version of index.yaml using `helm repo index --merge`. | ||
|
||
## Mirroring the official Kubernetes repositories | ||
Please see `scripts/mirror_k8s_repos.sh` for an example of how to download all .tgz packages from the official Kubernetes repositories (both stable and incubator). | ||
|
||
You can then use *ChartMuseum* to serve up an internal mirror: | ||
``` | ||
scripts/mirror_k8s_repos.sh | ||
chartmuseum --debug --port=8080 --storage="local" --storage-local-rootdir="./mirror" | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,83 @@ | ||
*** Settings *** | ||
Documentation Tests to verify that ChartMuseum is able to work with | ||
... Helm CLI and act as a valid Helm Chart Repository using | ||
... all supported storage backends (local, s3, gcs). | ||
Library OperatingSystem | ||
Library lib/ChartMuseum.py | ||
Library lib/Helm.py | ||
Suite Setup Suite Setup | ||
Suite Teardown Suite Teardown | ||
|
||
*** Test Cases *** | ||
ChartMuseum works with Helm using local storage | ||
Test Helm integration local | ||
|
||
ChartMuseum works with Helm using Amazon cloud storage | ||
Test Helm integration amazon | ||
|
||
ChartMuseum works with Helm using Google cloud storage | ||
Test Helm integration google | ||
|
||
*** Keyword *** | ||
Test Helm integration | ||
[Arguments] ${storage} | ||
Start ChartMuseum server with storage backend ${storage} | ||
Able to add ChartMuseum as Helm chart repo | ||
Helm search does not return test charts | ||
Unable to fetch and verify test charts | ||
Upload test charts to ChartMuseum | ||
Upload provenance files to ChartMuseum | ||
Able to update ChartMuseum repo | ||
Helm search returns test charts | ||
Able to fetch and verify test charts | ||
Delete test charts from ChartMuseum | ||
Able to update ChartMuseum repo | ||
Helm search does not return test charts | ||
Unable to fetch and verify test charts | ||
|
||
Start ChartMuseum server with storage backend | ||
[Arguments] ${storage} | ||
ChartMuseum.start chartmuseum ${storage} | ||
Sleep 2 | ||
|
||
Upload test charts to ChartMuseum | ||
ChartMuseum.upload test charts | ||
|
||
Upload provenance files to ChartMuseum | ||
ChartMuseum.upload provenance files | ||
|
||
Delete test charts from ChartMuseum | ||
ChartMuseum.delete test charts | ||
|
||
Able to add ChartMuseum as Helm chart repo | ||
Helm.add chart repo | ||
Helm.return code should be 0 | ||
Helm.output contains has been added | ||
|
||
Able to update ChartMuseum repo | ||
Helm.update chart repos | ||
Helm.return code should be 0 | ||
|
||
Helm search returns test charts | ||
Helm.search for chart mychart | ||
Helm.output contains mychart | ||
|
||
Helm search does not return test charts | ||
Helm.search for chart mychart | ||
Helm.output does not contain mychart | ||
|
||
Able to fetch and verify test charts | ||
Helm.fetch and verify chart mychart | ||
Helm.return code should be 0 | ||
|
||
Unable to fetch and verify test charts | ||
Helm.fetch and verify chart mychart | ||
Helm.return code should not be 0 | ||
|
||
Suite Setup | ||
ChartMuseum.remove chartmuseum logs | ||
|
||
Suite Teardown | ||
Helm.remove chart repo | ||
ChartMuseum.stop chartmuseum | ||
ChartMuseum.print chartmuseum logs |
Oops, something went wrong.
0cfa253
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
✂️
0cfa253
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
thanks for doing the honors