mirror of
https://github.com/go-admin-team/go-admin.git
synced 2026-09-25 19:36:07 +00:00
The note told the reader the scheduler stood in the way of raising the replica count. It no longer does: one enabled job fires once however many pods there are, a pod that loses the lease stops scheduling, and one that exits hands the lease back rather than making its successor wait it out. The shared log volume still does stand in the way, and that is now the only thing the note asks for before the number goes up.
117 lines
4.1 KiB
YAML
117 lines
4.1 KiB
YAML
---
|
|
apiVersion: v1
|
|
kind: Service
|
|
metadata:
|
|
name: go-admin
|
|
labels:
|
|
app: go-admin
|
|
service: go-admin
|
|
spec:
|
|
ports:
|
|
- port: 8000
|
|
name: http
|
|
protocol: TCP
|
|
selector:
|
|
app: go-admin
|
|
---
|
|
apiVersion: apps/v1
|
|
kind: Deployment
|
|
metadata:
|
|
name: go-admin-v1
|
|
labels:
|
|
app: go-admin
|
|
version: v1
|
|
spec:
|
|
# One replica, and the drain window below buys nothing at one replica: there
|
|
# is nowhere to send the traffic this pod stops taking.
|
|
#
|
|
# The scheduler no longer stands in the way of raising this. Every pod takes
|
|
# a lease row in its own database (sys_job_lease) and only the holder
|
|
# registers the jobs, so one enabled job fires once however many pods there
|
|
# are; a pod that loses the lease stops scheduling, and one that exits hands
|
|
# it back so a successor starts without waiting out the lease. See #915.
|
|
#
|
|
# What still does stand in the way: the volume below is shared by every
|
|
# replica, and the log path in settings.yml lives on it, so a second pod
|
|
# appends to the same rotating file. Give each replica its own log
|
|
# destination before raising this.
|
|
replicas: 1
|
|
selector:
|
|
matchLabels:
|
|
app: go-admin
|
|
version: v1
|
|
template:
|
|
metadata:
|
|
labels:
|
|
app: go-admin
|
|
version: v1
|
|
spec:
|
|
containers:
|
|
- name: go-admin
|
|
image: registry.cn-shanghai.aliyuncs.com/go-admin-team/go-admin
|
|
imagePullPolicy: IfNotPresent
|
|
ports:
|
|
- containerPort: 8000
|
|
# Readiness answers "send me requests". It fails while the database or
|
|
# the cache is unreachable, so this pod stays out of the Service until
|
|
# the datastore settings.yml names is really there - which is a change
|
|
# from having no probe at all, where a pod with an unreachable database
|
|
# was still sent traffic.
|
|
#
|
|
# timeoutSeconds is 3 rather than the default 1 because the handler
|
|
# allows its checks 2 seconds (readyTimeout in
|
|
# app/other/router/monitor.go). At the default, a database that answers
|
|
# in 1.2s is recorded as a failed check while the handler is returning
|
|
# 200.
|
|
readinessProbe:
|
|
httpGet:
|
|
path: /api/v1/ready
|
|
port: 8000
|
|
periodSeconds: 5
|
|
timeoutSeconds: 3
|
|
failureThreshold: 3
|
|
# Liveness answers "restart me", which is a different question: a
|
|
# process whose database is unreachable does not want restarting, so
|
|
# this points at /health, which is a bare 200. Both probes skip the
|
|
# rate limiter - see exemptProbes in cmd/api/server.go - because a
|
|
# liveness probe that collects 429s under load gets the container
|
|
# restarted at the moment the deployment can least afford to lose it.
|
|
#
|
|
# initialDelaySeconds covers the migrations, which run before the
|
|
# listener opens.
|
|
livenessProbe:
|
|
httpGet:
|
|
path: /api/v1/health
|
|
port: 8000
|
|
initialDelaySeconds: 15
|
|
periodSeconds: 10
|
|
failureThreshold: 3
|
|
volumeMounts:
|
|
- name: go-admin
|
|
mountPath: /temp
|
|
- name: go-admin
|
|
mountPath: /static
|
|
- name: go-admin-config
|
|
mountPath: /config/
|
|
readOnly: true
|
|
# SIGKILL arrives when this is up, so it has to be longer than what the
|
|
# process spends shutting down: extend.shutdown's drain + server +
|
|
# cleanup, which settings.yml ships as 0 + 5 + 3. Raise drain here and
|
|
# this number has to follow, or the cleanup callbacks are cut off
|
|
# part-way through - checksilent's shutdown-budget-overruns-grace check
|
|
# is what notices.
|
|
#
|
|
# No preStop hook on purpose. A sleep there would be spent before the
|
|
# process is told anything, so BeginDraining never runs and /ready
|
|
# answers 200 for the whole of it - and it would be added to the budget
|
|
# above rather than replacing any of it.
|
|
terminationGracePeriodSeconds: 30
|
|
volumes:
|
|
- name: go-admin
|
|
persistentVolumeClaim:
|
|
claimName: go-admin
|
|
- name: go-admin-config
|
|
configMap:
|
|
name: settings-admin
|
|
---
|