runtime: resource limits (kubernetes implementation) (#1931)

* runtime: add resource limit CreateOptions

* util/kubernetes/client: implement support for resource limits

* runtime/kubernetes: set resource limits for k8s deployments

* util/kubernetes: remove template check for ints

* util/kubernetes: fix incorrect yaml syntax

* runtime/kubernetes: fix incorrect units

* runtime: update create options to use Resources struct
This commit is contained in:
ben-toogood
2020-08-14 11:47:28 +01:00
committed by GitHub
parent 374aae1490
commit 5a88ea7247
5 changed files with 95 additions and 9 deletions

View File

@@ -90,8 +90,8 @@ spec:
{{- range . }}
- containerPort: {{ .ContainerPort }}
name: {{ .Name }}
{{- end}}
{{- end}}
{{- end }}
{{- end }}
{{- if .ReadinessProbe }}
{{- with .ReadinessProbe }}
readinessProbe:
@@ -106,6 +106,39 @@ spec:
periodSeconds: {{ .PeriodSeconds }}
{{- end }}
{{- end }}
{{- if .Resources }}
{{- with .Resources }}
resources:
{{- if .Limits }}
{{- with .Limits }}
limits:
{{- if .Memory }}
memory: {{ .Memory }}
{{- end }}
{{- if .CPU }}
cpu: {{ .CPU }}
{{- end }}
{{- if .EphemeralStorage }}
ephemeral-storage: {{ .EphemeralStorage }}
{{- end }}
{{- end }}
{{- end }}
{{- if .Requests }}
{{- with .Requests }}
requests:
{{- if .Memory }}
memory: {{ .Memory }}
{{- end }}
{{- if .CPU }}
cpu: {{ .CPU }}
{{- end }}
{{- if .EphemeralStorage }}
ephemeral-storage: {{ .EphemeralStorage }}
{{- end }}
{{- end }}
{{- end }}
{{- end }}
{{- end }}
{{- end }}
{{- end }}
`