deploy: add static deployment, add resource reservations/limits
This commit is contained in:
parent
174472bb45
commit
7fb48fde6d
|
@ -28,8 +28,10 @@ spec:
|
||||||
- name: {{ .Chart.Name }}
|
- name: {{ .Chart.Name }}
|
||||||
image: "docker.beryju.org/passbook/server:{{ .Values.image.tag }}"
|
image: "docker.beryju.org/passbook/server:{{ .Values.image.tag }}"
|
||||||
imagePullPolicy: IfNotPresent
|
imagePullPolicy: IfNotPresent
|
||||||
command: ["/bin/sh","-c"]
|
command:
|
||||||
args: ["./manage.py migrate && ./manage.py app_gw_web"]
|
- ./manage.py
|
||||||
|
args:
|
||||||
|
- app_gw_web
|
||||||
ports:
|
ports:
|
||||||
- name: http
|
- name: http
|
||||||
containerPort: 8000
|
containerPort: 8000
|
||||||
|
@ -52,16 +54,9 @@ spec:
|
||||||
- name: Host
|
- name: Host
|
||||||
value: kubernetes-healthcheck-host
|
value: kubernetes-healthcheck-host
|
||||||
resources:
|
resources:
|
||||||
{{ toYaml .Values.resources | indent 12 }}
|
requests:
|
||||||
{{- with .Values.nodeSelector }}
|
cpu: 150m
|
||||||
nodeSelector:
|
memory: 300M
|
||||||
{{ toYaml . | indent 8 }}
|
limits:
|
||||||
{{- end }}
|
cpu: 500m
|
||||||
{{- with .Values.affinity }}
|
memory: 500M
|
||||||
affinity:
|
|
||||||
{{ toYaml . | indent 8 }}
|
|
||||||
{{- end }}
|
|
||||||
{{- with .Values.tolerations }}
|
|
||||||
tolerations:
|
|
||||||
{{ toYaml . | indent 8 }}
|
|
||||||
{{- end }}
|
|
|
@ -1,6 +1,5 @@
|
||||||
{{- if .Values.ingress.enabled -}}
|
{{- if .Values.ingress.enabled -}}
|
||||||
{{- $fullName := include "passbook.fullname" . -}}
|
{{- $fullName := include "passbook.fullname" . -}}
|
||||||
{{- $ingressPath := .Values.ingress.path -}}
|
|
||||||
apiVersion: extensions/v1beta1
|
apiVersion: extensions/v1beta1
|
||||||
kind: Ingress
|
kind: Ingress
|
||||||
metadata:
|
metadata:
|
||||||
|
@ -30,16 +29,20 @@ spec:
|
||||||
- host: {{ . | quote }}
|
- host: {{ . | quote }}
|
||||||
http:
|
http:
|
||||||
paths:
|
paths:
|
||||||
- path: {{ $ingressPath }}
|
- path: /
|
||||||
backend:
|
backend:
|
||||||
serviceName: {{ $fullName }}-web
|
serviceName: {{ $fullName }}-web
|
||||||
servicePort: http
|
servicePort: http
|
||||||
|
- path: /static/
|
||||||
|
backend:
|
||||||
|
serviceName: {{ $fullname }}-static
|
||||||
|
servicePort: http
|
||||||
{{- end }}
|
{{- end }}
|
||||||
{{- range .Values.ingress.app_gw_hosts }}
|
{{- range .Values.ingress.app_gw_hosts }}
|
||||||
- host: {{ . | quote }}
|
- host: {{ . | quote }}
|
||||||
http:
|
http:
|
||||||
paths:
|
paths:
|
||||||
- path: {{ $ingressPath }}
|
- path: /
|
||||||
backend:
|
backend:
|
||||||
serviceName: {{ $fullName }}-appgw
|
serviceName: {{ $fullName }}-appgw
|
||||||
servicePort: http
|
servicePort: http
|
56
helm/passbook/templates/static-deployment.yaml
Normal file
56
helm/passbook/templates/static-deployment.yaml
Normal file
|
@ -0,0 +1,56 @@
|
||||||
|
apiVersion: apps/v1beta2
|
||||||
|
kind: Deployment
|
||||||
|
metadata:
|
||||||
|
name: {{ include "passbook.fullname" . }}-static
|
||||||
|
labels:
|
||||||
|
app.kubernetes.io/name: {{ include "passbook.name" . }}
|
||||||
|
helm.sh/chart: {{ include "passbook.chart" . }}
|
||||||
|
app.kubernetes.io/instance: {{ .Release.Name }}
|
||||||
|
app.kubernetes.io/managed-by: {{ .Release.Service }}
|
||||||
|
spec:
|
||||||
|
selector:
|
||||||
|
matchLabels:
|
||||||
|
app.kubernetes.io/name: {{ include "passbook.name" . }}
|
||||||
|
app.kubernetes.io/instance: {{ .Release.Name }}
|
||||||
|
template:
|
||||||
|
metadata:
|
||||||
|
labels:
|
||||||
|
app.kubernetes.io/name: {{ include "passbook.name" . }}
|
||||||
|
app.kubernetes.io/instance: {{ .Release.Name }}
|
||||||
|
k8s.passbook.io/component: static
|
||||||
|
annotations:
|
||||||
|
prometheus.io/scrape: "true"
|
||||||
|
prometheus.io/port: '9113'
|
||||||
|
field.cattle.io/workloadMetrics: '[{"path":"/metrics","port":9113,"schema":"HTTP"}]'
|
||||||
|
spec:
|
||||||
|
containers:
|
||||||
|
- name: {{ .Chart.Name }}-static-prometheus
|
||||||
|
image: nginx/nginx-prometheus-exporter:0.4.1
|
||||||
|
imagePullPolicy: IfNotPresent
|
||||||
|
- name: {{ .Chart.Name }}-static
|
||||||
|
image: "docker.beryju.org/passbook/static:{{ .Values.image.tag }}"
|
||||||
|
imagePullPolicy: IfNotPresent
|
||||||
|
ports:
|
||||||
|
- name: http
|
||||||
|
containerPort: 80
|
||||||
|
protocol: TCP
|
||||||
|
livenessProbe:
|
||||||
|
initialDelaySeconds: 10
|
||||||
|
timeoutSeconds: 5
|
||||||
|
httpGet:
|
||||||
|
path: /_/healthz
|
||||||
|
port: http
|
||||||
|
readinessProbe:
|
||||||
|
initialDelaySeconds: 10
|
||||||
|
timeoutSeconds: 5
|
||||||
|
httpGet:
|
||||||
|
path: /_/healthz
|
||||||
|
port: http
|
||||||
|
resources:
|
||||||
|
requests:
|
||||||
|
cpu: 10m
|
||||||
|
memory: 10M
|
||||||
|
limits:
|
||||||
|
cpu: 20m
|
||||||
|
memory: 20M
|
||||||
|
|
21
helm/passbook/templates/static-service.yaml
Normal file
21
helm/passbook/templates/static-service.yaml
Normal file
|
@ -0,0 +1,21 @@
|
||||||
|
apiVersion: v1
|
||||||
|
kind: Service
|
||||||
|
metadata:
|
||||||
|
name: {{ include "passbook.fullname" . }}-static
|
||||||
|
labels:
|
||||||
|
app.kubernetes.io/name: {{ include "passbook.name" . }}
|
||||||
|
helm.sh/chart: {{ include "passbook.chart" . }}
|
||||||
|
app.kubernetes.io/instance: {{ .Release.Name }}
|
||||||
|
app.kubernetes.io/managed-by: {{ .Release.Service }}
|
||||||
|
k8s.passbook.io/component: static
|
||||||
|
spec:
|
||||||
|
type: ClusterIP
|
||||||
|
ports:
|
||||||
|
- port: 80
|
||||||
|
targetPort: http
|
||||||
|
protocol: TCP
|
||||||
|
name: http
|
||||||
|
selector:
|
||||||
|
app.kubernetes.io/name: {{ include "passbook.name" . }}
|
||||||
|
app.kubernetes.io/instance: {{ .Release.Name }}
|
||||||
|
k8s.passbook.io/component: static
|
|
@ -24,12 +24,24 @@ spec:
|
||||||
- name: config-volume
|
- name: config-volume
|
||||||
configMap:
|
configMap:
|
||||||
name: {{ include "passbook.fullname" . }}-config
|
name: {{ include "passbook.fullname" . }}-config
|
||||||
|
initContainers:
|
||||||
|
- name: passbook-database-migrations
|
||||||
|
image: "docker.beryju.org/passbook/server:{{ .Values.image.tag }}"
|
||||||
|
command:
|
||||||
|
- ./manage.py
|
||||||
|
args:
|
||||||
|
- migrate
|
||||||
|
volumeMounts:
|
||||||
|
- mountPath: /etc/passbook
|
||||||
|
name: config-volume
|
||||||
containers:
|
containers:
|
||||||
- name: {{ .Chart.Name }}
|
- name: {{ .Chart.Name }}
|
||||||
image: "docker.beryju.org/passbook/server:{{ .Values.image.tag }}"
|
image: "docker.beryju.org/passbook/server:{{ .Values.image.tag }}"
|
||||||
imagePullPolicy: IfNotPresent
|
imagePullPolicy: IfNotPresent
|
||||||
command: ["/bin/sh","-c"]
|
command:
|
||||||
args: ["./manage.py migrate && ./manage.py web"]
|
- ./manage.py
|
||||||
|
args:
|
||||||
|
- web
|
||||||
ports:
|
ports:
|
||||||
- name: http
|
- name: http
|
||||||
containerPort: 8000
|
containerPort: 8000
|
||||||
|
@ -52,16 +64,9 @@ spec:
|
||||||
- name: Host
|
- name: Host
|
||||||
value: kubernetes-healthcheck-host
|
value: kubernetes-healthcheck-host
|
||||||
resources:
|
resources:
|
||||||
{{ toYaml .Values.resources | indent 12 }}
|
requests:
|
||||||
{{- with .Values.nodeSelector }}
|
cpu: 50m
|
||||||
nodeSelector:
|
memory: 150M
|
||||||
{{ toYaml . | indent 8 }}
|
limits:
|
||||||
{{- end }}
|
cpu: 200m
|
||||||
{{- with .Values.affinity }}
|
memory: 300M
|
||||||
affinity:
|
|
||||||
{{ toYaml . | indent 8 }}
|
|
||||||
{{- end }}
|
|
||||||
{{- with .Values.tolerations }}
|
|
||||||
tolerations:
|
|
||||||
{{ toYaml . | indent 8 }}
|
|
||||||
{{- end }}
|
|
|
@ -28,7 +28,10 @@ spec:
|
||||||
- name: {{ .Chart.Name }}
|
- name: {{ .Chart.Name }}
|
||||||
image: "docker.beryju.org/passbook/server:{{ .Values.image.tag }}"
|
image: "docker.beryju.org/passbook/server:{{ .Values.image.tag }}"
|
||||||
imagePullPolicy: IfNotPresent
|
imagePullPolicy: IfNotPresent
|
||||||
command: ["./manage.py", "worker"]
|
command:
|
||||||
|
- ./manage.py
|
||||||
|
args:
|
||||||
|
- worker
|
||||||
ports:
|
ports:
|
||||||
- name: http
|
- name: http
|
||||||
containerPort: 8000
|
containerPort: 8000
|
||||||
|
@ -37,16 +40,9 @@ spec:
|
||||||
- mountPath: /etc/passbook
|
- mountPath: /etc/passbook
|
||||||
name: config-volume
|
name: config-volume
|
||||||
resources:
|
resources:
|
||||||
{{ toYaml .Values.resources | indent 12 }}
|
requests:
|
||||||
{{- with .Values.nodeSelector }}
|
cpu: 150m
|
||||||
nodeSelector:
|
memory: 400M
|
||||||
{{ toYaml . | indent 8 }}
|
limits:
|
||||||
{{- end }}
|
cpu: 300m
|
||||||
{{- with .Values.affinity }}
|
memory: 600M
|
||||||
affinity:
|
|
||||||
{{ toYaml . | indent 8 }}
|
|
||||||
{{- end }}
|
|
||||||
{{- with .Values.tolerations }}
|
|
||||||
tolerations:
|
|
||||||
{{ toYaml . | indent 8 }}
|
|
||||||
{{- end }}
|
|
Reference in a new issue