Update example

pull/2845/head
dhilipkumars 8 years ago
parent 3c3dcf8dfa
commit a23bc20edc

@ -2,7 +2,7 @@
{{/* {{/*
Expand the name of the chart. Expand the name of the chart.
*/}} */}}
{{- define "name" -}} {{- define "alpine.name" -}}
{{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" -}} {{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" -}}
{{- end -}} {{- end -}}
@ -10,7 +10,7 @@ Expand the name of the chart.
Create a default fully qualified app name. 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). We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec).
*/}} */}}
{{- define "fullname" -}} {{- define "alpine.fullname" -}}
{{- $name := default .Chart.Name .Values.nameOverride -}} {{- $name := default .Chart.Name .Values.nameOverride -}}
{{- printf "%s-%s" .Release.Name $name | trunc 63 | trimSuffix "-" -}} {{- printf "%s-%s" .Release.Name $name | trunc 63 | trimSuffix "-" -}}
{{- end -}} {{- end -}}

@ -1,7 +1,7 @@
apiVersion: v1 apiVersion: v1
kind: Pod kind: Pod
metadata: metadata:
name: {{ template "fullname" . }} name: {{ template "alpine.fullname" . }}
labels: labels:
# The "heritage" label is used to track which tool deployed a given chart. # 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 # It is useful for admins who want to see what releases a particular tool
@ -12,7 +12,7 @@ metadata:
release: {{ .Release.Name }} release: {{ .Release.Name }}
# This makes it easy to audit chart usage. # This makes it easy to audit chart usage.
chart: {{ .Chart.Name }}-{{ .Chart.Version }} chart: {{ .Chart.Name }}-{{ .Chart.Version }}
app: {{ template "name" . }} app: {{ template "alpine.name" . }}
spec: spec:
# This shows how to use a simple value. This will look for a passed-in value called restartPolicy. # This shows how to use a simple value. This will look for a passed-in value called restartPolicy.
restartPolicy: {{ .Values.restartPolicy }} restartPolicy: {{ .Values.restartPolicy }}

@ -2,7 +2,7 @@
{{/* {{/*
Expand the name of the chart. Expand the name of the chart.
*/}} */}}
{{- define "name" -}} {{- define "nginx.name" -}}
{{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" -}} {{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" -}}
{{- end -}} {{- end -}}
@ -10,7 +10,7 @@ Expand the name of the chart.
Create a default fully qualified app name. 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). We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec).
*/}} */}}
{{- define "fullname" -}} {{- define "nginx.fullname" -}}
{{- $name := default .Chart.Name .Values.nameOverride -}} {{- $name := default .Chart.Name .Values.nameOverride -}}
{{- printf "%s-%s" .Release.Name $name | trunc 63 | trimSuffix "-" -}} {{- printf "%s-%s" .Release.Name $name | trunc 63 | trimSuffix "-" -}}
{{- end -}} {{- end -}}

@ -2,12 +2,12 @@
apiVersion: v1 apiVersion: v1
kind: ConfigMap kind: ConfigMap
metadata: metadata:
name: {{ template "fullname" . }} name: {{ template "nginx.fullname" . }}
labels: labels:
heritage: {{ .Release.Service }} heritage: {{ .Release.Service }}
release: {{ .Release.Name }} release: {{ .Release.Name }}
chart: {{ .Chart.Name }}-{{ .Chart.Version }} chart: {{ .Chart.Name }}-{{ .Chart.Version }}
app: {{ template "name" . }} app: {{ template "nginx.name" . }}
data: data:
# When the config map is mounted as a volume, these will be created as files. # When the config map is mounted as a volume, these will be created as files.
index.html: {{ .Values.index | quote }} index.html: {{ .Values.index | quote }}

@ -4,7 +4,7 @@ metadata:
# This uses a "fullname" template (see _helpers) # This uses a "fullname" template (see _helpers)
# Basing names on .Release.Name means that the same chart can be installed # Basing names on .Release.Name means that the same chart can be installed
# multiple times into the same namespace. # multiple times into the same namespace.
name: {{ template "fullname" . }} name: {{ template "nginx.fullname" . }}
labels: labels:
# The "heritage" label is used to track which tool deployed a given chart. # 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 # It is useful for admins who want to see what releases a particular tool
@ -15,7 +15,7 @@ metadata:
release: {{ .Release.Name }} release: {{ .Release.Name }}
# This makes it easy to audit chart usage. # This makes it easy to audit chart usage.
chart: {{ .Chart.Name }}-{{ .Chart.Version }} chart: {{ .Chart.Name }}-{{ .Chart.Version }}
app: {{ template "name" . }} app: {{ template "nginx.name" . }}
spec: spec:
replicas: {{ .Values.replicaCount }} replicas: {{ .Values.replicaCount }}
template: template:
@ -26,11 +26,11 @@ spec:
{{ toYaml .Values.podAnnotations | indent 8 }} {{ toYaml .Values.podAnnotations | indent 8 }}
{{- end }} {{- end }}
labels: labels:
app: {{ template "name" . }} app: {{ template "nginx.name" . }}
release: {{ .Release.Name }} release: {{ .Release.Name }}
spec: spec:
containers: containers:
- name: {{ template "name" . }} - name: {{ template "nginx.name" . }}
image: "{{ .Values.image.repository }}:{{ .Values.image.tag }}" image: "{{ .Values.image.repository }}:{{ .Values.image.tag }}"
imagePullPolicy: {{ .Values.image.pullPolicy }} imagePullPolicy: {{ .Values.image.pullPolicy }}
ports: ports:
@ -54,4 +54,4 @@ spec:
volumes: volumes:
- name: wwwdata-volume - name: wwwdata-volume
configMap: configMap:
name: {{ template "fullname" . }} name: {{ template "nginx.fullname" . }}

