Skip to content

Commit

Permalink
[stable/node-problem-detector] User-specifed custom monitor definitio…
Browse files Browse the repository at this point in the history
…ns (helm#10908)

* Add provision for specifying custom monitor definitions for Node Problem Detector.

Signed-off-by: Jeev B <jeev@kariusdx.com>

* Update Chart.yaml

Signed-off-by: David J. M. Karlsen <david@davidkarlsen.com>
  • Loading branch information
jeevb authored and k8s-ci-robot committed Jan 28, 2019
1 parent d50e2ce commit 0b82ac6
Show file tree
Hide file tree
Showing 7 changed files with 75 additions and 125 deletions.
2 changes: 1 addition & 1 deletion stable/node-problem-detector/Chart.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name: node-problem-detector
version: "1.2.0"
version: "1.3.0"
appVersion: v0.6.1
home: https://github.com/kubernetes/node-problem-detector
description: Installs the node-problem-detector daemonset for monitoring extra attributes on nodes
Expand Down
35 changes: 18 additions & 17 deletions stable/node-problem-detector/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,23 +34,24 @@ Custom System log monitor config files can be created, see [here](https://github

The following table lists the configurable parameters for this chart and their default values.

| Parameter | Description | Default |
|-----------------------------------|--------------------------------------------|--------------------------------------------------------------|
| `affinity` | Map of node/pod affinities | `{}` |
| `annotations` | Optional daemonset annotations | `{}` |
| `fullnameOverride` | Override the fullname of the chart | `nil` |
| `image.pullPolicy` | Image pull policy | `IfNotPresent` |
| `image.repository` | Image | `k8s.gcr.io/node-problem-detector` |
| `image.tag` | Image tag | `v0.6.1` |
| `nameOverride` | Override the name of the chart | `nil` |
| `rbac.create` | RBAC | `true` |
| `hostNetwork` | Run pod on host network | `false` |
| `resources` | Pod resource requests and limits | `{}` |
| `settings.log_monitors` | System log monitor config files | `/config/kernel-monitor.json`, `/config/docker-monitor.json` |
| `settings.custom_plugin_monitors` | Custom plugin monitor config files | `[]` |
| `serviceAccount.create` | Whether a ServiceAccount should be created | `true` |
| `serviceAccount.name` | Name of the ServiceAccount to create | Generated value from template |
| `tolerations` | Optional daemonset tolerations | `[]` |
| Parameter | Description | Default |
|---------------------------------------|--------------------------------------------|--------------------------------------------------------------|
| `affinity` | Map of node/pod affinities | `{}` |
| `annotations` | Optional daemonset annotations | `{}` |
| `fullnameOverride` | Override the fullname of the chart | `nil` |
| `image.pullPolicy` | Image pull policy | `IfNotPresent` |
| `image.repository` | Image | `k8s.gcr.io/node-problem-detector` |
| `image.tag` | Image tag | `v0.6.1` |
| `nameOverride` | Override the name of the chart | `nil` |
| `rbac.create` | RBAC | `true` |
| `hostNetwork` | Run pod on host network | `false` |
| `resources` | Pod resource requests and limits | `{}` |
| `settings.custom_monitor_definitions` | User-specified custom monitor definitions | `{}` |
| `settings.log_monitors` | System log monitor config files | `/config/kernel-monitor.json`, `/config/docker-monitor.json` |
| `settings.custom_plugin_monitors` | Custom plugin monitor config files | `[]` |
| `serviceAccount.create` | Whether a ServiceAccount should be created | `true` |
| `serviceAccount.name` | Name of the ServiceAccount to create | Generated value from template |
| `tolerations` | Optional daemonset tolerations | `[]` |

Specify each parameter using the `--set key=value[,key=value]` argument to `helm install` or provide a YAML file containing the values for the above parameters:

Expand Down
8 changes: 8 additions & 0 deletions stable/node-problem-detector/templates/_helpers.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -40,3 +40,11 @@ Create chart name and version as used by the chart label.
{{ default "default" .Values.serviceAccount.name }}
{{- end -}}
{{- end -}}

{{/*
Create the name of the configmap for storing custom monitor definitions
*/}}
{{- define "node-problem-detector.customConfig" -}}
{{- $fullname := include "node-problem-detector.fullname" . -}}
{{- printf "%s-custom-config" $fullname | replace "+" "_" | trunc 63 -}}
{{- end -}}
94 changes: 0 additions & 94 deletions stable/node-problem-detector/templates/configmap.yaml

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
apiVersion: v1
data:
{{ .Values.settings.custom_monitor_definitions | toYaml | indent 2 }}
kind: ConfigMap
metadata:
name: {{ include "node-problem-detector.customConfig" . }}
labels:
app.kubernetes.io/name: {{ include "node-problem-detector.name" . }}
helm.sh/chart: {{ include "node-problem-detector.chart" . }}
app.kubernetes.io/instance: {{ .Release.Name }}
app.kubernetes.io/managed-by: {{ .Release.Service }}
17 changes: 6 additions & 11 deletions stable/node-problem-detector/templates/daemonset.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ spec:
app.kubernetes.io/name: {{ include "node-problem-detector.name" . }}
app.kubernetes.io/instance: {{ .Release.Name }}
annotations:
checksum/config: {{ include (print $.Template.BasePath "/configmap.yaml") . | sha256sum }}
checksum/config: {{ include (print $.Template.BasePath "/custom-config-configmap.yaml") . | sha256sum }}
scheduler.alpha.kubernetes.io/critical-pod: ''
{{- if .Values.annotations }}
{{ toYaml .Values.annotations | indent 8 }}
Expand All @@ -33,7 +33,7 @@ spec:
command:
- "/bin/sh"
- "-c"
- "exec /node-problem-detector --logtostderr --system-log-monitors={{- range $index, $monitor := .Values.settings.log_monitors }}{{if ne $index 0}},{{end}}/config/{{ $monitor }}{{- end }} {{- if .Values.settings.custom_plugin_monitors }} --custom-plugin-monitors={{- range $index, $monitor := .Values.settings.custom_plugin_monitors }}{{if ne $index 0}},{{end}}{{ $monitor }}{{- end }} {{- end }}"
- "exec /node-problem-detector --logtostderr --system-log-monitors={{- range $index, $monitor := .Values.settings.log_monitors }}{{if ne $index 0}},{{end}}{{ $monitor }}{{- end }} {{- if .Values.settings.custom_plugin_monitors }} --custom-plugin-monitors={{- range $index, $monitor := .Values.settings.custom_plugin_monitors }}{{if ne $index 0}},{{end}}{{ $monitor }}{{- end }} {{- end }}"
securityContext:
privileged: true
env:
Expand All @@ -47,8 +47,8 @@ spec:
- name: localtime
mountPath: /etc/localtime
readOnly: true
- name: config
mountPath: /config
- name: custom-config
mountPath: /custom-config
readOnly: true
terminationGracePeriodSeconds: 30
resources:
Expand All @@ -69,11 +69,6 @@ spec:
hostPath:
path: /etc/localtime
type: "FileOrCreate"
- name: config
- name: custom-config
configMap:
name: {{ include "node-problem-detector.fullname" . }}
items:
{{- range $index, $monitor := .Values.settings.log_monitors }}
- key: {{ $monitor }}
path: {{ $monitor }}
{{- end }}
name: {{ include "node-problem-detector.customConfig" . }}
33 changes: 31 additions & 2 deletions stable/node-problem-detector/values.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,36 @@
settings:
# Custom monitor definitions to add to Node Problem Detector - to be
# mounted at /custom-config. These are in addition to pre-packaged monitor
# definitions provided within the default docker image available at /config:
# https://github.com/kubernetes/node-problem-detector/tree/master/config
custom_monitor_definitions: {}
# docker-monitor-filelog.json: |
# {
# "plugin": "filelog",
# "pluginConfig": {
# "timestamp": "^time=\"(\\S*)\"",
# "message": "msg=\"([^\n]*)\"",
# "timestampFormat": "2006-01-02T15:04:05.999999999-07:00"
# },
# "logPath": "/var/log/docker.log",
# "lookback": "5m",
# "bufferSize": 10,
# "source": "docker-monitor",
# "conditions": [],
# "rules": [
# {
# "type": "temporary",
# "reason": "CorruptDockerImage",
# "pattern": "Error trying v2 registry: failed to register layer: rename /var/lib/docker/image/(.+) /var/lib/docker/image/(.+): directory not empty.*"
# }
# ]
# }
log_monitors:
- kernel-monitor.json
- docker-monitor.json
- /config/kernel-monitor.json
- /config/docker-monitor.json
# An example of activating a custom log monitor definition in
# Node Problem Detector
# - /custom-config/docker-monitor-filelog.json
custom_plugin_monitors: []

hostpath:
Expand Down

0 comments on commit 0b82ac6

Please sign in to comment.