-
Notifications
You must be signed in to change notification settings - Fork 297
feat: return images from resources when sync occurs #642
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
feat: return images from resources when sync occurs #642
Conversation
922aecd
to
3f1734a
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you also add a test to when there are no images, please?
5281e57
to
ae4000b
Compare
pkg/utils/kube/kube.go
Outdated
for _, container := range containers { | ||
containerMap, ok := container.(map[string]interface{}) | ||
if !ok { | ||
return nil |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we continue
instead of returning here? It might be something related to the single container only
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Makes sense to extract as much data as possible. Added continue
on 5b2c46f but maybe @andrii-korotkov-verkada has a different take
@@ -404,6 +404,34 @@ func GetDeploymentReplicas(u *unstructured.Unstructured) *int64 { | |||
return &val | |||
} | |||
|
|||
func GetResourceImages(u *unstructured.Unstructured) []string { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For CronJobs it seems that the image is under spec.jobTemplate.spec.template.spec.containers
. Should we also check there?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done in 6b9063a
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
|
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #642 +/- ##
==========================================
- Coverage 54.26% 53.55% -0.72%
==========================================
Files 64 64
Lines 6164 6442 +278
==========================================
+ Hits 3345 3450 +105
- Misses 2549 2715 +166
- Partials 270 277 +7 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
50c907f
to
a989b44
Compare
Signed-off-by: Aaron Hoffman <31711338+Aaron-9900@users.noreply.github.com>
Signed-off-by: Aaron Hoffman <31711338+Aaron-9900@users.noreply.github.com>
Signed-off-by: Aaron Hoffman <31711338+Aaron-9900@users.noreply.github.com>
Signed-off-by: Aaron Hoffman <31711338+Aaron-9900@users.noreply.github.com>
…for cronjobs Signed-off-by: Aaron Hoffman <31711338+Aaron-9900@users.noreply.github.com>
Signed-off-by: Aaron Hoffman <31711338+Aaron-9900@users.noreply.github.com>
Signed-off-by: Aaron Hoffman <31711338+Aaron-9900@users.noreply.github.com>
a989b44
to
e6f8fbe
Compare
Can you create a PR to Argo CD updating the EDIT: Nvm, found it argoproj/argo-cd#20954. Do the e2e pass? |
@rumstead done in argoproj/argo-cd#20954, tests are now passing |
Signed-off-by: Aaron Hoffman <31711338+Aaron-9900@users.noreply.github.com>
f14771b
to
914b89c
Compare
Added new benchmark test for the sync operation. These are the results: command: 3 images
5 images
10 images
Overall, we see a small increase in time/operation for a small amount of images (11% for 3 images), and it gets larger as the images grow (36% for 10 images). This is expected, since we are now iterating over images. Even with this growth, the total value is still quite low. |
Co-authored-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com> Signed-off-by: Aaron Hoffman <31711338+Aaron-9900@users.noreply.github.com>
b985995
to
4fbe25e
Compare
|
Implementing the Gitops side of this issue: argoproj/argo-cd#20896
Adds an api to
kube.go
to get the images from a resource. Adds those images toResourceSyncResult
. This API accounts for how different k8s resources define the images.