Skip to content

Commit

Permalink
Add additional Helm Configuration options (#42)
Browse files Browse the repository at this point in the history
* Add optional Prometheus operator ServiceMonitor

* make Pod/Container SecurityContext configureable

* Allow additional Pod labels/annotations

* Allow additional Service labels

* Allow overriding of Tolerations

* remove hard-coded servicemonitor name

use release name instead

* fix readme podSecurityContext naming inconsistency

* adjust casing in README and fix typos
  • Loading branch information
domi2120 committed Jun 1, 2022
1 parent aa94ef8 commit 7c284ca
Show file tree
Hide file tree
Showing 5 changed files with 63 additions and 6 deletions.
8 changes: 8 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,18 @@ The following command can be used to install kubenurse with Helm: `helm upgrade
| ---------------------------------|---------------------------------------------------------------------------------------------------- | --------------------- |
| daemonset.image.repository | The repository name | postfinance/kubenurse |
| daemonset.image.tag | The tag/ version of the image | v1.4.0 |
| daemonset.podLabels | Additional labels to be added to the pods of the daemonset | []
| daemonset.podAnnotations | Additional annotations to be added to the pods of the daemonset | []
| daemonset.podSecurityContext | The security context of the daemonset | {}
| daemonset.containerSecurityContext| The security context of the containers within the pods of the daemonset | {}
| daemonset.tolerations | The tolerations of the daemonset | <code>- effect: NoSchedule </br>&nbsp; key: node-role.kubernetes.io/master</br>&nbsp; operator: Equal </br>- effect: NoSchedule </br>&nbsp; key: node-role.kubernetes.io/control-plane</br>&nbsp; operator: Equal</code>
| namespace | The namespace where kubenurse will be deployed | kube-system |
| serviceMonitor.enabled | Adds a ServiceMonitor for use with [Prometheus-operator](https://github.com/prometheus-operator/prometheus-operator) | false
| serviceMonitor.labels | Additional labels to be added to the ServiceMonitor | {}
| serviceAccount.name | The name of the service account which is used | kubenurse |
| service.name | The name of service which exposes the kubenurse application | 8080-8080 |
| service.port | The port number of the service | 8080 |
| service.labels | Additional labels to be added to the Service |
| ingress.enabled | Enable/ Disable the ingress | true |
| ingress.className | The classname of the ingress controller (e.g. the nginx ingress controller) | nginx |
| ingress.url | The url of the ingress; e.g. kubenurse.westeurope.cloudapp.azure.com | dummy.kubenurse.com |
Expand Down
23 changes: 17 additions & 6 deletions helm/kubenurse/templates/daemonset.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,17 +14,31 @@ spec:
template:
metadata:
labels:
{{- if .Values.daemonset.podLabels }}
{{- toYaml .Values.daemonset.podLabels | nindent 8 }}
{{- end }}
app: {{ include "name" . | quote }}
{{ include "common-labels" . | indent 8 }}
annotations:
prometheus.io/path: "/metrics"
prometheus.io/port: "8080"
prometheus.io/scheme: "http"
prometheus.io/scrape: "true"
{{- if .Values.daemonset.podAnnotations }}
{{- toYaml .Values.daemonset.podAnnotations | nindent 8 }}
{{- end }}
spec:
securityContext:
{{- if .Values.daemonset.podSecurityContext -}}
{{ toYaml .Values.daemonset.podSecurityContext | nindent 8 }}
{{- end }}
serviceAccountName: {{ include "name" . | quote }}
containers:
- name: {{ include "name" . | quote }}
securityContext:
{{- if .Values.daemonset.containerSecurityContext -}}
{{ toYaml .Values.daemonset.containerSecurityContext | nindent 10 }}
{{- end }}
env:
- name: KUBENURSE_INGRESS_URL
value: https://{{ .Values.ingress.url }}
Expand Down Expand Up @@ -55,9 +69,6 @@ spec:
successThreshold: 1
timeoutSeconds: 1
tolerations:
- effect: NoSchedule
key: node-role.kubernetes.io/master
operator: Equal
- effect: NoSchedule
key: node-role.kubernetes.io/control-plane
operator: Equal
{{- if .Values.daemonset.tolerations }}
{{- toYaml .Values.daemonset.tolerations | nindent 6 }}
{{- end }}
3 changes: 3 additions & 0 deletions helm/kubenurse/templates/service.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@ apiVersion: v1
kind: Service
metadata:
labels:
{{- if .Values.service.labels }}
{{- toYaml .Values.service.labels | nindent 4 }}
{{- end }}
app: {{ include "name" . | quote }}
{{ include "common-labels" . | indent 4 }}
name: {{ include "name" . | quote }}
Expand Down
19 changes: 19 additions & 0 deletions helm/kubenurse/templates/servicemonitor.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
{{- if .Values.serviceMonitor.enabled -}}
apiVersion: monitoring.coreos.com/v1
kind: ServiceMonitor
metadata:
name: {{ include "name" . | quote }}
namespace: {{ .Values.namespace }}
labels:
{{- toYaml .Values.serviceMonitor.labels | nindent 4}}
spec:
endpoints:
- port: {{ .Values.service.name }}
interval: 60s
namespaceSelector:
matchNames:
- {{ .Values.namespace }}
selector:
matchLabels:
{{ include "common-labels" . | indent 6 }}
{{- end -}}
16 changes: 16 additions & 0 deletions helm/kubenurse/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,21 @@ daemonset:
repository: postfinance/kubenurse
tag: v1.5.1
extraEnvs: []
podLabels: {}
podAnnotations: {}
podSecurityContext: {}
containerSecurityContext: {}
tolerations:
- effect: NoSchedule
key: node-role.kubernetes.io/master
operator: Equal
- effect: NoSchedule
key: node-role.kubernetes.io/control-plane
operator: Equal

serviceMonitor:
enabled: false
labels: {}

namespace: kube-system

Expand All @@ -12,6 +27,7 @@ serviceAccount:
service:
name: 8080-8080
port: 8080
labels: {}

ingress:
enabled: true
Expand Down

0 comments on commit 7c284ca

Please sign in to comment.