mirror of
https://github.com/truenas/charts.git
synced 2026-04-05 11:48:55 +08:00
add optional resource limits to Machinaris Chart on test track (#137)
* add optional resource limits to Machinaris Chart on `test` track * removed question mark * regex validation of values * Memory validation comes straight from `k3s-io/k3s` in `vendor/k8s.io/apimachinery/pkg/api/resource/quantity.go` * CPU validation is home-grown and allows both the fractional representation as well as the "millicore" representation, but because the minimum precision is `1m`, fractions and millicores cannot be used together ([read more](https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/#meaning-of-cpu)) * any string containing a period MUST NOT end with an `m` as this must be a fractional representation * otherwise any string containing only digits MAY end with an `m` (to represent a number of millicores) or not (to represent one or more entire cores)
This commit is contained in:
@@ -14,4 +14,4 @@ keywords:
|
||||
name: machinaris
|
||||
sources:
|
||||
- https://github.com/guydavis/machinaris
|
||||
version: 1.0.5
|
||||
version: 1.0.6
|
||||
@@ -7,6 +7,8 @@ groups:
|
||||
description: "Configure Storage for Machinaris"
|
||||
- name: "Machinaris Environment Variables"
|
||||
description: "Set the environment that will be visible to the container"
|
||||
- name: "Resource Limits"
|
||||
description: "Set CPU/memory limits for Kubernetes Pod"
|
||||
|
||||
portals:
|
||||
web_portal:
|
||||
@@ -157,3 +159,22 @@ questions:
|
||||
label: "Value"
|
||||
schema:
|
||||
type: string
|
||||
- variable: enableResourceLimits
|
||||
label: "Enable Pod resource limits"
|
||||
group: "Resource Limits"
|
||||
schema:
|
||||
type: boolean
|
||||
- variable: cpuLimit
|
||||
label: "CPU limit"
|
||||
group: "Resource Limits"
|
||||
schema:
|
||||
type: string
|
||||
show_if: [["enableResourceLimits", "=", true]]
|
||||
valid_chars: "^\\d+(?:\\.\\d+(?!.*m$)|m?$)"
|
||||
- variable: memLimit
|
||||
label: "Memory limit"
|
||||
group: "Resource Limits"
|
||||
schema:
|
||||
type: string
|
||||
show_if: [["enableResourceLimits", "=", true]]
|
||||
valid_chars: "^([+-]?[0-9.]+)([eEinumkKMGTP]*[-+]?[0-9]*)$"
|
||||
@@ -17,6 +17,12 @@ spec:
|
||||
hostNetwork: true
|
||||
containers:
|
||||
- name: {{ .Chart.Name }}
|
||||
{{ if .Values.enableResourceLimits }}
|
||||
resources:
|
||||
limits:
|
||||
cpu: {{ .Values.cpuLimit }}
|
||||
memory: {{ .Values.memLimit }}
|
||||
{{ end }}
|
||||
tty: true
|
||||
{{ include "common.containers.imageConfig" .Values.image | nindent 10 }}
|
||||
volumeMounts: {{ include "common.storage.configureAppVolumeMountsInContainer" .Values | nindent 12 }}
|
||||
Reference in New Issue
Block a user