Преглед на файлове

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)
Gavin Chappell преди 4 години
родител
ревизия
9904bcebb5

+ 0 - 0
test/machinaris/1.0.5/.helmignore → test/machinaris/1.0.6/.helmignore


+ 1 - 1
test/machinaris/1.0.5/Chart.yaml → test/machinaris/1.0.6/Chart.yaml

@@ -14,4 +14,4 @@ keywords:
 name: machinaris
 sources:
 - https://github.com/guydavis/machinaris
-version: 1.0.5
+version: 1.0.6

+ 0 - 0
test/machinaris/1.0.5/README.md → test/machinaris/1.0.6/README.md


+ 0 - 0
test/machinaris/1.0.5/app-readme.md → test/machinaris/1.0.6/app-readme.md


+ 0 - 0
test/machinaris/1.0.5/charts/common-2105.0.0.tgz → test/machinaris/1.0.6/charts/common-2105.0.0.tgz


+ 0 - 0
test/machinaris/1.0.5/ix_values.yaml → test/machinaris/1.0.6/ix_values.yaml


+ 21 - 0
test/machinaris/1.0.5/questions.yaml → test/machinaris/1.0.6/questions.yaml

@@ -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]*)$"

+ 0 - 0
test/machinaris/1.0.5/requirements.lock → test/machinaris/1.0.6/requirements.lock


+ 6 - 0
test/machinaris/1.0.5/templates/deployment.yaml → test/machinaris/1.0.6/templates/deployment.yaml

@@ -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 }}

+ 0 - 0
test/machinaris/1.0.5/templates/service.yaml → test/machinaris/1.0.6/templates/service.yaml


+ 0 - 0
test/machinaris/1.0.5/test_values.yaml → test/machinaris/1.0.6/test_values.yaml