Skip to content
This repository has been archived by the owner on Mar 24, 2023. It is now read-only.

Commit

Permalink
Merge pull request #360 from laverya/use-helm-to-pull-helm-charts
Browse files Browse the repository at this point in the history
Use helm to pull helm charts
  • Loading branch information
laverya authored Aug 16, 2018
2 parents 6789bee + a8832f5 commit af081d2
Show file tree
Hide file tree
Showing 58 changed files with 1,753 additions and 231 deletions.
14 changes: 13 additions & 1 deletion Gopkg.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

29 changes: 29 additions & 0 deletions hack/docs/mutations.json
Original file line number Diff line number Diff line change
Expand Up @@ -173,6 +173,35 @@
"description": "The base directory of the existing chart."
}
},
{
"path": "properties.assets.properties.v1.items.properties.helm.properties.helm_fetch",
"merge": {
"description": "Configuration for indicating a chart hosted somewhere that would be accessible to the `helm fetch` function."
},
"replace": {
"required": [
"chart_ref"
]
}
},
{
"path": "properties.assets.properties.v1.items.properties.helm.properties.helm_fetch.properties.chart_ref",
"merge": {
"description": "`chart URL | repo/chartname` as would be passed to `helm fetch`"
}
},
{
"path": "properties.assets.properties.v1.items.properties.helm.properties.helm_fetch.properties.repo_url",
"merge": {
"description": "repository URL as would be passed to `helm fetch` with the `--repo` flag"
}
},
{
"path": "properties.assets.properties.v1.items.properties.helm.properties.helm_fetch.properties.version",
"merge": {
"description": "version as would be passed to `helm fetch` with the `--version` flag"
}
},
{
"path": "properties.assets.properties.v1.items.properties.helm.properties.github",
"merge": {
Expand Down
24 changes: 24 additions & 0 deletions hack/docs/schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -416,6 +416,27 @@
"path"
]
},
"helm_fetch": {
"description": "Configuration for indicating a chart hosted somewhere that would be accessible to the `helm fetch` function.",
"type": "object",
"properties": {
"chart_ref": {
"description": "`chart URL | repo/chartname` as would be passed to `helm fetch`",
"type": "string"
},
"repo_url": {
"description": "repository URL as would be passed to `helm fetch` with the `--repo` flag",
"type": "string"
},
"version": {
"description": "version as would be passed to `helm fetch` with the `--version` flag",
"type": "string"
}
},
"required": [
"chart_ref"
]
},
"helm_opts": {
"description": "Additional options as would be passed to `helm template`",
"type": "array",
Expand Down Expand Up @@ -862,6 +883,9 @@
"items": {
"type": "string"
}
},
"root": {
"type": "string"
}
},
"required": []
Expand Down
20 changes: 20 additions & 0 deletions integration/base/helm-fetch/expected/.ship/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# mysql helm chart rendering example, using stable/mysql version 0.8.3
---
assets:
v1:
- inline:
contents: |
this exists to create the charts directory
it should be removed when that bug is resolved
see https://github.com/replicatedhq/ship/issues/373
dest: ./charts/mkdir.sh
mode: 0777
- helm:
dest: charts/rendered
helm_fetch:
chart_ref: stable/mysql
version: "0.8.3"
config: {}
lifecycle:
v1:
- render: {}
1 change: 1 addition & 0 deletions integration/base/helm-fetch/expected/.ship/state.json
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"v1":{"config":{}}}
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
this exists to create the charts directory
it should be removed when that bug is resolved
see https://github.com/replicatedhq/ship/issues/373
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
##---
# Source: mysql/templates/deployment.yaml
apiVersion: extensions/v1beta1
kind: Deployment
metadata:
name: ship-mysql
labels:
app: ship-mysql
chart: "mysql-0.8.3"
release: "ship"
heritage: "Tiller"
spec:
template:
metadata:
labels:
app: ship-mysql
spec:
initContainers:
- name: "remove-lost-found"
image: "busybox:1.25.0"
imagePullPolicy: "IfNotPresent"
command: ["rm", "-fr", "/var/lib/mysql/lost+found"]
volumeMounts:
- name: data
mountPath: /var/lib/mysql
containers:
- name: ship-mysql
image: "mysql:5.7.14"
imagePullPolicy: "IfNotPresent"
resources:
requests:
cpu: 100m
memory: 256Mi

