mirror of https://github.com/helm/helm
Merge 8b9c3eae83
into edaef32491
commit
cfcac94fec
@ -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
|
@ -0,0 +1,4 @@
|
|||||||
|
apiVersion: v1
|
||||||
|
description: A guestbook Helm chart for Kubernetes.
|
||||||
|
name: guestbook
|
||||||
|
version: 0.1.0
|
@ -0,0 +1,68 @@
|
|||||||
|
# Guestbook
|
||||||
|
|
||||||
|
[Guestbook](https://github.com/kubernetes/examples/tree/master/guestbook) is a simple, multi-tier PHP-based web application that uses redis chart.
|
||||||
|
## TL;DR;
|
||||||
|
|
||||||
|
```console
|
||||||
|
$ helm install stable/guestbook
|
||||||
|
```
|
||||||
|
|
||||||
|
## Introduction
|
||||||
|
|
||||||
|
This chart bootstraps a [guestbook](https://github.com/kubernetes/examples/tree/master/guestbook) deployment on a [Kubernetes](http://kubernetes.io) cluster using the [Helm](https://helm.sh) package manager.
|
||||||
|
|
||||||
|
It also packages the [Bitnami Redis chart](https://github.com/kubernetes/charts/tree/master/stable/redis) which is required for bootstrapping a Redis deployment for the caching requirements of the guestbook application.
|
||||||
|
|
||||||
|
## Prerequisites
|
||||||
|
|
||||||
|
- Kubernetes 1.4+ with Beta APIs enabled
|
||||||
|
- PV provisioner support in the underlying infrastructure
|
||||||
|
|
||||||
|
## Installing the Chart
|
||||||
|
|
||||||
|
To install the chart with the release name `my-release`:
|
||||||
|
|
||||||
|
```console
|
||||||
|
$ helm install --name my-release stable/guestbook
|
||||||
|
```
|
||||||
|
|
||||||
|
The command deploys the guestbook on the Kubernetes cluster in the default configuration. The [configuration](#configuration) section lists the parameters that can be configured during installation.
|
||||||
|
|
||||||
|
> **Tip**: List all releases using `helm list`
|
||||||
|
|
||||||
|
## Uninstalling the Chart
|
||||||
|
|
||||||
|
To uninstall/delete the `my-release` deployment:
|
||||||
|
|
||||||
|
```console
|
||||||
|
$ helm delete my-release
|
||||||
|
```
|
||||||
|
|
||||||
|
The command removes all the Kubernetes components associated with the chart and deletes the release.
|
||||||
|
|
||||||
|
## Configuration
|
||||||
|
|
||||||
|
The following tables lists the configurable parameters of the WordPress chart and their default values.
|
||||||
|
|
||||||
|
| Parameter | Description | Default |
|
||||||
|
| ------------------------------- | ------------------------------- | ---------------------------------------------------------- |
|
||||||
|
| `image` | apapche-php image | `google-samples/gb-frontend:{VERSION}` |
|
||||||
|
| `imagePullPolicy` | Image pull policy | `IfNotPresent` |
|
||||||
|
| `nodeSelector` | Node labels for pod assignment | `{}` |
|
||||||
|
|
||||||
|
The above parameters map to the env variables defined in [bitnami/wordpress](http://github.com/bitnami/bitnami-docker-wordpress). For more information please refer to the [bitnami/wordpress](http://github.com/bitnami/bitnami-docker-wordpress) image documentation.
|
||||||
|
|
||||||
|
Specify each parameter using the `--set key=value[,key=value]` argument to `helm install`. For example,
|
||||||
|
|
||||||
|
```console
|
||||||
|
$ helm install --name my-release \
|
||||||
|
--set redis.usePassword=false \
|
||||||
|
stable/guestbook
|
||||||
|
```
|
||||||
|
|
||||||
|
```console
|
||||||
|
$ helm install --name my-release -f values.yaml stable/guestbook
|
||||||
|
```
|
||||||
|
|
||||||
|
> **Tip**: You can use the default [values.yaml](values.yaml)
|
||||||
|
|
Binary file not shown.
@ -0,0 +1,6 @@
|
|||||||
|
dependencies:
|
||||||
|
- name: redis
|
||||||
|
repository: https://kubernetes-charts.storage.googleapis.com/
|
||||||
|
version: 1.1.4
|
||||||
|
digest: sha256:ca7a601363b96fed2bf4774ef8fbc5cdbdb91a0fb5bc083192072e39eee844ae
|
||||||
|
generated: 2017-12-31T21:26:54.89952-08:00
|
@ -0,0 +1,7 @@
|
|||||||
|
dependencies:
|
||||||
|
- name: redis
|
||||||
|
version: 1.1.4
|
||||||
|
repository: https://kubernetes-charts.storage.googleapis.com/
|
||||||
|
condition: redis.enabled
|
||||||
|
tags:
|
||||||
|
- redis-database
|
@ -0,0 +1,19 @@
|
|||||||
|
1. Get the application URL by running these commands:
|
||||||
|
{{- if .Values.ingress.enabled }}
|
||||||
|
{{- range .Values.ingress.hosts }}
|
||||||
|
http://{{ . }}
|
||||||
|
{{- end }}
|
||||||
|
{{- else if contains "NodePort" .Values.service.frontend.type }}
|
||||||
|
export NODE_PORT=$(kubectl get --namespace {{ .Release.Namespace }} -o jsonpath="{.spec.ports[0].nodePort}" services {{ template "guestbook.fullname" . }})
|
||||||
|
export NODE_IP=$(kubectl get nodes --namespace {{ .Release.Namespace }} -o jsonpath="{.items[0].status.addresses[0].address}")
|
||||||
|
echo http://$NODE_IP:$NODE_PORT
|
||||||
|
{{- else if contains "LoadBalancer" .Values.service.frontend.type }}
|
||||||
|
NOTE: It may take a few minutes for the LoadBalancer IP to be available.
|
||||||
|
You can watch the status of by running 'kubectl get svc -w {{ template "guestbook.fullname" . }}'
|
||||||
|
export SERVICE_IP=$(kubectl get svc --namespace {{ .Release.Namespace }} {{ template "guestbook.fullname" . }} -o jsonpath='{.status.loadBalancer.ingress[0].ip}')
|
||||||
|
echo http://$SERVICE_IP:{{ .Values.service.externalPort }}
|
||||||
|
{{- else if contains "ClusterIP" .Values.service.type }}
|
||||||
|
export POD_NAME=$(kubectl get pods --namespace {{ .Release.Namespace }} -l "app={{ template "guestbook.name" . }},release={{ .Release.Name }}" -o jsonpath="{.items[0].metadata.name}")
|
||||||
|
echo "Visit http://127.0.0.1:8080 to use your application"
|
||||||
|
kubectl port-forward $POD_NAME 8080:{{ .Values.service.internalPort }}
|
||||||
|
{{- end }}
|
@ -0,0 +1,19 @@
|
|||||||
|
{{/* vim: set filetype=mustache: */}}
|
||||||
|
{{/*
|
||||||
|
Expand the name of the chart.
|
||||||
|
*/}}
|
||||||
|
{{- define "guestbook.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 "guestbook.fullname" -}}
|
||||||
|
{{- $name := default .Chart.Name .Values.nameOverride -}}
|
||||||
|
{{- printf "%s-%s" .Release.Name $name | trunc 63 | trimSuffix "-" -}}
|
||||||
|
{{- end -}}
|
||||||
|
{{- define "redis.fullname" -}}
|
||||||
|
{{- printf "%s-%s" .Release.Name "redis" | trunc 63 | trimSuffix "-" -}}
|
||||||
|
{{- end -}}
|
@ -0,0 +1,52 @@
|
|||||||
|
apiVersion: extensions/v1beta1
|
||||||
|
kind: Deployment
|
||||||
|
metadata:
|
||||||
|
name: {{ template "guestbook.fullname" . }}
|
||||||
|
labels:
|
||||||
|
app: {{ template "guestbook.name" . }}
|
||||||
|
chart: {{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }}
|
||||||
|
release: {{ .Release.Name }}
|
||||||
|
heritage: {{ .Release.Service }}
|
||||||
|
spec:
|
||||||
|
replicas: {{ .Values.replicaCount }}
|
||||||
|
template:
|
||||||
|
metadata:
|
||||||
|
labels:
|
||||||
|
app: {{ template "guestbook.name" . }}
|
||||||
|
release: {{ .Release.Name }}
|
||||||
|
spec:
|
||||||
|
containers:
|
||||||
|
- name: {{ .Chart.Name }}
|
||||||
|
image: "{{ .Values.image.repository }}:{{ .Values.image.tag }}"
|
||||||
|
imagePullPolicy: {{ .Values.image.pullPolicy }}
|
||||||
|
ports:
|
||||||
|
- containerPort: {{ .Values.service.frontend.internalPort }}
|
||||||
|
livenessProbe:
|
||||||
|
httpGet:
|
||||||
|
path: /
|
||||||
|
port: {{ .Values.service.frontend.internalPort }}
|
||||||
|
readinessProbe:
|
||||||
|
httpGet:
|
||||||
|
path: /
|
||||||
|
port: {{ .Values.service.frontend.internalPort }}
|
||||||
|
resources:
|
||||||
|
{{ toYaml .Values.resources | indent 12 }}
|
||||||
|
{{- if .Values.nodeSelector }}
|
||||||
|
nodeSelector:
|
||||||
|
{{ toYaml .Values.nodeSelector | indent 8 }}
|
||||||
|
{{- end }}
|
||||||
|
env:
|
||||||
|
- name: {{"GET_HOSTS_FROM"}}
|
||||||
|
value: {{"env"}}
|
||||||
|
- name: {{"REDIS_MASTER_SERVICE_HOST"}}
|
||||||
|
{{- if .Values.redis.enabled }}
|
||||||
|
value: {{ template "redis.fullname" . }}
|
||||||
|
{{- else }}
|
||||||
|
value: {{ .Values.externalDatabase.host | quote }}
|
||||||
|
{{- end }}
|
||||||
|
- name: {{"REDIS_SLAVE_SERVICE_HOST"}}
|
||||||
|
{{- if .Values.redis.enabled }}
|
||||||
|
value: {{ template "redis.fullname" . }}
|
||||||
|
{{- else }}
|
||||||
|
value: {{ .Values.externalDatabase.host | quote }}
|
||||||
|
{{- end }}
|
@ -0,0 +1,32 @@
|
|||||||
|
{{- if .Values.ingress.enabled -}}
|
||||||
|
{{- $serviceName := include "guestbook.fullname" . -}}
|
||||||
|
{{- $servicePort := .Values.service.externalPort -}}
|
||||||
|
apiVersion: extensions/v1beta1
|
||||||
|
kind: Ingress
|
||||||
|
metadata:
|
||||||
|
name: {{ template "guestbook.fullname" . }}
|
||||||
|
labels:
|
||||||
|
app: {{ template "guestbook.name" . }}
|
||||||
|
chart: {{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }}
|
||||||
|
release: {{ .Release.Name }}
|
||||||
|
heritage: {{ .Release.Service }}
|
||||||
|
annotations:
|
||||||
|
{{- range $key, $value := .Values.ingress.annotations }}
|
||||||
|
{{ $key }}: {{ $value | quote }}
|
||||||
|
{{- end }}
|
||||||
|
spec:
|
||||||
|
rules:
|
||||||
|
{{- range $host := .Values.ingress.hosts }}
|
||||||
|
- host: {{ $host }}
|
||||||
|
http:
|
||||||
|
paths:
|
||||||
|
- path: /
|
||||||
|
backend:
|
||||||
|
serviceName: {{ $serviceName }}
|
||||||
|
servicePort: {{ $servicePort }}
|
||||||
|
{{- end -}}
|
||||||
|
{{- if .Values.ingress.tls }}
|
||||||
|
tls:
|
||||||
|
{{ toYaml .Values.ingress.tls | indent 4 }}
|
||||||
|
{{- end -}}
|
||||||
|
{{- end -}}
|
@ -0,0 +1,19 @@
|
|||||||
|
apiVersion: v1
|
||||||
|
kind: Service
|
||||||
|
metadata:
|
||||||
|
name: {{ template "guestbook.fullname" . }}
|
||||||
|
labels:
|
||||||
|
app: {{ template "guestbook.name" . }}
|
||||||
|
chart: {{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }}
|
||||||
|
release: {{ .Release.Name }}
|
||||||
|
heritage: {{ .Release.Service }}
|
||||||
|
spec:
|
||||||
|
type: {{ .Values.service.frontend.type }}
|
||||||
|
ports:
|
||||||
|
- port: {{ .Values.service.frontend.externalPort }}
|
||||||
|
targetPort: {{ .Values.service.frontend.internalPort }}
|
||||||
|
protocol: TCP
|
||||||
|
name: {{ .Values.service.name }}
|
||||||
|
selector:
|
||||||
|
app: {{ template "guestbook.name" . }}
|
||||||
|
release: {{ .Release.Name }}
|
@ -0,0 +1,44 @@
|
|||||||
|
# Default values for guestbook.
|
||||||
|
# This is a YAML-formatted file.
|
||||||
|
# Declare variables to be passed into your templates.
|
||||||
|
replicaCount: 1
|
||||||
|
image:
|
||||||
|
repository: gcr.io/google-samples/gb-frontend
|
||||||
|
tag: v4
|
||||||
|
pullPolicy: IfNotPresent
|
||||||
|
service:
|
||||||
|
frontend:
|
||||||
|
type: LoadBalancer
|
||||||
|
externalPort: 80
|
||||||
|
internalPort: 80
|
||||||
|
selector:
|
||||||
|
app: guestbook
|
||||||
|
tier: frontend
|
||||||
|
ingress:
|
||||||
|
enabled: false
|
||||||
|
# Used to create an Ingress record.
|
||||||
|
#hosts:
|
||||||
|
# - chart-example.local
|
||||||
|
annotations:
|
||||||
|
# kubernetes.io/ingress.class: nginx
|
||||||
|
# kubernetes.io/tls-acme: "true"
|
||||||
|
tls:
|
||||||
|
# Secrets must be manually created in the namespace.
|
||||||
|
# - secretName: chart-example-tls
|
||||||
|
# hosts:
|
||||||
|
# - chart-example.local
|
||||||
|
resources:
|
||||||
|
# We usually recommend not to specify default resources and to leave this as a conscious
|
||||||
|
# choice for the user. This also increases chances charts run on environments with little
|
||||||
|
# resources, such as Minikube. If you do want to specify resources, uncomment the following
|
||||||
|
# lines, adjust them as necessary, and remove the curly braces after 'resources:'.
|
||||||
|
limits:
|
||||||
|
cpu: 100m
|
||||||
|
memory: 128Mi
|
||||||
|
requests:
|
||||||
|
cpu: 100m
|
||||||
|
memory: 128Mi
|
||||||
|
redis:
|
||||||
|
enabled: true
|
||||||
|
externalDatabase:
|
||||||
|
host: localhost
|
Loading…
Reference in new issue