Skip to content

Commit

Permalink
handle a case where the same directory is specified multiple times
Browse files Browse the repository at this point in the history
  • Loading branch information
nabuskey committed Jan 2, 2024
1 parent 0e89480 commit 54f86d0
Show file tree
Hide file tree
Showing 4 changed files with 45 additions and 3 deletions.
7 changes: 6 additions & 1 deletion pkg/controllers/custompackage/controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -190,8 +190,13 @@ func (r *Reconciler) reconcileGitRepo(ctx context.Context, resource *v1alpha1.Cu
}
return nil
})
// it's possible for an application to specify the same directory multiple times in the spec.
// if there is a repository already created for this package, no further action is necessary.
if !errors.IsAlreadyExists(err) {
return repo, err
}

return repo, err
return repo, nil
}

func (r *Reconciler) SetupWithManager(mgr ctrl.Manager) error {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,12 @@ spec:
namespace: my-app2
server: "https://kubernetes.default.svc"
sources:
- repoURL: cnoe://busybox
- repoURL: cnoe://app2
targetRevision: HEAD
path: "."
path: "one"
- repoURL: cnoe://app2
targetRevision: HEAD
path: "two"
project: default
syncPolicy:
automated:
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
apiVersion: v1
kind: Pod
metadata:
name: busybox
namespace: argocd
labels:
abc: ded
notused: remove-me
spec:
containers:
- image: alpine:3.18
command:
- sleep
- "3600"
imagePullPolicy: IfNotPresent
name: busybox
restartPolicy: Always
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
apiVersion: v1
kind: Pod
metadata:
name: busybox
namespace: argocd
labels:
abc: ded
notused: remove-me
spec:
containers:
- image: alpine:3.18
command:
- sleep
- "3600"
imagePullPolicy: IfNotPresent
name: busybox
restartPolicy: Always

0 comments on commit 54f86d0

Please sign in to comment.