Skip to content

Commit

Permalink
fix(kubernetes): fetch ConfigMaps when keys are configured
Browse files Browse the repository at this point in the history
Fixes #368
  • Loading branch information
npdgm committed Dec 27, 2024
1 parent 476b093 commit 77f58c1
Showing 1 changed file with 9 additions and 6 deletions.
15 changes: 9 additions & 6 deletions internal/kubernetes.go
Original file line number Diff line number Diff line change
Expand Up @@ -93,13 +93,16 @@ func (exporter *Exporter) parseAllKubeObjects() ([]*certificateRef, []error) {
outputErrors = append(outputErrors, fmt.Errorf("failed to fetch secrets from namespace \"%s\": %s", namespace, err.Error()))
continue
}
configMaps, err := exporter.getWatchedConfigMaps(namespace)
if err != nil {
outputErrors = append(outputErrors, fmt.Errorf("failed to fetch configmaps from namespace \"%s\": %s", namespace, err.Error()))
continue
}
output = append(output, readCertificatesFromSecrets(secrets)...)
output = append(output, readCertificatesFromConfigMaps(configMaps)...)

if len(exporter.ConfigMapKeys) > 0 {
configMaps, err := exporter.getWatchedConfigMaps(namespace)
if err != nil {
outputErrors = append(outputErrors, fmt.Errorf("failed to fetch configmaps from namespace \"%s\": %s", namespace, err.Error()))
continue
}
output = append(output, readCertificatesFromConfigMaps(configMaps)...)
}
}

return output, outputErrors
Expand Down

0 comments on commit 77f58c1

Please sign in to comment.