@ -1,7 +1,7 @@
apiVersion: batch/v1 apiVersion: batch/v1
kind: Job kind: Job
metadata: metadata:
name: {{ template "fullname" . }} name: {{ template "nginx.fullname" . }}
labels: labels:
# The "heritage" label is used to track which tool deployed a given chart. # 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 # It is useful for admins who want to see what releases a particular tool
@ -12,7 +12,7 @@ metadata:
release: {{ .Release.Name }} release: {{ .Release.Name }}
# This makes it easy to audit chart usage. # This makes it easy to audit chart usage.
chart: {{ .Chart.Name }}-{{ .Chart.Version }} chart: {{ .Chart.Name }}-{{ .Chart.Version }}
app: {{ template "name" . }} app: {{ template "nginx.name" . }}
annotations: annotations:
# This is what defines this resource as a hook. Without this line, the # This is what defines this resource as a hook. Without this line, the
# job is considered part of the release. # job is considered part of the release.
@ -20,10 +20,10 @@ metadata:
spec: spec:
template: template:
metadata: metadata:
name: {{ template "fullname" . }} name: {{ template "nginx.fullname" . }}
labels: labels:
release: {{ .Release.Name }} release: {{ .Release.Name }}
app: {{ template "name" . }} app: {{ template "nginx.name" . }}
spec: spec:
# This shows how to use a simple value. This will look for a passed-in value # This shows how to use a simple value. This will look for a passed-in value
# called restartPolicy. If it is not found, it will use the default value. # called restartPolicy. If it is not found, it will use the default value.

@ -3,12 +3,12 @@
apiVersion: v1 apiVersion: v1
kind: Secret kind: Secret
metadata: metadata:
name: {{ template "fullname" . }} name: {{ template "nginx.fullname" . }}
labels: labels:
heritage: {{ .Release.Service }} heritage: {{ .Release.Service }}
release: {{ .Release.Name }} release: {{ .Release.Name }}
chart: {{ .Chart.Name }}-{{ .Chart.Version }} chart: {{ .Chart.Name }}-{{ .Chart.Version }}
app: {{ template "name" . }} app: {{ template "nginx.name" . }}
# This declares the resource to be a hook. By convention, we also name the # This declares the resource to be a hook. By convention, we also name the
# file "pre-install-XXX.yaml", but Helm itself doesn't care about file names. # file "pre-install-XXX.yaml", but Helm itself doesn't care about file names.
annotations: annotations:

@ -1,12 +1,12 @@
apiVersion: v1 apiVersion: v1
kind: Pod kind: Pod
metadata: metadata:
name: "{{ template "fullname" . }}-service-test" name: "{{ template "nginx.fullname" . }}-service-test"
labels: labels:
heritage: {{ .Release.Service }} heritage: {{ .Release.Service }}
release: {{ .Release.Name }} release: {{ .Release.Name }}
chart: {{ .Chart.Name }}-{{ .Chart.Version }} chart: {{ .Chart.Name }}-{{ .Chart.Version }}
app: {{ template "name" . }} app: {{ template "nginx.name" . }}
annotations: annotations:
"helm.sh/hook": test-success "helm.sh/hook": test-success
spec: spec:
@ -14,5 +14,5 @@ spec:
- name: curl - name: curl
image: radial/busyboxplus:curl image: radial/busyboxplus:curl
command: ['curl'] command: ['curl']
args: ['{{ template "fullname" . }}:{{ .Values.service.port }}'] args: ['{{ template "nginx.fullname" . }}:{{ .Values.service.port }}']
restartPolicy: Never restartPolicy: Never

@ -6,11 +6,11 @@ metadata:
{{ toYaml .Values.service.annotations | indent 4 }} {{ toYaml .Values.service.annotations | indent 4 }}
{{- end }} {{- end }}
labels: labels:
app: {{ template "name" . }} app: {{ template "nginx.name" . }}
chart: {{ .Chart.Name }}-{{ .Chart.Version }} chart: {{ .Chart.Name }}-{{ .Chart.Version }}
heritage: {{ .Release.Service }} heritage: {{ .Release.Service }}
release: {{ .Release.Name }} release: {{ .Release.Name }}
name: {{ template "fullname" . }} name: {{ template "nginx.fullname" . }}
spec: spec:
# Provides options for the service so chart users have the full choice # Provides options for the service so chart users have the full choice
type: "{{ .Values.service.type }}" type: "{{ .Values.service.type }}"
@ -35,5 +35,5 @@ spec:
nodePort: {{ .Values.service.nodePort }} nodePort: {{ .Values.service.nodePort }}
{{- end }} {{- end }}
selector: selector:
app: {{ template "name" . }} app: {{ template "nginx.name" . }}
release: {{ .Release.Name }} release: {{ .Release.Name }}

Loading…
Cancel
Save