Skip to content
This repository has been archived by the owner on May 6, 2020. It is now read-only.

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
technosophos committed Aug 24, 2018
0 parents commit c3217f4
Show file tree
Hide file tree
Showing 21 changed files with 340 additions and 0 deletions.
21 changes: 21 additions & 0 deletions LICENSE
@@ -0,0 +1,21 @@
MIT License

Copyright (c) Microsoft Corporation. All rights reserved.

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
7 changes: 7 additions & 0 deletions build.sh
@@ -0,0 +1,7 @@
#!/bin/sh

for dir in $(ls -1); do
if [[ -e $dir/cnab/bundle.json ]]; then
cp $dir/cnab/bundle.json bundles/$dir.json
fi
done
9 changes: 9 additions & 0 deletions bundles/helloazure.json
@@ -0,0 +1,9 @@
{
"name": "helloworld",
"version": "0.1.0",
"parameters": {},
"invocationImage": {
"imageType": "azure-image",
"image": "duffle-dev/duffle-vm-example-0.1.1"
}
}
31 changes: 31 additions & 0 deletions bundles/hellohelm.json
@@ -0,0 +1,31 @@
{
"name": "hellohelm",
"version": "0.1.0",
"invocationImage": {
"imageType": "docker",
"image": "technosophos/demo2:0.1.0"
},
"images": [
{
"name": "alpine",
"uri": "technosophos/demo2alpine:0.1.0",
"refs": [
{
"path": "cnab/app/charts/alpine/values.yaml",
"field": "image.repository"
}
]
}
],
"parameters": {
"port": {
"defaultValue": 8080,
"type": "int"
}
},
"credentials": {
"kubeconfig": {
"path": "/root/.kube/config"
}
}
}
30 changes: 30 additions & 0 deletions bundles/helloworld.json
@@ -0,0 +1,30 @@
{
"name": "foo",
"version": "1.0",
"invocationImage": {
"imageType": "docker",
"image": "technosophos/helloworld:0.1.0"
},
"images": [
{
"name": "image1",
"uri": "urn:image1uri",
"refs": [
{
"path": "image1path",
"field": "image.1.field"
}
]
},
{
"name": "image2",
"uri": "urn:image2uri",
"refs": [
{
"path": "image2path",
"field": "image.2.field"
}
]
}
]
}
28 changes: 28 additions & 0 deletions helloazure/cnab/app/run
@@ -0,0 +1,28 @@
#!/bin/sh

#set -eo pipefail

action=$CNAB_ACTION
name=$CNAB_INSTALLATION_NAME

case $action in
install)
echo "Install action"
;;
uninstall)
echo "uninstall action"
;;
upgrade)
echo "Upgrade action"
;;
downgrade)
echo "Downgrade action"
;;
status)
echo "Status action"
;;
*)
echo "No action for $action"
;;
esac
echo "Action $action complete for $name"
9 changes: 9 additions & 0 deletions helloazure/cnab/bundle.json
@@ -0,0 +1,9 @@
{
"name": "helloworld",
"version": "0.1.0",
"parameters": {},
"invocationImage": {
"imageType": "azure-image",
"image": "duffle-dev/duffle-vm-example-0.1.1"
}
}
8 changes: 8 additions & 0 deletions hellohelm/cnab/Dockerfile
@@ -0,0 +1,8 @@
FROM lachlanevenson/k8s-helm:v2.10.0

COPY app/run /cnab/app/run
COPY bundle.json /cnab/bundle.json
COPY Dockerfile cnab/Dockerfile
COPY app/charts /cnab/app/charts

CMD [ "/cnab/app/run" ]
7 changes: 7 additions & 0 deletions hellohelm/cnab/app/charts/alpine/Chart.yaml
@@ -0,0 +1,7 @@
name: alpine
description: Deploy a basic Alpine Linux pod
version: 0.1.0
home: https://github.com/kubernetes/helm
sources:
- https://github.com/kubernetes/helm
appVersion: 3.3
3 changes: 3 additions & 0 deletions hellohelm/cnab/app/charts/alpine/Dockerfile
@@ -0,0 +1,3 @@
FROM alpine:3.7

CMD ["sleep", "9000"]
11 changes: 11 additions & 0 deletions hellohelm/cnab/app/charts/alpine/README.md
@@ -0,0 +1,11 @@
# Alpine: A simple Helm chart

Run a single pod of Alpine Linux.

The `templates/` directory contains a very simple pod resource with a
couple of parameters.

The `values.yaml` file contains the default values for the
`alpine-pod.yaml` template.

