flux-local icon indicating copy to clipboard operation
flux-local copied to clipboard

Problem with external gitRepository

Open yotles opened this issue 7 months ago • 1 comments

@allenporter First of all thank you for such amazing tool! At first glance it could to resolve a lot of my issues during work with flux and gitops scheme.

But I cannot find the way to work properly. I have more or less standart platform admin repo with name conf:

tree conf
├── apps
│   ├── dev
│   └── prod
├── archived
│   ├── dev
│   └── prod
├── clusters
│   ├── dev
│   └── prod
└── infrastructure
    ├── archived
    ├── dev
    └── prod

And kustomizations within flux-system accessible ok with --sources:

flux-local  get ks --path ./clusters/dev --source flux-system
NAME              PATH
apps              apps/dev
flux-system       clusters/dev
infrastructure    infrastructure/dev

But I cannot figure out how to get work it with app which configured with external git repository. My manifests:

cat ./infrastructure/dev/app1/gitrepository/kustomize.yaml
apiVersion: kustomize.toolkit.fluxcd.io/v1
kind: Kustomization
metadata:
  name: app1
  namespace: app1
spec:
  interval: 1m0s
  path: ./base
  prune: true
  sourceRef:
    kind: GitRepository
    name: app1
    namespace: app1
  serviceAccountName: app1

cat ./infrastructure/dev/app1/gitrepository/git.yaml
apiVersion: source.toolkit.fluxcd.io/v1
kind: GitRepository
metadata:
  name: app1
  namespace: app1
spec:
  interval: 1m0s
  ref:
    branch: dev
  secretRef:
    name: flux-deploy-app1
  url: https://gitlab.xxx.xxx/okd/apps/infrastructure/app1.git

Such repository saved with path:

apps/infrastructure/app1/

base
├── imagestream
├── secrets
├── values
└── vault

And what I get:

 flux-local get ks --path ./infrastructure/dev/app1 --source app1
flux-local error:  Kustomization 'app1/app1-kustomization' path field 'base' is not a directory: /conf/base

but in my case /conf/base is not correct path, in some way it should look into apps/infrastructure/app1/base. Could you please clarify is it possible to work with flux-local in such manner?

Thanks!

yotles avatar Jul 21 '24 17:07 yotles