From f493931b4183ce6edc59a80d39f43b7133cb9f1c Mon Sep 17 00:00:00 2001 From: fengcaiwen <895703375@qq.com> Date: Sun, 18 May 2025 16:10:23 +0800 Subject: [PATCH] hotfix: remove job before install --- pkg/handler/cleaner.go | 1 + pkg/handler/remote.go | 1 + pkg/handler/uninstall.go | 2 +- 3 files changed, 3 insertions(+), 1 deletion(-) diff --git a/pkg/handler/cleaner.go b/pkg/handler/cleaner.go index 9dcfa026..1aa4b58c 100644 --- a/pkg/handler/cleaner.go +++ b/pkg/handler/cleaner.go @@ -58,6 +58,7 @@ func (c *ConnectOptions) Cleanup(ctx context.Context) { } if c.clientset != nil { _ = c.clientset.CoreV1().Pods(c.Namespace).Delete(ctx2, config.CniNetName, v1.DeleteOptions{GracePeriodSeconds: pointer.Int64(0)}) + _ = c.clientset.BatchV1().Jobs(c.Namespace).Delete(ctx2, config.ConfigMapPodTrafficManager, v1.DeleteOptions{GracePeriodSeconds: pointer.Int64(0)}) } // leave proxy resources err := c.LeaveAllProxyResources(ctx2) diff --git a/pkg/handler/remote.go b/pkg/handler/remote.go index 18239a11..4b6615a7 100644 --- a/pkg/handler/remote.go +++ b/pkg/handler/remote.go @@ -49,6 +49,7 @@ func createOutboundPod(ctx context.Context, clientset *kubernetes.Clientset, nam _ = clientset.CoreV1().Services(namespace).Delete(ctx, name, options) _ = clientset.CoreV1().Secrets(namespace).Delete(ctx, name, options) _ = clientset.CoreV1().Pods(namespace).Delete(ctx, config.CniNetName, options) + _ = clientset.BatchV1().Jobs(namespace).Delete(ctx, name, options) _ = clientset.AppsV1().Deployments(namespace).Delete(ctx, name, options) } defer func() { diff --git a/pkg/handler/uninstall.go b/pkg/handler/uninstall.go index 2ddb3114..bc4e19f5 100644 --- a/pkg/handler/uninstall.go +++ b/pkg/handler/uninstall.go @@ -45,7 +45,7 @@ func (c *ConnectOptions) Uninstall(ctx context.Context) error { _ = c.clientset.RbacV1().Roles(ns).Delete(ctx, name, options) _ = c.clientset.CoreV1().Services(ns).Delete(ctx, name, options) _ = c.clientset.AppsV1().Deployments(ns).Delete(ctx, name, options) - + _ = c.clientset.BatchV1().Jobs(ns).Delete(ctx, name, options) _ = c.CleanupLocalContainer(ctx) plog.G(ctx).Info("Done") return nil