You can install this example using `helm install docs/examples/alpine`.
16 changes: 16 additions & 0 deletions hellohelm/cnab/app/charts/alpine/templates/_helpers.tpl
@@ -0,0 +1,16 @@
{{/* vim: set filetype=mustache: */}}
{{/*
Expand the name of the chart.
*/}}
{{- define "alpine.name" -}}
{{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" -}}
{{- end -}}

{{/*
Create a default fully qualified app name.
We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec).
*/}}
{{- define "alpine.fullname" -}}
{{- $name := default .Chart.Name .Values.nameOverride -}}
{{- printf "%s-%s" .Release.Name $name | trunc 63 | trimSuffix "-" -}}
{{- end -}}
23 changes: 23 additions & 0 deletions hellohelm/cnab/app/charts/alpine/templates/alpine-pod.yaml
@@ -0,0 +1,23 @@
apiVersion: v1
kind: Pod
metadata:
name: {{ template "alpine.fullname" . }}
labels:
# The "heritage" label is used to track which tool deployed a given chart.
# It is useful for admins who want to see what releases a particular tool
# is responsible for.
heritage: {{ .Release.Service }}
# The "release" convention makes it easy to tie a release to all of the
# Kubernetes resources that were created as part of that release.
release: {{ .Release.Name }}
# This makes it easy to audit chart usage.
chart: {{ .Chart.Name }}-{{ .Chart.Version }}
app: {{ template "alpine.name" . }}
spec:
# This shows how to use a simple value. This will look for a passed-in value called restartPolicy.
restartPolicy: {{ .Values.restartPolicy }}
containers:
- name: waiter
image: "{{ .Values.image.repository }}:{{ .Values.image.tag }}"
imagePullPolicy: {{ .Values.image.pullPolicy }}
command: ["/bin/sleep", "9000"]
6 changes: 6 additions & 0 deletions hellohelm/cnab/app/charts/alpine/values.yaml
@@ -0,0 +1,6 @@
image:
repository: alpine
tag: 3.3
pullPolicy: IfNotPresent

restartPolicy: Never
31 changes: 31 additions & 0 deletions hellohelm/cnab/bundle.json
@@ -0,0 +1,31 @@
{
"name": "hellohelm",
"version": "0.1.0",
"invocationImage": {
"imageType": "docker",
"image": "technosophos/demo2:0.1.0"
},
"images": [
{
"name": "alpine",
"uri": "technosophos/demo2alpine:0.1.0",
"refs": [
{
"path": "cnab/app/charts/alpine/values.yaml",
"field": "image.repository"
}
]
}
],
"parameters": {
"port": {
"defaultValue": 8080,
"type": "int"
}
},
"credentials": {
"kubeconfig": {
"path": "/root/.kube/config"
}
}
}
29 changes: 29 additions & 0 deletions hellohelm/cnab/run
@@ -0,0 +1,29 @@
#!/bin/sh
export KUBECONFIG="/root/.kube/config"
action=$CNAB_ACTION
name=$CNAB_INSTALLATION_NAME
mychart=/cnab/app/charts/alpine

case $action in
install)
echo "Installing local chart"
helm install -n $name $mychart
;;
uninstall)
echo "uninstall action"
helm delete --purge $name
;;
upgrade)
echo "Upgrade action"
helm upgrade $name $mychart
;;
downgrade)
status)
echo "Status action"
helm status $name
;;
*)
echo "No action for $action"
;;
esac
echo "Action $action complete for $name"
3 changes: 3 additions & 0 deletions hellohelm/duffle.toml
@@ -0,0 +1,3 @@
name = "hellohelm"
registry = "technosophos"
components = ["cnab"]
7 changes: 7 additions & 0 deletions helloworld/cnab/Dockerfile
@@ -0,0 +1,7 @@
FROM alpine:latest

COPY app/run /cnab/app/run
COPY bundle.json /cnab/bundle.json
COPY Dockerfile cnab/Dockerfile

CMD [ "/cnab/app/run" ]
28 changes: 28 additions & 0 deletions helloworld/cnab/app/run
@@ -0,0 +1,28 @@
#!/bin/sh

#set -eo pipefail

action=$CNAB_ACTION
name=$CNAB_INSTALLATION_NAME

case $action in
install)
echo "Install action"
;;
uninstall)
echo "uninstall action"
;;
upgrade)
echo "Upgrade action"
;;
downgrade)
echo "Downgrade action"
;;
status)
echo "Status action"
;;
*)
echo "No action for $action"
;;
esac
echo "Action $action complete for $name"
30 changes: 30 additions & 0 deletions helloworld/cnab/bundle.json
@@ -0,0 +1,30 @@
{
"name": "foo",
"version": "1.0",
"invocationImage": {
"imageType": "docker",
"image": "technosophos/helloworld:0.1.0"
},
"images": [
{
"name": "image1",
"uri": "urn:image1uri",
"refs": [
{
"path": "image1path",
"field": "image.1.field"
}
]
},
{
"name": "image2",
"uri": "urn:image2uri",
"refs": [
{
"path": "image2path",
"field": "image.2.field"
}
]
}
]
}
3 changes: 3 additions & 0 deletions helloworld/duffle.toml
@@ -0,0 +1,3 @@
name = "helloworld"
registry = "bacongobbler"
components = ["cnab"]

0 comments on commit c3217f4

Please sign in to comment.