diff --git a/deployment/helm/memory-qos/Chart.yaml b/deployment/helm/memory-qos/Chart.yaml new file mode 100644 index 000000000..a4df7503c --- /dev/null +++ b/deployment/helm/memory-qos/Chart.yaml @@ -0,0 +1,11 @@ +apiVersion: v2 +appVersion: "main" +description: | + The memory-qos NRI plugin adds two methods for controlling cgroups v2 + memory.* parameters: QoS class and direct memory annotations. +name: nri-resource-policy-memory-qos +sources: + - https://github.com/containers/nri-plugins +home: https://github.com/containers/nri-plugins +type: application +version: v0.0.0 diff --git a/deployment/helm/memory-qos/templates/_helpers.tpl b/deployment/helm/memory-qos/templates/_helpers.tpl new file mode 100644 index 000000000..c5c62124f --- /dev/null +++ b/deployment/helm/memory-qos/templates/_helpers.tpl @@ -0,0 +1,8 @@ +{{/* +Common labels +*/}} +{{- define "memory-qos.labels" -}} +app: nri-memory-qos +app.kubernetes.io/instance: {{ .Release.Name }} +app.kubernetes.io/managed-by: {{ .Release.Service }} +{{- end -}} diff --git a/deployment/helm/memory-qos/templates/configMap.yaml b/deployment/helm/memory-qos/templates/configMap.yaml new file mode 100644 index 000000000..1b60b94f3 --- /dev/null +++ b/deployment/helm/memory-qos/templates/configMap.yaml @@ -0,0 +1,17 @@ +apiVersion: v1 +kind: ConfigMap +metadata: + name: nri-memory-qos-config.default + namespace: {{ .Release.Namespace }} + labels: + {{- include "memory-qos.labels" . | nindent 4 }} +data: + config.yaml: | + classes: + - name: bronze + swaplimitratio: 0.5 + - name: silver + swaplimitratio: 0.2 + unifiedannotations: + - memory.swap.max + - memory.high diff --git a/deployment/helm/memory-qos/templates/daemonSet.yaml b/deployment/helm/memory-qos/templates/daemonSet.yaml new file mode 100644 index 000000000..d19a33790 --- /dev/null +++ b/deployment/helm/memory-qos/templates/daemonSet.yaml @@ -0,0 +1,46 @@ +apiVersion: apps/v1 +kind: DaemonSet +metadata: + labels: + {{- include "memory-qos.labels" . | nindent 4 }} + name: nri-memory-qos + namespace: {{ .Release.Namespace }} +spec: + selector: + matchLabels: + {{- include "memory-qos.labels" . | nindent 6 }} + template: + metadata: + labels: + {{- include "memory-qos.labels" . | nindent 8 }} + spec: + nodeSelector: + kubernetes.io/os: "linux" + containers: + - name: nri-memory-qos + command: + - nri-memory-qos + - --idx + - "40" + - --config + - /etc/nri/memory-qos/config.yaml + - -v + image: {{ .Values.image.name }}:{{ .Values.image.tag | default .Chart.AppVersion }} + imagePullPolicy: {{ .Values.image.pullPolicy }} + resources: + requests: + cpu: {{ .Values.resources.cpu }} + memory: {{ .Values.resources.memory }} + volumeMounts: + - name: memory-qos-config-vol + mountPath: /etc/nri/memory-qos + - name: nrisockets + mountPath: /var/run/nri + volumes: + - name: memory-qos-config-vol + configMap: + name: nri-memory-qos-config.default + - name: nrisockets + hostPath: + path: /var/run/nri + type: Directory diff --git a/deployment/helm/memory-qos/values.scheme.json b/deployment/helm/memory-qos/values.scheme.json new file mode 100644 index 000000000..dbe88c447 --- /dev/null +++ b/deployment/helm/memory-qos/values.scheme.json @@ -0,0 +1,44 @@ +{ + "$schema": "http://json-schema.org/schema#", + "required": [ + "image", + "resources" + ], + "properties": { + "image": { + "type": "object", + "required": [ + "name", + "tag", + "pullPolicy" + ], + "properties": { + "name": { + "type": "string" + }, + "tag": { + "type": "string" + }, + "pullPolicy": { + "type": "string", + "enum": ["Never", "Always", "IfNotPresent"] + } + } + }, + "resources": { + "type": "object", + "required": [ + "cpu", + "memory" + ], + "properties": { + "cpu": { + "type": "integer" + }, + "memory": { + "type": "integer" + } + } + } + } + } diff --git a/deployment/helm/memory-qos/values.yaml b/deployment/helm/memory-qos/values.yaml new file mode 100644 index 000000000..64005372c --- /dev/null +++ b/deployment/helm/memory-qos/values.yaml @@ -0,0 +1,13 @@ +# Default values for memory-qos. +# This is a YAML-formatted file. +# Declare variables to be passed into your templates. +--- +image: + name: ghcr.io/containers/nri-plugins/nri-memory-qos + # tag, if defined will use the given image tag, otherwise Chart.AppVersion will be used + tag: unstable + pullPolicy: Always + +resources: + cpu: 10m + memory: 100Mi diff --git a/deployment/helm/memtierd/Chart.yaml b/deployment/helm/memtierd/Chart.yaml new file mode 100644 index 000000000..669be3e13 --- /dev/null +++ b/deployment/helm/memtierd/Chart.yaml @@ -0,0 +1,10 @@ +apiVersion: v2 +appVersion: "main" +description: | + The memtierd NRI plugin enables managing workloads with Memtierd in Kubernetes. +name: nri-resource-policy-memtierd +sources: + - https://github.com/containers/nri-plugins +home: https://github.com/containers/nri-plugins +type: application +version: v0.0.0 diff --git a/deployment/helm/memtierd/templates/_helpers.tpl b/deployment/helm/memtierd/templates/_helpers.tpl new file mode 100644 index 000000000..07eb0335a --- /dev/null +++ b/deployment/helm/memtierd/templates/_helpers.tpl @@ -0,0 +1,8 @@ +{{/* +Common labels +*/}} +{{- define "memtierd.labels" -}} +app: nri-memtierd +app.kubernetes.io/instance: {{ .Release.Name }} +app.kubernetes.io/managed-by: {{ .Release.Service }} +{{- end -}} diff --git a/deployment/helm/memtierd/templates/configMap.yaml b/deployment/helm/memtierd/templates/configMap.yaml new file mode 100644 index 000000000..a903b38b8 --- /dev/null +++ b/deployment/helm/memtierd/templates/configMap.yaml @@ -0,0 +1,32 @@ +apiVersion: v1 +kind: ConfigMap +metadata: + name: nri-memtierd-config.default + namespace: {{ .Release.Namespace }} + labels: + {{- include "memtierd.labels" . | nindent 4 }} +data: + config.yaml: | + classes: + - name: swap-idle-data + allowswap: true + memtierdconfig: | + policy: + name: age + config: | + intervalms: 10000 + pidwatcher: + name: cgroups + config: | + cgroups: + - $CGROUP2_ABS_PATH + swapoutms: 10000 + tracker: + name: idlepage + config: | + pagesinregion: 512 + maxcountperregion: 1 + scanintervalms: 10000 + mover: + intervalms: 20 + bandwidth: 50 diff --git a/deployment/helm/memtierd/templates/daemonSet.yaml b/deployment/helm/memtierd/templates/daemonSet.yaml new file mode 100644 index 000000000..59b144f45 --- /dev/null +++ b/deployment/helm/memtierd/templates/daemonSet.yaml @@ -0,0 +1,62 @@ +apiVersion: apps/v1 +kind: DaemonSet +metadata: + labels: + {{- include "memtierd.labels" . | nindent 4 }} + name: nri-memtierd + namespace: {{ .Release.Namespace }} +spec: + selector: + matchLabels: + {{- include "memtierd.labels" . | nindent 6 }} + template: + metadata: + labels: + {{- include "memtierd.labels" . | nindent 8 }} + spec: + nodeSelector: + kubernetes.io/os: "linux" + hostPID: true + containers: + - name: nri-memtierd + command: + - nri-memtierd + - --idx + - "45" + - --config + - /etc/nri/memtierd/config.yaml + - --host-root + - /host + - -v + image: {{ .Values.image.name }}:{{ .Values.image.tag | default .Chart.AppVersion }} + imagePullPolicy: {{ .Values.image.pullPolicy }} + resources: + requests: + cpu: {{ .Values.resources.cpu }} + memory: {{ .Values.resources.memory }} + securityContext: + privileged: true + volumeMounts: + - name: memtierd-config-vol + mountPath: /etc/nri/memtierd + - name: nrisockets + mountPath: /var/run/nri + - name: host-vol + mountPath: /host + - name: host-bitmap + mountPath: /sys/kernel/mm/page_idle/bitmap + volumes: + - name: memtierd-config-vol + configMap: + name: nri-memtierd-config.default + - name: nrisockets + hostPath: + path: /var/run/nri + type: Directory + - name: host-vol + hostPath: + path: / + type: Directory + - name: host-bitmap + hostPath: + path: /sys/kernel/mm/page_idle/bitmap diff --git a/deployment/helm/memtierd/values.scheme.json b/deployment/helm/memtierd/values.scheme.json new file mode 100644 index 000000000..dbe88c447 --- /dev/null +++ b/deployment/helm/memtierd/values.scheme.json @@ -0,0 +1,44 @@ +{ + "$schema": "http://json-schema.org/schema#", + "required": [ + "image", + "resources" + ], + "properties": { + "image": { + "type": "object", + "required": [ + "name", + "tag", + "pullPolicy" + ], + "properties": { + "name": { + "type": "string" + }, + "tag": { + "type": "string" + }, + "pullPolicy": { + "type": "string", + "enum": ["Never", "Always", "IfNotPresent"] + } + } + }, + "resources": { + "type": "object", + "required": [ + "cpu", + "memory" + ], + "properties": { + "cpu": { + "type": "integer" + }, + "memory": { + "type": "integer" + } + } + } + } + } diff --git a/deployment/helm/memtierd/values.yaml b/deployment/helm/memtierd/values.yaml new file mode 100644 index 000000000..4ad3f01cc --- /dev/null +++ b/deployment/helm/memtierd/values.yaml @@ -0,0 +1,13 @@ +# Default values for memory-qos. +# This is a YAML-formatted file. +# Declare variables to be passed into your templates. +--- +image: + name: ghcr.io/containers/nri-plugins/nri-memtierd + # tag, if defined will use the given image tag, otherwise Chart.AppVersion will be used + tag: unstable + pullPolicy: Always + +resources: + cpu: 250m + memory: 100Mi diff --git a/docs/resource-policy/installation.md b/docs/resource-policy/installation.md index ce3a32a01..d1f72d4a5 100644 --- a/docs/resource-policy/installation.md +++ b/docs/resource-policy/installation.md @@ -103,6 +103,26 @@ along with the default values, for the Topology-aware and Balloons plugins Helm | `hostPort` | 8891 | metrics port to expose on the host | | `config` |
ReservedResources:
cpu: 750m
| plugin configuration data | +#### Memtierd + +| Name | Default | Description | +| ------------------ | ----------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------- | +| `image.name` | [ghcr.io/containers/nri-plugins/nri-memtierd](ghcr.io/containers/nri-plugins/nri-memtierd) | container image name | +| `image.tag` | unstable | container image tag | +| `image.pullPolicy` | Always | image pull policy | +| `resources.cpu` | 250m | cpu resources for the Pod | +| `resources.memory` | 100Mi | memory qouta for the | + +#### Memory-qos + +| Name | Default | Description | +| ------------------ | ----------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------- | +| `image.name` | [ghcr.io/containers/nri-plugins/nri-memory-qos](ghcr.io/containers/nri-plugins/nri-memory-qos) | container image name | +| `image.tag` | unstable | container image tag | +| `image.pullPolicy` | Always | image pull policy | +| `resources.cpu` | 10m | cpu resources for the Pod | +| `resources.memory` | 100Mi | memory qouta for the | + ## Manual installation For the manual installation we will be using templating tool to generate Kubernetes YAML manifests.