-
Notifications
You must be signed in to change notification settings - Fork 276
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
base: master
Are you sure you want to change the base?
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.50% -0.76%
==========================================
Files 64 64
Lines 6164 6442 +278
==========================================
+ Hits 3345 3447 +102
- Misses 2549 2717 +168
- Partials 270 278 +8 ☔ View full report in Codecov by Sentry. |
50c907f
to
a989b44
Compare
Signed-off-by: Aaron Hoffman <[email protected]>
Signed-off-by: Aaron Hoffman <[email protected]>
Signed-off-by: Aaron Hoffman <[email protected]>
Signed-off-by: Aaron Hoffman <[email protected]>
…for cronjobs Signed-off-by: Aaron Hoffman <[email protected]>
Signed-off-by: Aaron Hoffman <[email protected]>
Signed-off-by: Aaron Hoffman <[email protected]>
a989b44
to
e6f8fbe
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.