|
|
@ -53,6 +53,8 @@ const (
|
|
|
|
ServiceName = TemplatesDir + sep + "service.yaml"
|
|
|
|
ServiceName = TemplatesDir + sep + "service.yaml"
|
|
|
|
// ServiceAccountName is the name of the example serviceaccount file.
|
|
|
|
// ServiceAccountName is the name of the example serviceaccount file.
|
|
|
|
ServiceAccountName = TemplatesDir + sep + "serviceaccount.yaml"
|
|
|
|
ServiceAccountName = TemplatesDir + sep + "serviceaccount.yaml"
|
|
|
|
|
|
|
|
// HorizontalPodAutoscalerName is the name of the example hpa file.
|
|
|
|
|
|
|
|
HorizontalPodAutoscalerName = TemplatesDir + sep + "hpa.yaml"
|
|
|
|
// NotesName is the name of the example NOTES.txt file.
|
|
|
|
// NotesName is the name of the example NOTES.txt file.
|
|
|
|
NotesName = TemplatesDir + sep + "NOTES.txt"
|
|
|
|
NotesName = TemplatesDir + sep + "NOTES.txt"
|
|
|
|
// HelpersName is the name of the example helpers file.
|
|
|
|
// HelpersName is the name of the example helpers file.
|
|
|
@ -149,6 +151,13 @@ resources: {}
|
|
|
|
# cpu: 100m
|
|
|
|
# cpu: 100m
|
|
|
|
# memory: 128Mi
|
|
|
|
# memory: 128Mi
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
autoscaling:
|
|
|
|
|
|
|
|
enabled: false
|
|
|
|
|
|
|
|
minReplicas: 1
|
|
|
|
|
|
|
|
maxReplicas: 100
|
|
|
|
|
|
|
|
targetCPUUtilizationPercentage: 80
|
|
|
|
|
|
|
|
# targetMemoryUtilizationPercentage: 80
|
|
|
|
|
|
|
|
|
|
|
|
nodeSelector: {}
|
|
|
|
nodeSelector: {}
|
|
|
|
|
|
|
|
|
|
|
|
tolerations: []
|
|
|
|
tolerations: []
|
|
|
@ -231,7 +240,9 @@ metadata:
|
|
|
|
labels:
|
|
|
|
labels:
|
|
|
|
{{- include "<CHARTNAME>.labels" . | nindent 4 }}
|
|
|
|
{{- include "<CHARTNAME>.labels" . | nindent 4 }}
|
|
|
|
spec:
|
|
|
|
spec:
|
|
|
|
|
|
|
|
{{- if not .Values.autoscaling.enabled }}
|
|
|
|
replicas: {{ .Values.replicaCount }}
|
|
|
|
replicas: {{ .Values.replicaCount }}
|
|
|
|
|
|
|
|
{{- end }}
|
|
|
|
selector:
|
|
|
|
selector:
|
|
|
|
matchLabels:
|
|
|
|
matchLabels:
|
|
|
|
{{- include "<CHARTNAME>.selectorLabels" . | nindent 6 }}
|
|
|
|
{{- include "<CHARTNAME>.selectorLabels" . | nindent 6 }}
|
|
|
@ -312,6 +323,36 @@ metadata:
|
|
|
|
{{- end -}}
|
|
|
|
{{- end -}}
|
|
|
|
`
|
|
|
|
`
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const defaultHorizontalPodAutoscaler = `{{- if .Values.autoscaling.enabled }}
|
|
|
|
|
|
|
|
apiVersion: autoscaling/v2beta1
|
|
|
|
|
|
|
|
kind: HorizontalPodAutoscaler
|
|
|
|
|
|
|
|
metadata:
|
|
|
|
|
|
|
|
name: {{ include "<CHARTNAME>.fullname" . }}
|
|
|
|
|
|
|
|
labels:
|
|
|
|
|
|
|
|
{{- include "<CHARTNAME>.labels" . | nindent 4 }}
|
|
|
|
|
|
|
|
spec:
|
|
|
|
|
|
|
|
scaleTargetRef:
|
|
|
|
|
|
|
|
apiVersion: apps/v1
|
|
|
|
|
|
|
|
kind: Deployment
|
|
|
|
|
|
|
|
name: {{ include "<CHARTNAME>.fullname" . }}
|
|
|
|
|
|
|
|
minReplicas: {{ .Values.autoscaling.minReplicas }}
|
|
|
|
|
|
|
|
maxReplicas: {{ .Values.autoscaling.maxReplicas }}
|
|
|
|
|
|
|
|
metrics:
|
|
|
|
|
|
|
|
{{- if .Values.autoscaling.targetCPUUtilizationPercentage }}
|
|
|
|
|
|
|
|
- type: Resource
|
|
|
|
|
|
|
|
resource:
|
|
|
|
|
|
|
|
name: cpu
|
|
|
|
|
|
|
|
targetAverageUtilization: {{ .Values.autoscaling.targetCPUUtilizationPercentage }}
|
|
|
|
|
|
|
|
{{- end }}
|
|
|
|
|
|
|
|
{{- if .Values.autoscaling.targetMemoryUtilizationPercentage }}
|
|
|
|
|
|
|
|
- type: Resource
|
|
|
|
|
|
|
|
resource:
|
|
|
|
|
|
|
|
name: memory
|
|
|
|
|
|
|
|
targetAverageUtilization: {{ .Values.autoscaling.targetMemoryUtilizationPercentage }}
|
|
|
|
|
|
|
|
{{- end }}
|
|
|
|
|
|
|
|
{{- end }}
|
|
|
|
|
|
|
|
`
|
|
|
|
|
|
|
|
|
|
|
|
const defaultNotes = `1. Get the application URL by running these commands:
|
|
|
|
const defaultNotes = `1. Get the application URL by running these commands:
|
|
|
|
{{- if .Values.ingress.enabled }}
|
|
|
|
{{- if .Values.ingress.enabled }}
|
|
|
|
{{- range $host := .Values.ingress.hosts }}
|
|
|
|
{{- range $host := .Values.ingress.hosts }}
|
|
|
@ -526,6 +567,11 @@ func Create(name, dir string) (string, error) {
|
|
|
|
path: filepath.Join(cdir, ServiceAccountName),
|
|
|
|
path: filepath.Join(cdir, ServiceAccountName),
|
|
|
|
content: transform(defaultServiceAccount, name),
|
|
|
|
content: transform(defaultServiceAccount, name),
|
|
|
|
},
|
|
|
|
},
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
// hpa.yaml
|
|
|
|
|
|
|
|
path: filepath.Join(cdir, HorizontalPodAutoscalerName),
|
|
|
|
|
|
|
|
content: transform(defaultHorizontalPodAutoscaler, name),
|
|
|
|
|
|
|
|
},
|
|
|
|
{
|
|
|
|
{
|
|
|
|
// NOTES.txt
|
|
|
|
// NOTES.txt
|
|
|
|
path: filepath.Join(cdir, NotesName),
|
|
|
|
path: filepath.Join(cdir, NotesName),
|
|
|
|