Skip to content

Commit

Permalink
Merge pull request #4 from carlosjgp/node-problem-detector
Browse files Browse the repository at this point in the history
Add node-problem-detector chart
  • Loading branch information
carlosjgp authored Nov 21, 2020
2 parents 573d301 + 7eb369f commit 1dc809b
Show file tree
Hide file tree
Showing 8 changed files with 427 additions and 0 deletions.
23 changes: 23 additions & 0 deletions charts/node-problem-detector/.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/
20 changes: 20 additions & 0 deletions charts/node-problem-detector/Chart.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
apiVersion: v2
name: node-problem-detector
type: application
version: 0.1.0
appVersion: v0.8.1
home: https://github.com/kubernetes/node-problem-detector
description: |-
node-problem-detector aims to make various node problems visible to the
upstream layers in the cluster management stack. It is a daemon that runs
on each node, detects node problems and reports them to apiserver.
node-problem-detector can either run as a DaemonSet or run standalone.
Now it is running as a Kubernetes Addon enabled by default in the GCE cluster.
keywords:
- system
- node
sources:
- https://github.com/kubernetes/node-problem-detector
maintainers:
- name: carlosjgp
email: carlosjuangp@gmail.com
83 changes: 83 additions & 0 deletions charts/node-problem-detector/templates/_helpers.tpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
{{/*
Expand the name of the chart.
*/}}
{{- define "node-problem-detector.name" -}}
{{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" }}
{{- end }}

{{/*
Create a default fully qualified app name.
We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec).
If release name contains chart name it will be used as a full name.
*/}}
{{- define "node-problem-detector.fullname" -}}
{{- if .Values.fullnameOverride }}
{{- .Values.fullnameOverride | trunc 63 | trimSuffix "-" }}
{{- else }}
{{- $name := default .Chart.Name .Values.nameOverride }}
{{- if contains $name .Release.Name }}
{{- .Release.Name | trunc 63 | trimSuffix "-" }}
{{- else }}
{{- printf "%s-%s" .Release.Name $name | trunc 63 | trimSuffix "-" }}
{{- end }}
{{- end }}
{{- end }}

{{/*
Create chart name and version as used by the chart label.
*/}}
{{- define "node-problem-detector.chart" -}}
{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }}
{{- end }}

{{/*
Common labels
*/}}
{{- define "node-problem-detector.labels" -}}
helm.sh/chart: {{ include "node-problem-detector.chart" . }}
{{ include "node-problem-detector.selectorLabels" . }}
{{- if .Chart.AppVersion }}
app.kubernetes.io/version: {{ .Chart.AppVersion | quote }}
{{- end }}
app.kubernetes.io/managed-by: {{ .Release.Service }}
{{- end }}

{{/*
Selector labels
*/}}
{{- define "node-problem-detector.selectorLabels" -}}
app.kubernetes.io/name: {{ include "node-problem-detector.name" . }}
app.kubernetes.io/instance: {{ .Release.Name }}
{{- end }}

{{/*
*/}}
{{- define "node-problem-detector.configuration.arguments" -}}
{{- $cfg := dict "config" (list) }}
{{- range $fileName, $fileContent := .Values.config }}
{{- $noop := printf "/config/%s" $fileName | append $cfg.config | set $cfg "config" }}
{{- end }}
{{- join "," $cfg.config }}
{{- end }}

{{/*
Create the name of the service account to use
*/}}
{{- define "node-problem-detector.serviceAccountName" -}}
{{- if .Values.serviceAccount.create }}
{{- default (include "node-problem-detector.fullname" .) .Values.serviceAccount.name }}
{{- else }}
{{- default "default" .Values.serviceAccount.name }}
{{- end }}
{{- end }}

{{/*
Create the name of the cluster role to use
*/}}
{{- define "node-problem-detector.clusterRoleName" -}}
{{- if .Values.clusterRole.create }}
{{- default (include "node-problem-detector.fullname" .) .Values.clusterRole.name }}
{{- else }}
{{- default "default" .Values.clusterRole.name }}
{{- end }}
{{- end }}
8 changes: 8 additions & 0 deletions charts/node-problem-detector/templates/configmap.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
apiVersion: v1
kind: ConfigMap
metadata:
name: {{ include "node-problem-detector.fullname" . }}
labels:
{{- include "node-problem-detector.labels" . | nindent 4 }}
data:
{{- .Values.config | toYaml | nindent 2 }}
80 changes: 80 additions & 0 deletions charts/node-problem-detector/templates/daemonset.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
apiVersion: apps/v1
kind: DaemonSet
metadata:
name: {{ include "node-problem-detector.fullname" . }}
labels:
{{- include "node-problem-detector.labels" . | nindent 4 }}
spec:
selector:
matchLabels:
{{- include "node-problem-detector.selectorLabels" . | nindent 6 }}
template:
metadata:
{{- with .Values.podAnnotations }}
annotations:
{{- toYaml . | nindent 8 }}
{{- end }}
labels:
{{- include "node-problem-detector.selectorLabels" . | nindent 8 }}
spec:
serviceAccountName: {{ include "node-problem-detector.serviceAccountName" . }}
securityContext:
{{- toYaml .Values.podSecurityContext | nindent 8 }}
containers:
- name: node-problem-detector
command:
- /node-problem-detector
- --logtostderr
- --config.system-log-monitor={{ include "node-problem-detector.configuration.arguments" . }}
image: "{{ .Values.image.repository }}:{{ .Values.image.tag | default .Chart.AppVersion }}"
resources:
{{- toYaml .Values.resources | nindent 10 }}
imagePullPolicy: {{ .Values.image.pullPolicy }}
securityContext:
{{- toYaml .Values.securityContext | nindent 10 }}
env:
- name: NODE_NAME
valueFrom:
fieldRef:
fieldPath: spec.nodeName
volumeMounts:
- name: log
mountPath: /var/log
readOnly: true
- name: kmsg
mountPath: /dev/kmsg
readOnly: true
# Make sure node problem detector is in the same timezone
# with the host.
- name: localtime
mountPath: /etc/localtime
readOnly: true
- name: config
mountPath: /config
readOnly: true
volumes:
- name: log
# Config `log` to your system log directory
hostPath:
path: /var/log/
- name: kmsg
hostPath:
path: /dev/kmsg
- name: localtime
hostPath:
path: /etc/localtime
- name: config
configMap:
name: {{ include "node-problem-detector.fullname" . }}
{{- with .Values.nodeSelector }}
nodeSelector:
{{- toYaml . | nindent 8 }}
{{- end }}
{{- with .Values.affinity }}
affinity:
{{- toYaml . | nindent 8 }}
{{- end }}
{{- with .Values.tolerations }}
tolerations:
{{- toYaml . | nindent 8 }}
{{- end }}
50 changes: 50 additions & 0 deletions charts/node-problem-detector/templates/rbac.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
{{- if .Values.clusterRole.create }}
---
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRole
metadata:
name: {{ include "node-problem-detector.clusterRoleName" . }}
labels:
{{- include "node-problem-detector.labels" . | nindent 4 }}
{{- with .Values.clusterRole.annotations }}
annotations:
{{- toYaml . | nindent 4 }}
{{- end }}
rules:
- apiGroups:
- ""
resources:
- nodes
verbs:
- get
- apiGroups:
- ""
resources:
- nodes/status
verbs:
- patch
- apiGroups:
- ""
- events.k8s.io
resources:
- events
verbs:
- create
- patch
- update
{{- end }}
---
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRoleBinding
metadata:
name: {{ include "node-problem-detector.fullname" . }}
labels:
{{- include "node-problem-detector.labels" . | nindent 4 }}
roleRef:
apiGroup: rbac.authorization.k8s.io
kind: ClusterRole
name: {{ include "node-problem-detector.clusterRoleName" . }}
subjects:
- kind: ServiceAccount
name: {{ include "node-problem-detector.serviceAccountName" . }}
namespace: {{ .Release.Namespace }}
12 changes: 12 additions & 0 deletions charts/node-problem-detector/templates/serviceaccount.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{{- if .Values.serviceAccount.create -}}
apiVersion: v1
kind: ServiceAccount
metadata:
name: {{ include "node-problem-detector.serviceAccountName" . }}
labels:
{{- include "node-problem-detector.labels" . | nindent 4 }}
{{- with .Values.serviceAccount.annotations }}
annotations:
{{- toYaml . | nindent 4 }}
{{- end }}
{{- end }}
Loading

0 comments on commit 1dc809b

Please sign in to comment.