Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Look into why unnecessary setElementOrder directives are generated for Volumes and VolumeMounts in case of pods #9

Open
pepov opened this issue Jun 26, 2019 · 3 comments

Comments

@pepov
Copy link
Collaborator

pepov commented Jun 26, 2019

Description of the problem

When matching pods (and possibly other types of objects) a typical issue is that the patch will contain unnecessary $setElementOrder directives, most probably caused by the automatically generated Volumes and VolumeMounts of the service account token.

Current mitigation

Right now this is mitigated by actually applying the patch locally and checking it against the current version to see if it is a false positive or not.

It is possibly a bug or a limitation in the package k8s.io/apimachinery/pkg/util/strategicpatch but would need more investigation to find out.

How to reproduce

Remove the code responsible for double checking the patch and run the integration tests go test -integration -v to see pod matches with original to fail with the following unwanted patch:

 {"spec":{"$setElementOrder/volumes":[{"name":"empty"}]}}

The original pod spec:

&v1.Pod{
				ObjectMeta: standardObjectMeta(),
				Spec: v1.PodSpec{
					Containers: []v1.Container{
						{
							Name: "test-container", Image: "test-image",
						},
					},
					Volumes: []v1.Volume{
						{
							Name: "empty",
							VolumeSource: v1.VolumeSource{
								EmptyDir: &v1.EmptyDirVolumeSource{},
							},
						},
					},
				},
			})
@pepov pepov changed the title Look into why unnecessary setElementOrder directives are generated Volumes and VolumeMounts in case of pods Look into why unnecessary setElementOrder directives are generated for Volumes and VolumeMounts in case of pods Jun 26, 2019
@fernandesnikhil
Copy link

Ran into this as well - is anyone else also experiencing this?

@cannonpalms
Copy link

This is broader than just volumes/volumeMounts. It affects imagePullSecrets in https://github.com/konpyutaika/nifikop

@caigy
Copy link

caigy commented Dec 29, 2022

I ran into a same problem, any ways to solve it?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants