Skip to content

Commit

Permalink
helm: add helm chart for plugins installations
Browse files Browse the repository at this point in the history
This commit adds a helm chart to install balloons and topology-aware
NRI plugins.

Signed-off-by: Feruzjon Muyassarov <[email protected]>
  • Loading branch information
fmuyassarov committed Jun 12, 2023
1 parent ced32fb commit a5c0400
Show file tree
Hide file tree
Showing 13 changed files with 537 additions and 0 deletions.
23 changes: 23 additions & 0 deletions deployment/helm/nri-plugins/.helmignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# Patterns to ignore when building packages.
# This supports shell glob matching, relative path matching, and
# negation (prefixed with !). Only one pattern per line.
.DS_Store
# Common VCS dirs
.git/
.gitignore
.bzr/
.bzrignore
.hg/
.hgignore
.svn/
# Common backup files
*.swp
*.bak
*.tmp
*.orig
*~
# Various IDEs
.project
.idea/
*.tmproj
.vscode/
11 changes: 11 additions & 0 deletions deployment/helm/nri-plugins/Chart.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
apiVersion: v2
appVersion: main
description: |
NRI resource policy is a NRI plugin that will apply hardware-aware resource allocation
policies to the containers running in the system.
name: nri-plugins
sources:
- https://github.com/containers/nri-plugins
home: https://github.com/containers/nri-plugins
type: application
version: 0.0.0
43 changes: 43 additions & 0 deletions deployment/helm/nri-plugins/balloons_values.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
# Default values for nri-plugins.
# This is a YAML-formatted file.
# Declare variables to be passed into your templates.
---
image:
name: ghcr.io/containers/nri-plugins/nri-resource-policy-balloons
# tag, if defined will use the given image tag, otherwise Chart.appVersion will be used
tag: unstable
pullPolicy: IfNotPresent
container:
name: nri-resource-policy-balloons

namespace: kube-system

configMap:
data:
ReservedResources:
cpu: 750m

spec:
containers:
ports:
- containerPort: 8891
hostPort: 8891
protocol: TCP
name: metrics
resources:
requests:
cpu: 500m
memory: 512Mi
args:
- --host-root
- /host
- --fallback-config
- /etc/nri-resource-policy/nri-resource-policy.cfg
- --pid-file
- /tmp/nri-resource-policy.pid
- -metrics-interval
- 5s
securityContext:
allowPrivilegeEscalation: false
capabilities:
drop: ["ALL"]
8 changes: 8 additions & 0 deletions deployment/helm/nri-plugins/templates/_helpers.tpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{{/*
Common labels
*/}}
{{- define "nri-plugins.labels" -}}
app: nri-resource-policy
app.kubernetes.io/instance: {{ .Release.Name }}
app.kubernetes.io/managed-by: {{ .Release.Service }}
{{- end -}}
12 changes: 12 additions & 0 deletions deployment/helm/nri-plugins/templates/clusterrole.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRole
metadata:
name: nri-resource-policy
rules:
- apiGroups:
- ""
resources:
- nodes
verbs:
- get
- watch
12 changes: 12 additions & 0 deletions deployment/helm/nri-plugins/templates/clusterrolebinding.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRoleBinding
metadata:
name: nri-resource-policy
roleRef:
apiGroup: rbac.authorization.k8s.io
kind: ClusterRole
name: nri-resource-policy
subjects:
- kind: ServiceAccount
name: nri-resource-policy
namespace: {{ .Values.namespace }}
8 changes: 8 additions & 0 deletions deployment/helm/nri-plugins/templates/configmap.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
apiVersion: v1
kind: ConfigMap
metadata:
name: nri-resource-policy-config.default
namespace: {{ .Values.namespace }}
data:
policy: |+
{{- toYaml .Values.configMap.data | nindent 4 }}
66 changes: 66 additions & 0 deletions deployment/helm/nri-plugins/templates/daemonset.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
apiVersion: apps/v1
kind: DaemonSet
metadata:
labels:
{{- include "nri-plugins.labels" . | nindent 4 }}
name: nri-resource-policy
namespace: {{ .Values.namespace }}
spec:
selector:
matchLabels:
{{- include "nri-plugins.labels" . | nindent 6 }}
template:
metadata:
labels:
{{- include "nri-plugins.labels" . | nindent 7 }}
spec:
serviceAccount: nri-resource-policy
nodeSelector:
kubernetes.io/os: "linux"
containers:
- name: {{ .Values.container.name }}
args:
{{- toYaml .Values.spec.containers.args | nindent 12 }}
ports:
{{- toYaml .Values.spec.containers.ports | nindent 12 }}
env:
- name: NODE_NAME
valueFrom:
fieldRef:
fieldPath: spec.nodeName
image: {{ .Values.image.name }}:{{ .Values.image.tag | default .Chart.AppVersion }}
imagePullPolicy: {{ .Values.image.pullPolicy }}
securityContext:
{{- toYaml .Values.spec.containers.securityContext | nindent 12 }}
resources:
{{- toYaml .Values.spec.containers.resources | nindent 12 }}
volumeMounts:
- name: resource-policydata
mountPath: /var/lib/nri-resource-policy
- name: hostsysfs
mountPath: /host/sys
- name: resource-policysockets
mountPath: /var/run/nri-resource-policy
- name: resource-policyconfig
mountPath: /etc/nri-resource-policy
- name: nrisockets
mountPath: /var/run/nri
volumes:
- name: resource-policydata
hostPath:
path: /var/lib/nri-resource-policy
type: DirectoryOrCreate
- name: hostsysfs
hostPath:
path: /sys
type: Directory
- name: resource-policysockets
hostPath:
path: /var/run/nri-resource-policy
- name: resource-policyconfig
configMap:
name: nri-resource-policy-config
- name: nrisockets
hostPath:
path: /var/run/nri
type: Directory
Loading

0 comments on commit a5c0400

Please sign in to comment.