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

CNI File permission on existing files #9619

Open
kashifest opened this issue Dec 19, 2024 · 3 comments · May be fixed by #9656
Open

CNI File permission on existing files #9619

kashifest opened this issue Dec 19, 2024 · 3 comments · May be fixed by #9656

Comments

@kashifest
Copy link

kashifest commented Dec 19, 2024

Recently a patch was introduced in #8991 to change the file permission of the CNI files. This works well for new deployments. However for existing deployments this doesn't change the file permission while doing upgrades. This is caused by the fact that os.WriteFile doesn't change the file permission of the existing files

image

Expected Behavior

Existing file permission should be overwritten as well incase of upgrade.

Possible Solution

May be add a check if the file exists and if it does we simple change the file permission using os.Chmod("/path/to/file", perm) here https://github.com/missa-wndrvr/calico/blob/master/cni-plugin/pkg/install/install.go#L388

Context

Upgrading from 3.28.1 to 3.29.1

@kashifest
Copy link
Author

@caseydavenport @marvin-tigera need your suggestions on this.

@caseydavenport
Copy link
Member

@kashifest would it work to simply delete that file and let it get recreated? At least as a quick fix.

Seems like adding a simple os.Chmod in the place you specified would do the trick though - we can probably do it unconditionally without needing to check if the file was pre-existing, for simplicity.

@kashifest
Copy link
Author

@kashifest would it work to simply delete that file and let it get recreated? At least as a quick fix.

Yes, thats how we checked if it is working

Seems like adding a simple os.Chmod in the place you specified would do the trick though - we can probably do it unconditionally without needing to check if the file was pre-existing, for simplicity.

Works for me, here is a quick fix #9656

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

Successfully merging a pull request may close this issue.

2 participants