Skip to content

feat(autodiscovery): add support for k8s initContainers (#4569) #4570

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

Merged

Conversation

luilegeant
Copy link
Contributor

@luilegeant luilegeant commented Apr 1, 2025

Fixes #4569

Add support for initContainers in k8s manifest files.

Test

Tested with

cd to_git_clone_with_changes
go test ./... -race

No warning/error related to autodiscovery/kubernetes.

Manual test

cd to_git_clone_with_changes
cd dist/updatecli_linux_amd64_v1
# added sample file from #4569 
./updatecli diff

Worked as expected all images got updated.

Additional Information

Checklist

  • I have updated the documentation via pull request in website repository.

=> Not applicable (?)

Tradeoff

  • The automated test only validates 1 pattern: $.spec.template.spec.initContainers[%d].image - The automated test is an incomplete deployment manifest.

Potential improvement

More tests to cover all path (see tradeoff above):

  • $.spec.initContainers[%d].image
  • $.spec.jobTemplate.spec.template.spec.initContainers[%d].image

More complex test to validate the base behaviour hasn't been skipped by adding a container section.
=> Hasn't been done, couldn't figure out the test validation input to provide in main_test.go.

@luilegeant luilegeant changed the title [WIP] feat(autodiscovery): add support for k8s initContainers (#4569) feat(autodiscovery): add support for k8s initContainers (#4569) Apr 2, 2025
@luilegeant luilegeant marked this pull request as ready for review April 2, 2025 09:33
@olblak
Copy link
Member

olblak commented Apr 2, 2025

Thanks for the pullrequest. It's a really nice improvement.
I need to merge #4568 first in order for the test to pass

@olblak
Copy link
Member

olblak commented Apr 2, 2025

@luilegeant I opened luilegeant#1 on your fork

@olblak olblak added enhancement New feature or request plugin-kubernetes labels Apr 2, 2025
@luilegeant
Copy link
Contributor Author

@olblak should be ok, I just merged/approved it.

@olblak olblak enabled auto-merge (squash) April 2, 2025 14:41
@olblak olblak disabled auto-merge April 3, 2025 06:56
@olblak
Copy link
Member

olblak commented Apr 3, 2025

Looking at the test, there is something weird with the Updatecli that try to find the latest version for the Go module
github.com/hashicorp/hcl

Instead of retriggering the test for this pull request, I am force merging it
Thanks, @luilegeant, for your contribution

@olblak
Copy link
Member

olblak commented Apr 3, 2025

I'll trigger a release new Monday

@olblak olblak merged commit 16bed49 into updatecli:main Apr 3, 2025
4 of 7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request plugin-kubernetes
Projects
None yet
Development

Successfully merging this pull request may close these issues.

feat: the kubernetes autodiscovery plugin should detect initcontainers update
2 participants