Skip to content

Commit

Permalink
Fix the issue of removing argocd resources without cascade parameter (k…
Browse files Browse the repository at this point in the history
  • Loading branch information
chilianyi committed Feb 28, 2024
1 parent 74c33ce commit 727c848
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 4 deletions.
8 changes: 8 additions & 0 deletions pkg/kapis/gitops/v1alpha1/argocd/route_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -236,6 +236,14 @@ func TestPublicAPIs(t *testing.T) {
},
Spec: v1alpha1.ApplicationSpec{
Kind: v1alpha1.ArgoCD,
ArgoApp: &v1alpha1.ArgoApplication{
Operation: nil,
Spec: v1alpha1.ArgoApplicationSpec{
SyncPolicy: &v1alpha1.SyncPolicy{
Automated: nil,
},
},
},
},
}

Expand Down
5 changes: 1 addition & 4 deletions pkg/kapis/gitops/v1alpha1/gitops/handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -86,9 +86,7 @@ func (h *Handler) DelApplication(req *restful.Request, res *restful.Response) {
}
err := h.Get(ctx, objectKey, application)
if err == nil {
switch application.Spec.Kind {
case v1alpha1.ArgoCD:
// add the Argo CD resources finalizer if cascade is true
if argo := application.Spec.ArgoApp; argo != nil {
if cascade == "true" {
if k8sutil.AddFinalizer(&application.ObjectMeta, v1alpha1.ArgoCDResourcesFinalizer) {
if err = h.Update(ctx, application); err != nil {
Expand All @@ -102,7 +100,6 @@ func (h *Handler) DelApplication(req *restful.Request, res *restful.Response) {
}
}
}
case v1alpha1.FluxCD:
}
err = h.Delete(ctx, application)
}
Expand Down

0 comments on commit 727c848

Please sign in to comment.