source-controller
source-controller copied to clipboard
Enhancement: gitrepository custom resources add duplicate check
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
---
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
.