env:
- name: MYSQL_ROOT_PASSWORD
valueFrom:
secretKeyRef:
name: ship-mysql
key: mysql-root-password
- name: MYSQL_PASSWORD
valueFrom:
secretKeyRef:
name: ship-mysql
key: mysql-password
- name: MYSQL_USER
value: ""
- name: MYSQL_DATABASE
value: ""
ports:
- name: mysql
containerPort: 3306
livenessProbe:
exec:
command:
- sh
- -c
- "mysqladmin ping -u root -p${MYSQL_ROOT_PASSWORD}"
initialDelaySeconds: 30
periodSeconds: 10
timeoutSeconds: 5
successThreshold: 1
failureThreshold: 3
readinessProbe:
exec:
command:
- sh
- -c
- "mysqladmin ping -u root -p${MYSQL_ROOT_PASSWORD}"
initialDelaySeconds: 5
periodSeconds: 10
timeoutSeconds: 1
successThreshold: 1
failureThreshold: 3
volumeMounts:
- name: data
mountPath: /var/lib/mysql
volumes:
- name: data
persistentVolumeClaim:
claimName: ship-mysql
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
##---
# Source: mysql/templates/pvc.yaml

kind: PersistentVolumeClaim
apiVersion: v1
metadata:
name: ship-mysql
labels:
app: ship-mysql
chart: "mysql-0.8.3"
release: "ship"
heritage: "Tiller"
spec:
accessModes:
- "ReadWriteOnce"
resources:
requests:
storage: "8Gi"
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
##---
# Source: mysql/templates/secrets.yaml

apiVersion: v1
kind: Secret
metadata:
name: ship-mysql
labels:
app: ship-mysql
chart: "mysql-0.8.3"
release: "ship"
heritage: "Tiller"
type: Opaque
data:

mysql-root-password: "Q0RLbmszeFp3Sw=="


mysql-password: "elNHSU5EblpxcA=="

Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
##---
# Source: mysql/templates/svc.yaml
apiVersion: v1
kind: Service
metadata:
name: ship-mysql
labels:
app: ship-mysql
chart: "mysql-0.8.3"
release: "ship"
heritage: "Tiller"
spec:
type: ClusterIP
ports:
- name: mysql
port: 3306
targetPort: mysql
selector:
app: ship-mysql
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
##---
# Source: mysql/templates/tests/test-configmap.yaml
apiVersion: v1
kind: ConfigMap
metadata:
name: ship-mysql-test
labels:
app: ship-mysql
chart: "mysql-0.8.3"
heritage: "Tiller"
release: "ship"
data:
run.sh: |-
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
##---
# Source: mysql/templates/tests/test.yaml
apiVersion: v1
kind: Pod
metadata:
name: ship-mysql-test
labels:
app: ship-mysql
chart: "mysql-0.8.3"
heritage: "Tiller"
release: "ship"
annotations:
"helm.sh/hook": test-success
spec:
initContainers:
- name: test-framework
image: dduportal/bats:0.4.0
command:
- "bash"
- "-c"
- |
set -ex
# copy bats to tools dir
cp -R /usr/local/libexec/ /tools/bats/
volumeMounts:
- mountPath: /tools
name: tools
containers:
- name: ship-test
image: "mysql:5.7.14"
command: ["/tools/bats/bats", "-t", "/tests/run.sh"]
volumeMounts:
- mountPath: /tests
name: tests
readOnly: true
- mountPath: /tools
name: tools
volumes:
- name: tests
configMap:
name: ship-mysql-test
- name: tools
emptyDir: {}
restartPolicy: Never
20 changes: 20 additions & 0 deletions integration/base/helm-fetch/input/.ship/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# mysql helm chart rendering example, using stable/mysql version 0.8.3
---
assets:
v1:
- inline:
contents: |
this exists to create the charts directory
it should be removed when that bug is resolved
see https://github.com/replicatedhq/ship/issues/373
dest: ./charts/mkdir.sh
mode: 0777
- helm:
dest: charts/rendered
helm_fetch:
chart_ref: stable/mysql
version: "0.8.3"
config: {}
lifecycle:
v1:
- render: {}
1 change: 1 addition & 0 deletions integration/base/helm-fetch/input/.ship/state.json
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{}
3 changes: 3 additions & 0 deletions integration/base/helm-fetch/metadata.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
disable_online: true

skip_cleanup: true
1 change: 1 addition & 0 deletions integration/lib.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ var skipFiles = []string{
"installer/terraform/.terraform/plugins",
"installer/terraform/plan",
"installer/terraform/terraform.tfstate",
"installer/charts/rendered/templates/secrets.yaml",
}

func skipCheck(filepath string) bool {
Expand Down
Loading

0 comments on commit af081d2

Please sign in to comment.