Skip to content

Commit

Permalink
Use app.QualifiedName, add back trace statements
Browse files Browse the repository at this point in the history
Use `app.QualifiedName()` instead of creating a namespace/name string.
In addition, I had erroneously removed trace statements, which are now back.

Signed-off-by: Ian Delahorne <[email protected]>
  • Loading branch information
iandelahorne committed Oct 31, 2023
1 parent 674da70 commit de9d4e4
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions pkg/argocd/argocd.go
Original file line number Diff line number Diff line change
Expand Up @@ -176,37 +176,38 @@ func FilterApplicationsForUpdate(apps []v1alpha1.Application, patterns []string,
var appsForUpdate = make(map[string]ApplicationImages)

for _, app := range apps {
appNSName := fmt.Sprintf("%s/%s", app.GetNamespace(), app.GetName())
logCtx := log.WithContext().AddField("application", app.GetName()).AddField("namespace", app.GetNamespace())
// Check whether application has our annotation set
annotations := app.GetAnnotations()
if _, ok := annotations[common.ImageUpdaterAnnotation]; !ok {
logCtx.Tracef("skipping app '%s' of type '%s' because required annotation is missing", app.QualifiedName(), app.Status.SourceType)
continue
}

// Check for valid application type
if !IsValidApplicationType(&app) {
logCtx.Warnf("skipping app '%s' of type '%s' because it's not of supported source type", app.QualifiedName(), app.Status.SourceType)
continue
}

// Check if application name matches requested patterns
if !nameMatchesPattern(app.GetName(), patterns) {
logCtx.Debugf("Skipping app '%s' because it does not match requested patterns", app.GetName())
logCtx.Debugf("Skipping app '%s' because it does not match requested patterns", app.QualifiedName())
continue
}

// Check if application carries requested label
if !matchAppLabels(app.GetName(), app.GetLabels(), appLabel) {
logCtx.Debugf("Skipping app '%s' because it does not carry requested label", appNSName)
logCtx.Debugf("Skipping app '%s' because it does not carry requested label", app.QualifiedName())
continue
}

logCtx.Tracef("processing app '%s' of type '%v'", appNSName, app.Status.SourceType)
logCtx.Tracef("processing app '%s' of type '%v'", app.QualifiedName(), app.Status.SourceType)
imageList := parseImageList(annotations)
appImages := ApplicationImages{}
appImages.Application = app
appImages.Images = *imageList
appsForUpdate[appNSName] = appImages
appsForUpdate[app.QualifiedName()] = appImages
}

return appsForUpdate, nil
Expand Down

0 comments on commit de9d4e4

Please sign in to comment.