This repository has been archived by the owner on Sep 4, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 134
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* add example helm chart Signed-off-by: Matt Butcher <[email protected]> * update to use helloworld-python example Signed-off-by: Matt Butcher <[email protected]> * Update examples/charts/README.md Co-Authored-By: Hongchao Deng <[email protected]> * Update examples/charts/README.md Co-Authored-By: Hongchao Deng <[email protected]>
- Loading branch information
1 parent
5ff3b21
commit e0e69e5
Showing
8 changed files
with
156 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,26 @@ | ||
# Example Charts of OAM Apps | ||
|
||
This directory contains example Helm charts that install Open Application Model apps. | ||
|
||
Helm is a useful tool for parameterizing AppConfig files. There are various strategies for installing ComponentSchematics: | ||
|
||
- They may be bundled into the same chart that manages them, and treated like standard resources | ||
- When this chart is upgraded or deleted, components will be updated or deleted | ||
- This can be bad if multiple apps share the same components | ||
- This can be good if your app configs and components are closely related | ||
- They may be bundled into the same chart that references them, but managed with hooks | ||
- You can configure hooks to not delete components | ||
- This solves some of the problems above | ||
- They may be kept in separate Helm charts | ||
- This model is best if you want to have lots of components that can be shared among different app configs | ||
|
||
|
||
## Installing OAM Apps | ||
|
||
These examples are built for Helm 3. They can be installed with the following command: | ||
|
||
```console | ||
$ helm install my-hello hello-rudr | ||
``` | ||
|
||
They can be uninstalled with `helm delete my-hello`. |
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 @@ | ||
# Patterns to ignore when building packages. | ||
# This supports shell glob matching, relative path matching, and | ||
# negation (prefixed with !). Only one pattern per line. | ||
.DS_Store | ||
# Common VCS dirs | ||
.git/ | ||
.gitignore | ||
.bzr/ | ||
.bzrignore | ||
.hg/ | ||
.hgignore | ||
.svn/ | ||
# Common backup files | ||
*.swp | ||
*.bak | ||
*.tmp | ||
*~ | ||
# Various IDEs | ||
.project | ||
.idea/ | ||
*.tmproj |
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,6 @@ | ||
apiVersion: v2 | ||
name: hello-rudr | ||
description: Demonstration of using Helm with Rudr, using the Python example. | ||
type: application | ||
version: 0.1.0 | ||
appVersion: 0.1.0 |
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 @@ | ||
This chart is an example of using Helm to install rudr applications. |
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,46 @@ | ||
{{/* vim: set filetype=mustache: */}} | ||
{{/* | ||
Expand the name of the chart. | ||
*/}} | ||
{{- define "hello-rudr.name" -}} | ||
{{/* - trunc 63 .Chart.Name | trimSuffix "-" - */}} | ||
{{ .Chart.name }} | ||
{{- 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). | ||
If release name contains chart name it will be used as a full name. | ||
*/}} | ||
{{- define "hello-rudr.fullname" -}} | ||
{{- if .Values.fullnameOverride -}} | ||
{{- .Values.fullnameOverride | trunc 63 | trimSuffix "-" -}} | ||
{{- else -}} | ||
{{- $name := default .Chart.Name .Values.nameOverride -}} | ||
{{- if contains $name .Release.Name -}} | ||
{{- .Release.Name | trunc 63 | trimSuffix "-" -}} | ||
{{- else -}} | ||
{{- printf "%s-%s" .Release.Name $name | trunc 63 | trimSuffix "-" -}} | ||
{{- end -}} | ||
{{- end -}} | ||
{{- end -}} | ||
|
||
{{/* | ||
Create chart name and version as used by the chart label. | ||
*/}} | ||
{{- define "hello-rudr.chart" -}} | ||
{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" -}} | ||
{{- end -}} | ||
|
||
{{/* | ||
Common labels | ||
*/}} | ||
{{- define "hello-rudr.labels" -}} | ||
app.kubernetes.io/name: {{ include "hello-rudr.name" . }} | ||
helm.sh/chart: {{ include "hello-rudr.chart" . }} | ||
app.kubernetes.io/instance: {{ .Release.Name }} | ||
{{- if .Chart.AppVersion }} | ||
app.kubernetes.io/version: {{ .Chart.AppVersion | quote }} | ||
{{- end }} | ||
app.kubernetes.io/managed-by: {{ .Release.Service }} | ||
{{- end -}} |
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,22 @@ | ||
kind: ApplicationConfiguration | ||
apiVersion: core.oam.dev/v1alpha1 | ||
metadata: | ||
name: "{{ .Release.Name }}" | ||
spec: | ||
components: | ||
- name: "{{ .Release.Name }}-{{ .Values.appVersion}}" | ||
instanceName: "{{ .Release.Name }}-{{ .Values.appVersion}}" | ||
parameterValues: | ||
- name: target | ||
value: "{{ .Values.target }}" | ||
- name: port | ||
value: "{{ .Values.port }}" | ||
traits: | ||
- name: ingress | ||
parameterValues: | ||
- name: hostname | ||
value: example.com | ||
- name: path | ||
value: / | ||
- name: service_port | ||
value: {{ .Values.port }} |
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,26 @@ | ||
apiVersion: core.oam.dev/v1alpha1 | ||
kind: ComponentSchematic | ||
metadata: | ||
name: "{{.Release.Name}}-{{.Values.appVersion}}" | ||
spec: | ||
name: helloworld-python | ||
workloadType: core.oam.dev/v1alpha1.Server | ||
containers: | ||
- name: foo | ||
image: oamdev/helloworld-python:v1 | ||
env: | ||
- name: TARGET | ||
fromParam: target | ||
- name: PORT | ||
fromParam: port | ||
ports: | ||
- type: tcp | ||
containerPort: 9999 | ||
name: http | ||
parameters: | ||
- name: target | ||
type: string | ||
default: World | ||
- name: port | ||
type: string | ||
default: "9999" |
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,8 @@ | ||
# Default values for hello-rudr. | ||
# This is a YAML-formatted file. | ||
# Declare variables to be passed into your templates. | ||
|
||
replicaCount: 1 | ||
appVersion: v1 | ||
target: Rudr | ||
port: "9999" |