|
|
|
@ -36,6 +36,8 @@ const (
|
|
|
|
|
ChartsDir = "charts"
|
|
|
|
|
// IgnorefileName is the name of the Helm ignore file.
|
|
|
|
|
IgnorefileName = ".helmignore"
|
|
|
|
|
// IngressFileName is the name of the example ingress file.
|
|
|
|
|
IngressFileName = "ingress.yaml"
|
|
|
|
|
// DeploymentName is the name of the example deployment file.
|
|
|
|
|
DeploymentName = "deployment.yaml"
|
|
|
|
|
// ServiceName is the name of the example service file.
|
|
|
|
@ -59,6 +61,19 @@ service:
|
|
|
|
|
type: ClusterIP
|
|
|
|
|
externalPort: 80
|
|
|
|
|
internalPort: 80
|
|
|
|
|
ingress:
|
|
|
|
|
enabled: false
|
|
|
|
|
# Used to create Ingress record (should used with service.type: ClusterIP).
|
|
|
|
|
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:
|
|
|
|
|
limits:
|
|
|
|
|
cpu: 100m
|
|
|
|
@ -92,6 +107,40 @@ const defaultIgnore = `# Patterns to ignore when building packages.
|
|
|
|
|
*.tmproj
|
|
|
|
|
`
|
|
|
|
|
|
|
|
|
|
const defaultIngress = `{{- if .Values.ingress.enabled -}}
|
|
|
|
|
{{- $serviceName := include "fullname" . -}}
|
|
|
|
|
{{- $servicePort := .Values.service.externalPort -}}
|
|
|
|
|
apiVersion: extensions/v1beta1
|
|
|
|
|
kind: Ingress
|
|
|
|
|
metadata:
|
|
|
|
|
name: {{ template "fullname" . }}
|
|
|
|
|
labels:
|
|
|
|
|
app: {{ template "fullname" . }}
|
|
|
|
|
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 -}}
|
|
|
|
|
`
|
|
|
|
|
|
|
|
|
|
const defaultDeployment = `apiVersion: extensions/v1beta1
|
|
|
|
|
kind: Deployment
|
|
|
|
|
metadata:
|
|
|
|
@ -141,7 +190,9 @@ spec:
|
|
|
|
|
`
|
|
|
|
|
|
|
|
|
|
const defaultNotes = `1. Get the application URL by running these commands:
|
|
|
|
|
{{- if contains "NodePort" .Values.service.type }}
|
|
|
|
|
{{- if .Values.ingress.hostname }}
|
|
|
|
|
http://{{- .Values.ingress.hostname }}
|
|
|
|
|
{{- else if contains "NodePort" .Values.service.type }}
|
|
|
|
|
export NODE_PORT=$(kubectl get --namespace {{ .Release.Namespace }} -o jsonpath="{.spec.ports[0].nodePort}" services {{ template "fullname" . }})
|
|
|
|
|
export NODE_IP=$(kubectl get nodes --namespace {{ .Release.Namespace }} -o jsonpath="{.items[0].status.addresses[0].address}")
|
|
|
|
|
echo http://$NODE_IP:$NODE_PORT/login
|
|
|
|
@ -247,6 +298,11 @@ func Create(chartfile *chart.Metadata, dir string) (string, error) {
|
|
|
|
|
path: filepath.Join(cdir, IgnorefileName),
|
|
|
|
|
content: []byte(defaultIgnore),
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
// ingress.yaml
|
|
|
|
|
path: filepath.Join(cdir, TemplatesDir, IngressFileName),
|
|
|
|
|
content: []byte(defaultIngress),
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
// deployment.yaml
|
|
|
|
|
path: filepath.Join(cdir, TemplatesDir, DeploymentName),
|
|
|
|
|