Skip to content

Commit 0cfa253

Browse files
committed
the museum is now open
0 parents  commit 0cfa253

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

43 files changed

+3100
-0
lines changed

Dockerfile

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
FROM alpine:3.6
2+
RUN apk add --no-cache ca-certificates
3+
COPY bin/linux/amd64/chartmuseum /chartmuseum
4+
ENTRYPOINT ["/chartmuseum"]

LICENSE

+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
The MIT License (MIT)
2+
3+
Copyright (c) 2017 ChartMuseum
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in
13+
all copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21+
THE SOFTWARE.

Makefile

+84
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,84 @@
1+
# Change this and commit to create new release
2+
VERSION=0.1.0
3+
REVISION := $(shell git rev-parse --short HEAD;)
4+
5+
HAS_GLIDE := $(shell command -v glide;)
6+
HAS_PIP := $(shell command -v pip;)
7+
HAS_VENV := $(shell command -v virtualenv;)
8+
HAS_GOVIZ := $(shell command -v goviz;)
9+
HAS_DOT := $(shell command -v dot;)
10+
HAS_AWS := $(shell command -v aws;)
11+
12+
.PHONY: bootstrap
13+
bootstrap:
14+
ifndef HAS_GLIDE
15+
@go get -u github.com/Masterminds/glide
16+
endif
17+
@glide install --strip-vendor
18+
19+
.PHONY: build
20+
build: export GOARCH=amd64
21+
build: export CGO_ENABLED=0
22+
build:
23+
@GOOS=linux go build -v -i --ldflags="-w -X main.Version=$(VERSION) -X main.Revision=$(REVISION)" \
24+
-o bin/linux/amd64/chartmuseum cmd/chartmuseum/main.go # linux
25+
@GOOS=darwin go build -v -i --ldflags="-w -X main.Version=$(VERSION) -X main.Revision=$(REVISION)" \
26+
-o bin/darwin/amd64/chartmuseum cmd/chartmuseum/main.go # mac osx
27+
28+
.PHONY: clean
29+
clean:
30+
@git status --ignored --short | grep '^!! ' | sed 's/!! //' | xargs rm -rf
31+
32+
.PHONY: setup-test-environment
33+
setup-test-environment:
34+
ifndef HAS_PIP
35+
@sudo apt-get update && sudo apt-get install -y python-pip
36+
endif
37+
ifndef HAS_VENV
38+
@sudo pip install virtualenv
39+
endif
40+
@./scripts/setup_test_environment.sh
41+
42+
.PHONY: test
43+
test: setup-test-environment
44+
@./scripts/test.sh
45+
46+
.PHONY: testcloud
47+
testcloud: export TEST_CLOUD_STORAGE=1
48+
testcloud: test
49+
50+
.PHONY: covhtml
51+
covhtml:
52+
@go tool cover -html=.cover/cover.out
53+
54+
.PHONY: acceptance
55+
acceptance: setup-test-environment
56+
@./scripts/acceptance.sh
57+
58+
.PHONY: run
59+
run:
60+
@rm -rf .chartstorage/
61+
@bin/darwin/amd64/chartmuseum --debug --port=8080 --storage="local" \
62+
--storage-local-rootdir=".chartstorage/"
63+
64+
.PHONY: tree
65+
tree:
66+
@tree -I vendor
67+
68+
# https://github.com/hirokidaichi/goviz/pull/8
69+
.PHONY: goviz
70+
goviz:
71+
ifndef HAS_GOVIZ
72+
@go get -u github.com/RobotsAndPencils/goviz
73+
endif
74+
ifndef HAS_DOT
75+
@sudo apt-get update && sudo apt-get install -y graphviz
76+
endif
77+
@goviz -i github.com/chartmuseum/chartmuseum/cmd/chartmuseum -l | dot -Tpng -o goviz.png
78+
79+
.PHONY: release
80+
release:
81+
ifndef HAS_AWS
82+
@sudo pip install awscli
83+
endif
84+
@scripts/release.sh $(VERSION)

README.md

