akuity / mta

Apache License 2.0
25 stars 4 forks source link

Kustomization migration assumes git creds is needed #6

Open christianh814 opened 1 year ago

christianh814 commented 1 year ago

Given the following GitRepository and Kustomization...

---
apiVersion: source.toolkit.fluxcd.io/v1
kind: GitRepository
metadata:
  name: gitops-examples
  namespace: flux-system
spec:
  interval: 1m0s
  ref:
    branch: main
  url: https://github.com/christianh814/gitops-examples
---
apiVersion: kustomize.toolkit.fluxcd.io/v1
kind: Kustomization
metadata:
  name: welcome-app
  namespace: flux-system
spec:
  interval: 10m0s
  path: ./welcome-k8s/overlays/default
  prune: true
  sourceRef:
    kind: GitRepository
    name: gitops-examples

The following command will fail

$ mta kustomization --name welcome-app
FATA[0000] gitrepositories.source.toolkit.fluxcd.io "welcome-app" not found 

This is because mta currently assumes that all repos require authentication

This should be changed to check to see if the Kustomization is using a public repo.

MateSousa commented 1 year ago

@christianh814 can you review https://github.com/christianh814/mta/pull/7 ??

christianh814 commented 11 months ago

Another issue with this type of config is that ApplicationSet is used for migration and that's not always the case. Probably need #4 in as well.

christianh814 commented 9 months ago

Possible solution is to use IsNotFound from k8s.io/apimachinery/pkg/api/errors