128 lines
4.4 KiB
Text
128 lines
4.4 KiB
Text
|
|
apiVersion: apps/v1
|
||
|
|
kind: Deployment
|
||
|
|
metadata:
|
||
|
|
name: {{ taskserv.name }}
|
||
|
|
namespace: {{ taskserv.namespace }}
|
||
|
|
labels:
|
||
|
|
app.kubernetes.io/name: {{ taskserv.name }}
|
||
|
|
app.kubernetes.io/managed-by: provisioning
|
||
|
|
annotations:
|
||
|
|
reloader.stakater.com/auto: "true"
|
||
|
|
spec:
|
||
|
|
replicas: 1
|
||
|
|
strategy:
|
||
|
|
type: Recreate
|
||
|
|
selector:
|
||
|
|
matchLabels:
|
||
|
|
app.kubernetes.io/name: {{ taskserv.name }}
|
||
|
|
template:
|
||
|
|
metadata:
|
||
|
|
labels:
|
||
|
|
app.kubernetes.io/name: {{ taskserv.name }}
|
||
|
|
app.kubernetes.io/managed-by: provisioning
|
||
|
|
spec:
|
||
|
|
nodeSelector:
|
||
|
|
kubernetes.io/hostname: libre-wuji-wrk-0
|
||
|
|
{% if taskserv.placement is defined and taskserv.placement.node_class %}
|
||
|
|
affinity:
|
||
|
|
nodeAffinity:
|
||
|
|
{% if taskserv.placement.mode == "require" %}
|
||
|
|
requiredDuringSchedulingIgnoredDuringExecution:
|
||
|
|
nodeSelectorTerms:
|
||
|
|
- matchExpressions:
|
||
|
|
- key: node-class.{{ taskserv.placement.node_class.0 }}
|
||
|
|
operator: In
|
||
|
|
values: ["true"]
|
||
|
|
{% else %}
|
||
|
|
preferredDuringSchedulingIgnoredDuringExecution:
|
||
|
|
{% for c in taskserv.placement.node_class %}
|
||
|
|
- weight: {{ 100 - loop.index0 * 10 }}
|
||
|
|
preference:
|
||
|
|
matchExpressions:
|
||
|
|
- key: node-class.{{ c }}
|
||
|
|
operator: In
|
||
|
|
values: ["true"]
|
||
|
|
{% endfor %}
|
||
|
|
{% endif %}
|
||
|
|
{% endif %}
|
||
|
|
containers:
|
||
|
|
- name: sozu
|
||
|
|
image: {{ taskserv.image }}
|
||
|
|
args:
|
||
|
|
- start
|
||
|
|
- --config
|
||
|
|
- /etc/sozu/sozu.toml
|
||
|
|
ports:
|
||
|
|
- name: https
|
||
|
|
containerPort: 8443
|
||
|
|
protocol: TCP
|
||
|
|
{% if taskserv.probes is defined and taskserv.probes.readiness is defined %}
|
||
|
|
readinessProbe:
|
||
|
|
{% if taskserv.probes.readiness.type == "tcp" %}
|
||
|
|
tcpSocket:
|
||
|
|
port: {{ taskserv.probes.readiness.port }}
|
||
|
|
{% else %}
|
||
|
|
httpGet:
|
||
|
|
path: {{ taskserv.probes.readiness.path }}
|
||
|
|
port: {{ taskserv.probes.readiness.port }}
|
||
|
|
{% endif %}
|
||
|
|
initialDelaySeconds: {{ taskserv.probes.readiness.initial_delay }}
|
||
|
|
periodSeconds: {{ taskserv.probes.readiness.period }}
|
||
|
|
failureThreshold: {{ taskserv.probes.readiness.failure_threshold }}
|
||
|
|
{% else %}
|
||
|
|
readinessProbe:
|
||
|
|
tcpSocket:
|
||
|
|
port: 8443
|
||
|
|
initialDelaySeconds: 5
|
||
|
|
periodSeconds: 10
|
||
|
|
{% endif %}
|
||
|
|
{% if taskserv.probes is defined and taskserv.probes.liveness is defined %}
|
||
|
|
livenessProbe:
|
||
|
|
{% if taskserv.probes.liveness.type == "tcp" %}
|
||
|
|
tcpSocket:
|
||
|
|
port: {{ taskserv.probes.liveness.port }}
|
||
|
|
{% else %}
|
||
|
|
httpGet:
|
||
|
|
path: {{ taskserv.probes.liveness.path }}
|
||
|
|
port: {{ taskserv.probes.liveness.port }}
|
||
|
|
{% endif %}
|
||
|
|
initialDelaySeconds: {{ taskserv.probes.liveness.initial_delay }}
|
||
|
|
periodSeconds: {{ taskserv.probes.liveness.period }}
|
||
|
|
failureThreshold: {{ taskserv.probes.liveness.failure_threshold }}
|
||
|
|
{% else %}
|
||
|
|
livenessProbe:
|
||
|
|
tcpSocket:
|
||
|
|
port: 8443
|
||
|
|
initialDelaySeconds: 15
|
||
|
|
periodSeconds: 20
|
||
|
|
{% endif %}
|
||
|
|
securityContext:
|
||
|
|
runAsUser: 0
|
||
|
|
{% if taskserv.resources_effective is defined %}
|
||
|
|
resources:
|
||
|
|
requests:
|
||
|
|
cpu: "{{ taskserv.resources_effective.cpu.request }}"
|
||
|
|
memory: "{{ taskserv.resources_effective.memory.request }}"
|
||
|
|
limits:
|
||
|
|
cpu: "{{ taskserv.resources_effective.cpu.limit }}"
|
||
|
|
memory: "{{ taskserv.resources_effective.memory.limit }}"
|
||
|
|
{% else %}
|
||
|
|
resources:
|
||
|
|
requests:
|
||
|
|
cpu: 50m
|
||
|
|
memory: 64Mi
|
||
|
|
limits:
|
||
|
|
memory: 128Mi
|
||
|
|
{% endif %}
|
||
|
|
volumeMounts:
|
||
|
|
- name: sozu-config
|
||
|
|
mountPath: /etc/sozu/sozu.toml
|
||
|
|
subPath: sozu.toml
|
||
|
|
readOnly: true
|
||
|
|
{{ tls_mounts | indent(prefix=" ", first=true) }}
|
||
|
|
volumes:
|
||
|
|
- name: sozu-config
|
||
|
|
configMap:
|
||
|
|
name: sozu-config
|
||
|
|
{{ tls_volumes | indent(prefix=" ", first=true) }}
|