<p>I've upgraded helm templates (by hand)</p>

<p>Fragment of previous <code>depoloyment.yaml</code>:</p>

<pre><code>apiVersion: apps/v1beta2 kind: Deployment metadata:   name: {{ template "measurement-collector.fullname" . }}   labels:
    app: {{ template "measurement-collector.name" . }}
    chart: {{ template "measurement-collector.chart" . }}
    release: {{ .Release.Name }}
    heritage: {{ .Release.Service }} spec:   replicas: {{ .Values.replicaCount }}   selector:
    matchLabels:
      app: {{ template "measurement-collector.name" . }}
      release: {{ .Release.Name }}
</code></pre>

<p>New one:</p>

<pre><code>apiVersion: apps/v1beta2
kind: Deployment
metadata:
  name: {{ include "measurement-collector.fullname" . }}
  labels:
    app.kubernetes.io/name: {{ include "measurement-collector.name" . }}
    helm.sh/chart: {{ include "measurement-collector.chart" . }}
    app.kubernetes.io/instance: {{ .Release.Name }}
    app.kubernetes.io/managed-by: {{ .Release.Service }}
spec:
  replicas: {{ .Values.replicaCount }}
  selector:
    matchLabels:
      app.kubernetes.io/name: {{ include "measurement-collector.name" . }}
      app.kubernetes.io/instance: {{ .Release.Name }}
</code></pre>

<p>new <code>service.yaml</code>:</p>

<pre><code>  name: {{ include "measurement-collector.fullname" . }}
  labels:
    app.kubernetes.io/name: {{ include "measurement-collector.name" . }}
    helm.sh/chart: {{ include "measurement-collector.chart" . }}
    app.kubernetes.io/instance: {{ .Release.Name }}
    app.kubernetes.io/managed-by: {{ .Release.Service }}
spec:
  type: {{ .Values.service.type }}
  ports:
      protocol: TCP
      name: http
  selector:
    app.kubernetes.io/name: {{ include "measurement-collector.name" . }}
    app.kubernetes.io/instance: {{ .Release.Name }}
</code></pre>

<p>Then after running: <code>helm upgrade -i measurement-collector chart/measurement-collector --namespace prod --wait</code></p>

<p>I get:</p>

<pre><code>Error: UPGRADE FAILED: Deployment.apps "measurement-collector" is invalid: spec.selector: Invalid value: 
v1.LabelSelector{MatchLabels:map[string]string{"app.kubernetes.io/name":"measurement-collector", "app.kubernetes.io/instance":"measurement-collector"},         
MatchExpressions:[]v1.LabelSelectorRequirement(nil)}: field is immutable
</code></pre>

<p>If you change the selector label, then you will need to purge the release first before deploying.</p>
