From fe52a62639031d8988e2ce4cc12479c3e85e2b69 Mon Sep 17 00:00:00 2001 From: Julien Mailleret Date: Mon, 18 May 2020 10:58:57 +0200 Subject: [PATCH] [metricbeat] fix deployment upgrade by removing chart label from .spec.selector.matchLabels (#622) This fix metricbeat chart upgrades when .Chart.Version change. UPGRADE FAILED Error: Deployment.apps "metricbeat-metricbeat-metrics" is invalid: spec.selector: Invalid value: v1.LabelSelector{MatchLabels:map[string]string{"app":"metricbeat-metricbeat-metrics", "chart":"metricbeat-7.7.0", "heritage":"Tiller", "release":"metricbeat"}, MatchExpressions:[]v1.LabelSelectorRequirement(nil)}: field is immutable Error: UPGRADE FAILED: Deployment.apps "metricbeat-metricbeat-metrics" is invalid: spec.selector: Invalid value: v1.LabelSelector{MatchLabels:map[string]string{"app":"metricbeat-metricbeat-metrics", "chart":"metricbeat-7.7.0", "heritage":"Tiller", "release":"metricbeat"}, MatchExpressions:[]v1.LabelSelectorRequirement(nil)}: field is immutable See https://github.com/helm/charts/issues/7680 for more details --- BREAKING_CHANGES.md | 11 +++++++++++ metricbeat/templates/deployment.yaml | 3 +-- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/BREAKING_CHANGES.md b/BREAKING_CHANGES.md index 75a4db036..43e488aab 100644 --- a/BREAKING_CHANGES.md +++ b/BREAKING_CHANGES.md @@ -7,7 +7,9 @@ - [GA support](#ga-support) - [New branching model](#new-branching-model) - [Filebeat container inputs](#filebeat-container-inputs) + - [Metricbeat upgrade issue](#metricbeat-upgrade-issue) - [Metricbeat split values for daemonset and deployment](#metricbeat-split-values-for-daemonset-and-deployment) +- [6.8.9 - 2020/05/13](#689---20200513) - [7.6.2 - 2020/03/31](#762---20200331) - [Kibana default resources](#kibana-default-resources) - [7.6.0 - 2020/02/11](#760---20200211) @@ -48,6 +50,14 @@ Docker images Filebeat chart default config is now using [container input][] instead of [docker input][] in [#568][]. +### Metricbeat upgrade issue + +Metricbeat upgrade are failing with +`spec.selector: Invalid value: ... field is immutable` error. This is related to +Metricbeat deployment selector including chart version which is not immutable. +You should use `helm upgrade --force` to upgrade Metricbeat. See [#621][] for +more details. + ### Metricbeat split values for daemonset and deployment Metricbeat is now using dedicated values for daemonset and deployment config. @@ -153,6 +163,7 @@ volumeClaimTemplate: [#540]: https://github.com/elastic/helm-charts/pull/540 [#568]: https://github.com/elastic/helm-charts/pull/568 [#572]: https://github.com/elastic/helm-charts/pull/572 +[#621]: https://github.com/elastic/helm-charts/pull/621 [container input]: https://www.elastic.co/guide/en/beats/filebeat/7.7/filebeat-input-container.html [docker input]: https://www.elastic.co/guide/en/beats/filebeat/7.7/filebeat-input-docker.html [elastic helm repo]: https://helm.elastic.co diff --git a/metricbeat/templates/deployment.yaml b/metricbeat/templates/deployment.yaml index ca056d42b..67eefabf8 100644 --- a/metricbeat/templates/deployment.yaml +++ b/metricbeat/templates/deployment.yaml @@ -13,7 +13,6 @@ spec: selector: matchLabels: app: '{{ template "metricbeat.fullname" . }}-metrics' - chart: '{{ .Chart.Name }}-{{ .Chart.Version }}' heritage: '{{ .Release.Service }}' release: '{{ .Release.Name }}' template: @@ -119,4 +118,4 @@ spec: {{- end }} {{- if .Values.extraContainers }} {{ tpl .Values.extraContainers . | indent 6 }} - {{- end }} \ No newline at end of file + {{- end }}