source-controller icon indicating copy to clipboard operation
source-controller copied to clipboard

Enhancement: gitrepository custom resources add duplicate check

Open JaneLiuL opened this issue 2 years ago • 1 comments

We have two files in the cluster, as below, They are store in the same folder but with different files for manual error. Then we found, flux don't have any check for it, it only show one of them which makes a terriable error in our cluster: it delete the branch v2 resources... So crazy.

apiVersion: source.toolkit.fluxcd.io/v1beta1
kind: GitRepository
metadata:
  name: jane
  namespace: platform
spec:
  interval: 1m
  url: xxx.git
  secretRef:
    name: git-secret
  ref:
    branch: v2
---
apiVersion: source.toolkit.fluxcd.io/v1beta1
kind: GitRepository
metadata:
  name: jane
  namespace: platform
spec:
  interval: 1m
  url: xxx.git
  secretRef:
    name: git-secret
  ref:
    branch: central
---

JaneLiuL avatar Sep 17 '21 08:09 JaneLiuL

This is not a bug, that's how Kubernetes works. If you reapply the same objects with different settings, the old settings will be overwritten. In you case, you update the branch from v2 to central.

stefanprodan avatar Sep 17 '21 08:09 stefanprodan