Skip to content

Commit

Permalink
Improve error messages to make misconfigurations easier to understand (
Browse files Browse the repository at this point in the history
…#500)

Make misconfigurations easier to understand for:
- multi kustomization with naming conflict 
- failing to find HelmRepository

#492
  • Loading branch information
allenporter authored Jan 11, 2024
1 parent c8741a2 commit 5cb4aa2
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
6 changes: 5 additions & 1 deletion flux_local/git_repo.py
Original file line number Diff line number Diff line change
Expand Up @@ -439,8 +439,12 @@ async def visit_kustomization(
)
unique = {ks.namespaced_name for ks in kustomizations}
if len(unique) != len(kustomizations):
ks_names = [ks.namespaced_name for ks in kustomizations]
dupes = list(filter(lambda x: ks_names.count(x) > 1, ks_names))
raise FluxException(
"Detected multiple Fluxtomizations with the same name indicating a multi-cluster setup. Please run with a more strict path"
f"Detected multiple Fluxtomizations with the same name: {dupes}. "
"This indicates either (1) an incorrect Kustomization which needs to be fixed "
"or (2) a multi-cluster setup which requires flux-local to run with a more strict --path."
)
return kustomizations

Expand Down
3 changes: 2 additions & 1 deletion flux_local/helm.py
Original file line number Diff line number Diff line change
Expand Up @@ -211,7 +211,8 @@ async def template(
if not repo:
raise HelmException(
f"Unable to find HelmRepository for {release.chart.chart_name} for "
f"HelmRelease {release.name}"
f"HelmRelease {release.name} "
f"({len(self._repos)} other HelmRepositories in --path)"
)
args: list[str] = [
HELM_BIN,
Expand Down

0 comments on commit 5cb4aa2

Please sign in to comment.