allenporter/flux-local

Error when starting the application

Closed this issue · 5 comments

Hello!

I'm trying to launch the application and it crashes with error

flux-local error:  Error building Fluxtomization in '/Users/mac/Desktop/work/flux' path '.': Try specifying another path within the git repo? Command 'kustomize cfg grep 'spec.sourceRef.kind=GitRepository|OCIRepository'' failed with return code 1
Error: MalformedYAMLError: yaml: mapping values are not allowed in this context

I don't fully understand what's going on. What can be wrong?

I installed a linter yamlfix and corrected all my yaml files, but the problem did not go away.

My repository structure looks something like this.

.
├── README.md
├── apps
│   ├── dev-stack
│   │   ├── kustomization.yaml
│   │   ├── minio-operator
│   │   │   ├── helm-release.yaml
│   │   │   ├── kustomization.yaml
│   │   │   └── namespace.yaml
│   ├── devops-stack
│   │   ├── kustomization.yaml
│   │   ├── grafana
│   │   │   ├── helm-release.yaml
│   │   │   ├── kustomization.yaml
│   │   │   └── namespace.yaml
├── clusters
│   ├── dev
│   │   ├── 1-helm-repo-sync.yaml
│   │   ├── 2-infra-sync.yaml
│   │   ├── 3-apps-sync.yaml
│   │   └── flux-system
│   │       ├── gotk-components.yaml
│   │       ├── gotk-sync.yaml
│   │       └── kustomization.yaml
│   ├── devops
│   │   ├── 1-helm-repo-sync.yaml
│   │   ├── 2-infra-sync.yaml
│   │   ├── 3-apps-sync.yaml
│   │   └── flux-system
│   │       ├── gotk-components.yaml
│   │       ├── gotk-sync.yaml
│   │       └── kustomization.yaml
├── helm-repositories
│   ├── grafana.yaml
│   ├── kustomization.yaml
│   ├── minio-operator.yaml
│   ├── prometheus-community.yaml
├── infrastructure
│   ├── base-stack
│   │   ├── kustomization.yaml
│   │   ├── prometheus-operator
│   │   │   ├── helm-release.yaml
│   │   │   ├── kustomization.yaml
│   ├── crds-stack
│   │   ├── kustomization.yaml
│   │   ├── namespace.yaml
│   │   └── prometheus-operator-crds
│   │       ├── helm-release.yaml
│   │       └── kustomization.yaml

Try running flux-local diagnostics and see if it points out the problematic file path.

You can use the .kmrignore file to skip invalid files or set --path with the path to your flux-system for the specified cluster you want to operate on (e.g. dev or prod etc if you have a multi-cluster repo).

You can use --debug to see more out of the tool.

@allenporter
Indeed the errors are due to the fact that I have helm charts in the repository.
Can you tell me how to correctly write exceptions for directories in .kmrignore file?

Sorry its .krmignore kubernetes-sigs/kustomize#2898

Are these helm charts defined in your flux repo? I would assume they'd be in some other directory that you'd want to exclude by focusing --path on the cluster directory.

I think this will work for me, thanks!

Regarding renovate I do it a weird way to use overlays: https://github.com/allenporter/k8s-gitops -- others use the native integration. Check out https://github.com/onedr0p/cluster-template?tab=readme-ov-file#-renovate