Repository navigation
Description
Running helm/tiller v2.3.0
helm upgrade after a failed upgrade seems to not pick up all the changes I made in the deployment spec file.
Sequence of event is like this:
Using this deployment.yaml:
kind: Deployment
metadata:
name: nginx-deployment
spec:
replicas: 3
template:
metadata:
labels:
app: nginx
test: abcd
spec:
containers:
- name: nginx
image: nginx:1.7.9
ports:
- containerPort: 80
and do:
helm install --namespace temp --name temp /tmp/charts
which succeeds and create me deployment.
I then go and make few changes to the yaml, to make it fail, which looks like this:
kind: Deployment
metadata:
name: nginx-deployment
spec:
selector:
matchLabels:
app: nginx
replicas: 3
template:
metadata:
labels:
app: nginx
spec:
containers:
- name: nginx
image: nginx:1.7.9
ports:
- containerPort: 80
env:
- name: ENVTEST
value: "HELLO"
and do:
helm upgrade --debug temp /tmp/charts
which fails with:
Error: UPGRADE FAILED: Deployment.extensions "nginx-deployment" is invalid: spec.template.metadata.labels: Invalid value: {"app":"nginx"}: `selector` does not match template `labels`
So i go and fix the issue in the yaml so it now looks like this:
apiVersion: extensions/v1beta1
kind: Deployment
metadata:
name: nginx-deployment
spec:
selector:
matchLabels:
app: nginx
test: abcd
replicas: 3
template:
metadata:
labels:
app: nginx
test: abcd
spec:
containers:
- name: nginx
image: nginx:1.7.9
ports:
- containerPort: 80
env:
- name: ENVTEST
value: "HELLO"
and issue another helm upgrade which succeeds.
However, the deployment that resulted does not have the env section I wanted from the failed deploy.
Helm at the end reports the manifest does include the env section but kubectl get deployments does not so it does not match up.
helm manifest shows:
helm get manifest temp
---
# Source: temp/templates/deployment.yaml
apiVersion: extensions/v1beta1
kind: Deployment
metadata:
name: nginx-deployment
spec:
selector:
matchLabels:
app: nginx
test: abcd
replicas: 3
template:
metadata:
labels:
app: nginx
test: abcd
spec:
containers:
- name: nginx
image: nginx:1.7.9
ports:
- containerPort: 80
env:
- name: ENVTEST
value: "HELLO"
kubectl get deployment after last success deployment:
spec:
replicas: 3
selector:
matchLabels:
app: nginx
test: abcd
strategy:
rollingUpdate:
maxSurge: 1
maxUnavailable: 1
type: RollingUpdate
template:
metadata:
creationTimestamp: null
labels:
app: nginx
test: abcd
spec:
containers:
- image: nginx:1.7.9
imagePullPolicy: IfNotPresent
name: nginx
ports:
- containerPort: 80
protocol: TCP
resources: {}
terminationMessagePath: /dev/termination-log
dnsPolicy: ClusterFirst
restartPolicy: Always
securityContext: {}
terminationGracePeriodSeconds: 30
i.e. it does not have the env section.
Activity
kiich commentedon Apr 28, 2017
v2.3.1 reproduces same issue.
technosophos commentedon Apr 28, 2017
In this case, you must rollback before updating again in order to repair the broken selector.
redbaron commentedon Apr 29, 2017
If one must do something not to break Helm, then Helm must refuse any other actions or do it itself. Silently accepting updates and reporting success is very confusing and dangerous.
In this case Helm should either do autorollback of any failed release or refuse future upgrades until operator does it manually
jrnt30 commentedon May 11, 2017
This is especially painful when using stateful sets where there were changes to labels or something along those lines.
We first attempted to deploy the new version of the chart, which failed because we had made changes to something other than the replicas in the stateful set. To get around this, we deleted the stateful set and then redeployed, but realized our changes were not present (because of this issue).
Rolling back was not available because the
upgradehad recreated the statefulset but left everything else on the old version.tuannvm commentedon Aug 2, 2017
2.5.1 has a same issue.
I did need to manually delete my deployment and run
helm upgradeagain to fix that.burdiyan commentedon Sep 11, 2017
That's very annoying issue indeed.
bacongobbler commentedon Nov 7, 2017
this should be fixed via #3097, but please let me know if it isn't.
kiich commentedon Nov 8, 2017
Awesome to hear this! Thanks for the great work!