90 lines
2.6 KiB
YAML
90 lines
2.6 KiB
YAML
apiVersion: apps/v1
|
|
kind: Deployment
|
|
metadata:
|
|
name: {{.ObjectMeta.Name}}
|
|
namespace: {{.ObjectMeta.Namespace}}
|
|
labels:
|
|
app: {{.ObjectMeta.Name}}
|
|
devstar.io/managed-by: devstar-application-operator
|
|
devstar-resource-type: devstar-application
|
|
spec:
|
|
replicas: {{.Spec.Replicas | default 1}}
|
|
selector:
|
|
matchLabels:
|
|
app: {{.ObjectMeta.Name}}
|
|
devstar-resource-type: devstar-application
|
|
template:
|
|
metadata:
|
|
labels:
|
|
app: {{.ObjectMeta.Name}}
|
|
devstar-resource-type: devstar-application
|
|
spec:
|
|
containers:
|
|
- name: {{.ObjectMeta.Name}}
|
|
image: {{.Spec.Template.Image}}
|
|
{{- if .Spec.Template.Command}}
|
|
command:
|
|
{{- range .Spec.Template.Command}}
|
|
- {{.}}
|
|
{{- end}}
|
|
{{- end}}
|
|
{{- if .Spec.Template.Args}}
|
|
args:
|
|
{{- range .Spec.Template.Args}}
|
|
- {{.}}
|
|
{{- end}}
|
|
{{- end}}
|
|
{{- if .Spec.Template.Ports}}
|
|
ports:
|
|
{{- range .Spec.Template.Ports}}
|
|
- name: {{.Name}}
|
|
containerPort: {{.Port}}
|
|
protocol: {{.Protocol | default "TCP"}}
|
|
{{- end}}
|
|
{{- end}}
|
|
{{- if .Spec.Environment}}
|
|
env:
|
|
{{- range $key, $value := .Spec.Environment}}
|
|
- name: {{$key}}
|
|
value: "{{$value}}"
|
|
{{- end}}
|
|
{{- end}}
|
|
{{- if or .Spec.Resources.CPU .Spec.Resources.Memory}}
|
|
resources:
|
|
limits:
|
|
{{- if .Spec.Resources.CPU}}
|
|
cpu: {{.Spec.Resources.CPU}}
|
|
{{- end}}
|
|
{{- if .Spec.Resources.Memory}}
|
|
memory: {{.Spec.Resources.Memory}}
|
|
{{- end}}
|
|
requests:
|
|
{{- if .Spec.Resources.CPU}}
|
|
cpu: {{.Spec.Resources.CPU}}
|
|
{{- end}}
|
|
{{- if .Spec.Resources.Memory}}
|
|
memory: {{.Spec.Resources.Memory}}
|
|
{{- end}}
|
|
{{- end}}
|
|
{{- if .Spec.Template.HealthCheck}}
|
|
{{- if .Spec.Template.HealthCheck.HTTPGet}}
|
|
livenessProbe:
|
|
httpGet:
|
|
path: {{.Spec.Template.HealthCheck.HTTPGet.Path}}
|
|
port: {{.Spec.Template.HealthCheck.HTTPGet.Port}}
|
|
initialDelaySeconds: 30
|
|
periodSeconds: 10
|
|
timeoutSeconds: 5
|
|
successThreshold: 1
|
|
failureThreshold: 3
|
|
readinessProbe:
|
|
httpGet:
|
|
path: {{.Spec.Template.HealthCheck.HTTPGet.Path}}
|
|
port: {{.Spec.Template.HealthCheck.HTTPGet.Port}}
|
|
initialDelaySeconds: 5
|
|
periodSeconds: 10
|
|
timeoutSeconds: 5
|
|
successThreshold: 1
|
|
failureThreshold: 3
|
|
{{- end}}
|
|
{{- end}} |