+150
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,150 @@
1+
# ChartMuseum
2+
<img align="right" src="https://github.com/chartmuseum/chartmuseum/raw/master/logo.png">
3+
4+
[![CircleCI](https://circleci.com/gh/chartmuseum/chartmuseum.svg?style=svg)](https://circleci.com/gh/chartmuseum/chartmuseum)
5+
[![Go Report Card](https://goreportcard.com/badge/github.com/chartmuseum/chartmuseum)](https://goreportcard.com/report/github.com/chartmuseum/chartmuseum)
6+
[![GoDoc](https://godoc.org/github.com/chartmuseum/chartmuseum?status.svg)](https://godoc.org/github.com/chartmuseum/chartmuseum)
7+
<sub>**_"Preserve your precious artifacts... in the cloud!"_**<sub>
8+
9+
*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/).
10+
11+
Works as a valid Helm Chart Repository, and also provides an API for uploading new chart packages to storage etc.
12+
13+
<img width="60" align="right" src="https://github.com/golang-samples/gopher-vector/raw/master/gopher-side_color.png">
14+
<img width="20" align="right" src="https://github.com/golang-samples/gopher-vector/raw/master/gopher-side_color.png">
15+
16+
Powered by some great Go technology:
17+
- [Kubernetes Helm](https://github.com/kubernetes/helm) - for working with charts, generating repository index
18+
- [Gin Web Framework](https://github.com/gin-gonic/gin) - for HTTP routing
19+
- [cli](https://github.com/urfave/cli) - for command line option parsing
20+
- [zap](https://github.com/uber-go/zap) - for logging
21+
22+
## API
23+
### Helm Chart Repository
24+
- `GET /index.yaml` - retrieved when you run `helm repo add chartmuseum http://localhost:8080/`
25+
- `GET /charts/mychart-0.1.0.tgz` - retrieved when you run `helm install chartmuseum/mychart`
26+
- `GET /charts/mychart-0.1.0.tgz.prov` - retrieved when you run `helm install` with the `--verify` flag
27+
28+
### Chart Manipulation
29+
- `POST /api/charts` - upload a new chart version
30+
- `POST /api/prov` - upload a new provenance file
31+
- `DELETE /api/charts/<name>/<version>` - delete a chart version (and corresponding provenance file)
32+
- `GET /api/charts` - list all charts
33+
- `GET /api/charts/<name>` - list all versions of a chart
34+
- `GET /api/charts/<name>/<version>` - describe a chart version
35+
36+
## Uploading a Chart Package
37+
<sub>*Follow **"How to Run"** section below to get ChartMuseum up and running at ht<span>tp:/</span>/localhost:8080*<sub>
38+
39+
First create `mychart-0.1.0.tgz` using the [Helm CLI](https://docs.helm.sh/using_helm/#installing-helm):
40+
```
41+
cd mychart/
42+
helm package .
43+
```
44+
45+
Upload `mychart-0.1.0.tgz`:
46+
```bash
47+
curl --data-binary "@mychart-0.1.0.tgz" http://localhost:8080/api/charts
48+
```
49+
50+
If you've signed your package and generated a [provenance file](https://github.com/kubernetes/helm/blob/master/docs/provenance.md), upload it with:
51+
```bash
52+
curl --data-binary "@mychart-0.1.0.tgz.prov" http://localhost:8080/api/prov
53+
```
54+
55+
## Installing Charts into Kubernetes
56+
Add the URL to your *ChartMuseum* installation to the local repository list:
57+
```bash
58+
helm repo add chartmuseum http://localhost:8080
59+
```
60+
61+
Search for charts:
62+
```bash
63+
helm search chartmuseum/
64+
```
65+
66+
Install chart:
67+
```bash
68+
helm install chartmuseum/mychart
69+
```
70+
71+
## How to Run
72+
### CLI
73+
#### Installation
74+
Install the binary:
75+
```bash
76+
# on Linux
77+
curl -LO https://s3.amazonaws.com/chartmuseum/release/latest/bin/linux/amd64/chartmuseum
78+
79+
# on macOS
80+
curl -LO https://s3.amazonaws.com/chartmuseum/release/latest/bin/darwin/amd64/chartmuseum
81+
82+
chmod +x ./chartmuseum
83+
mv ./chartmuseum /usr/local/bin
84+
```
85+
Using `latest` in URLs above will get the latest binary (built from master branch).
86+
87+
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`).
88+
89+
Show all CLI options with `chartmuseum --help` and determine version with `chartmuseum --version`
90+
91+
#### Using with Amazon S3
92+
Make sure your environment is properly setup to access `my-s3-bucket`
93+
```bash
94+
chartmuseum --debug --port=8080 \
95+
--storage="amazon" \
96+
--storage-amazon-bucket="my-s3-bucket" \
97+
--storage-amazon-prefix="" \
98+
--storage-amazon-region="us-east-1"
99+
```
100+
101+
#### Using with Google Cloud Storage
102+
Make sure your environment is properly setup to access `my-gcs-bucket`
103+
```bash
104+
chartmuseum --debug --port=8080 \
105+
--storage="google" \
106+
--storage-google-bucket="my-gcs-bucket" \
107+
--storage-google-prefix=""
108+
```
109+
110+
#### Using with local filesystem storage
111+
Make sure you have read-write access to `./chartstorage` (will create if doesn't exist)
112+
```bash
113+
chartmuseum --debug --port=8080 \
114+
--storage="local" \
115+
--storage-local-rootdir="./chartstorage"
116+
```
117+
118+
### Docker Image
119+
Available via [Docker Hub](https://hub.docker.com/r/chartmuseum/chartmuseum/).
120+
121+
Example usage (S3):
122+
```bash
123+
docker run --rm -it \
124+
-p 8080:8080 \
125+
-v ~/.aws:/root/.aws:ro \
126+
chartmuseum/chartmuseum:latest \
127+
--debug --port=8080 \
128+
--storage="amazon" \
129+
--storage-amazon-bucket="my-s3-bucket" \
130+
--storage-amazon-prefix="" \
131+
--storage-amazon-region="us-east-1"
132+
```
133+
134+
## Notes on index.yaml
135+
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.
136+
137+
`GET /index.yaml` occurs when you run `helm repo add chartmuseum http://localhost:8080/` or `helm repo update`.
138+
139+
If you manually add/remove a .tgz package from storage, it will be immediately reflected in `GET /index.yaml`.
140+
141+
You are no longer required to maintain your own version of index.yaml using `helm repo index --merge`.
142+
143+
## Mirroring the official Kubernetes repositories
144+
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).
145+
146+
You can then use *ChartMuseum* to serve up an internal mirror:
147+
```
148+
scripts/mirror_k8s_repos.sh
149+
chartmuseum --debug --port=8080 --storage="local" --storage-local-rootdir="./mirror"
150+
```

acceptance_tests/helm.robot

+83
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,83 @@
1+
*** Settings ***
2+
Documentation Tests to verify that ChartMuseum is able to work with
3+
... Helm CLI and act as a valid Helm Chart Repository using
4+
... all supported storage backends (local, s3, gcs).
5+
Library OperatingSystem
6+
Library lib/ChartMuseum.py
7+
Library lib/Helm.py
8+
Suite Setup Suite Setup
9+
Suite Teardown Suite Teardown
10+
11+
*** Test Cases ***
12+
ChartMuseum works with Helm using local storage
13+
Test Helm integration local
14+
15+
ChartMuseum works with Helm using Amazon cloud storage
16+
Test Helm integration amazon
17+
18+
ChartMuseum works with Helm using Google cloud storage
19+
Test Helm integration google
20+
21+
*** Keyword ***
22+
Test Helm integration
23+
[Arguments] ${storage}
24+
Start ChartMuseum server with storage backend ${storage}
25+
Able to add ChartMuseum as Helm chart repo
26+
Helm search does not return test charts
27+
Unable to fetch and verify test charts
28+
Upload test charts to ChartMuseum
29+
Upload provenance files to ChartMuseum
30+
Able to update ChartMuseum repo
31+
Helm search returns test charts
32+
Able to fetch and verify test charts
33+
Delete test charts from ChartMuseum
34+
Able to update ChartMuseum repo
35+
Helm search does not return test charts
36+
Unable to fetch and verify test charts
37+
38+
Start ChartMuseum server with storage backend
39+
[Arguments] ${storage}
40+
ChartMuseum.start chartmuseum ${storage}
41+
Sleep 2
42+
43+
Upload test charts to ChartMuseum
44+
ChartMuseum.upload test charts
45+
46+
Upload provenance files to ChartMuseum
47+
ChartMuseum.upload provenance files
48+
49+
Delete test charts from ChartMuseum
50+
ChartMuseum.delete test charts
51+
52+
Able to add ChartMuseum as Helm chart repo
53+
Helm.add chart repo
54+
Helm.return code should be 0
55+
Helm.output contains has been added
56+
57+
Able to update ChartMuseum repo
58+
Helm.update chart repos
59+
Helm.return code should be 0
60+
61+
Helm search returns test charts
62+
Helm.search for chart mychart
63+
Helm.output contains mychart
64+
65+
Helm search does not return test charts
66+
Helm.search for chart mychart
67+
Helm.output does not contain mychart
68+
69+
Able to fetch and verify test charts
70+
Helm.fetch and verify chart mychart
71+
Helm.return code should be 0
72+
73+
Unable to fetch and verify test charts
74+
Helm.fetch and verify chart mychart
75+
Helm.return code should not be 0
76+
77+
Suite Setup
78+
ChartMuseum.remove chartmuseum logs
79+
80+
Suite Teardown
81+
Helm.remove chart repo
82+
ChartMuseum.stop chartmuseum
83+
ChartMuseum.print chartmuseum logs

0 commit comments

Comments
 (0)