Container changes in`Deployment` => "element [0] missing"
See original GitHub issueUsing this deployment.yaml:
apiVersion: extensions/v1beta1
kind: Deployment
metadata:
name: nginx
namespace: test
spec:
template:
metadata:
labels:
app: nginx
spec:
containers:
- name: nginx
image: nginx
ports:
- containerPort: 80
name: http
protocol: TCP
If I change a field in the containers part, e.g. the containerPort, kubediff returns:
## test/nginx (Deployment)
.spec.template.spec.containers: 'element [0]' missing
Issue Analytics
- State:
- Created 6 years ago
- Reactions:14
- Comments:10 (4 by maintainers)
Top Results From Across the Web
Problem when deploying FlexiPages on Winter '22 org
This is a change on the ComponentInstance type. To fix it, add an identifier to your component instance:
Read more >Quickstart: Troubleshoot ARM template JSON deployments
This quickstart describes how to troubleshoot Azure Resource Manager template (ARM template) JSON deployment errors.
Read more >Missing protocol in container.port in Deployment template
port in Deployment template. The container. port here does not have a protocol value specified.
Read more >Understanding Kubernetes pod pending problems - Sysdig
Once the pod is scheduled and the containers have started, the pod changes to the Running phase. Most of the pods only take...
Read more >Update API Objects in Place Using kubectl patch - Kubernetes
The output shows that the Deployment has two Pods. The 1/1 indicates that each Pod has one container: NAME READY STATUS RESTARTS AGE ......
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found

Getting the same issue. An update would be awesome. Thanks for
kubediff!I’ve coded a workaround for this. It’s far from perfect because tests are broken and all but that fits my needs. Looks interesting to share anyway.
My understanding is that after the change https://github.com/weaveworks/kubediff/pull/31 every change in any deep after a list results in ‘element[X] missing’ issue we are talking about. Hence if you change the image of a container (the most likely on a daily change), you have this issue, making the tool quite useless imho. The change make sense in a way that if you remove or add element in a list from running or wished configuration, differences between elements get mixed up and you end up with an horrible diff output e.g.: you remove wished var1 then running var1 is diffed with wished var2, running var2 is diffed with wished var3 and so on… Luckily changes not happening much except for environment variable list.
I then did the following change. Reverted the old behavior for list having same size, and if not return ‘element missing’ except for .spec.template.spec.containers[X].env whish have a special treat.
Let’s say you running on this
and want this:
With my hack, kubediff output is:
Patch is attached. Edit kubedifflib/_diff.py and build container with build instructions in doc except “make .uptodate” instead of “make” to bypass tests. patch.txt