Skip to content
This repository has been archived by the owner on May 16, 2023. It is now read-only.

Commit

Permalink
Merge pull request #436 from gadiener/master
Browse files Browse the repository at this point in the history
[metricbeat] Add priorityClassName config
  • Loading branch information
jmlrt committed Jan 20, 2020
2 parents 56cd637 + e5a9376 commit d22b337
Show file tree
Hide file tree
Showing 5 changed files with 33 additions and 1 deletion.
3 changes: 2 additions & 1 deletion metricbeat/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,7 @@ helm install --name metricbeat elastic/metricbeat --set imageTag=7.5.1
| `nodeSelector` | Configurable [nodeSelector](https://kubernetes.io/docs/concepts/configuration/assign-pod-node/#nodeselector) | `{}` |
| `affinity` | Configurable [affinity](https://kubernetes.io/docs/concepts/configuration/assign-pod-node/#affinity-and-anti-affinity) | `{}` |
| `updateStrategy` | The [updateStrategy](https://kubernetes.io/docs/tasks/manage-daemon/update-daemon-set/#daemonset-update-strategy) for the `DaemonSet`. By default Kubernetes will kill and recreate pods on updates. Setting this to `OnDelete` will require that pods be deleted manually. | `RollingUpdate` |
| `priorityClassName` | The [name of the PriorityClass](https://kubernetes.io/docs/concepts/configuration/pod-priority-preemption/#priorityclass). No default is supplied as the PriorityClass must be created first. | `""` |
| `replicas` | The replica count for the metricbeat deployment talking to kube-state-metrics | `1` |
| `fullnameOverride` | Overrides the full name of the resources. If not set the name will default to "`.Release.Name`-`.Values.nameOverride or .Chart.Name`" | `""` |

Expand Down Expand Up @@ -142,4 +143,4 @@ To run the goss tests against the default example:
```
cd examples/default
make goss
```
```
3 changes: 3 additions & 0 deletions metricbeat/templates/daemonset.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,9 @@ spec:
{{- with .Values.nodeSelector }}
nodeSelector: {{ toYaml . | nindent 8 }}
{{- end }}
{{- if .Values.priorityClassName }}
priorityClassName: {{ .Values.priorityClassName }}
{{- end }}
{{- with .Values.affinity }}
affinity: {{ toYaml . | nindent 8 -}}
{{- end }}
Expand Down
3 changes: 3 additions & 0 deletions metricbeat/templates/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,9 @@ spec:
{{- with .Values.tolerations }}
tolerations:
{{ toYaml . | indent 6 }}
{{- end }}
{{- if .Values.priorityClassName }}
priorityClassName: {{ .Values.priorityClassName }}
{{- end }}
serviceAccountName: {{ template "metricbeat.serviceAccount" . }}
terminationGracePeriodSeconds: {{ .Values.terminationGracePeriod }}
Expand Down
21 changes: 21 additions & 0 deletions metricbeat/tests/metricbeat_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -207,6 +207,27 @@ def test_adding_an_affinity_rule():
assert r['daemonset'][name]['spec']['template']['spec']['affinity']['podAntiAffinity'][
'requiredDuringSchedulingIgnoredDuringExecution'][0]['topologyKey'] == 'kubernetes.io/hostname'


def test_priority_class_name():
config = '''
priorityClassName: ""
'''
r = helm_template(config)
daemonset_spec = r['daemonset'][name]['spec']['template']['spec']
deployment_spec = r['deployment'][name + '-metrics']['spec']['template']['spec']
assert 'priorityClassName' not in daemonset_spec
assert 'priorityClassName' not in deployment_spec

config = '''
priorityClassName: "highest"
'''
r = helm_template(config)
daemonset_priority_class_name = r['daemonset'][name]['spec']['template']['spec']['priorityClassName']
deployment_priority_class_name = r['deployment'][name + '-metrics']['spec']['template']['spec']['priorityClassName']
assert daemonset_priority_class_name == "highest"
assert deployment_priority_class_name == "highest"


def test_cluster_role_rules():
config = ''
r = helm_template(config)
Expand Down
4 changes: 4 additions & 0 deletions metricbeat/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -180,6 +180,10 @@ nodeSelector: {}

affinity: {}

# This is the PriorityClass settings as defined in
# https://kubernetes.io/docs/concepts/configuration/pod-priority-preemption/#priorityclass
priorityClassName: ""

updateStrategy: RollingUpdate

# Override various naming aspects of this chart
Expand Down

0 comments on commit d22b337

Please sign in to comment.