Skip to content

Commit

Permalink
fix: create new container mount when force override (#4068) (#4072)
Browse files Browse the repository at this point in the history
Signed-off-by: fengxsong <fengxsong@outlook.com>
Co-authored-by: fengxsong <fengxsong@outlook.com>

(cherry picked from commit 4242e7c)
Signed-off-by: cuisongliu <cuisongliu@qq.com>
  • Loading branch information
2 people authored and cuisongliu committed Oct 11, 2023
1 parent ff6ac8c commit 9398bb1
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions pkg/apply/processor/install.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@ import (
"fmt"
"strings"

"github.com/labring/sealos/pkg/utils/rand"

"golang.org/x/sync/errgroup"
"k8s.io/apimachinery/pkg/util/sets"

Expand All @@ -32,7 +34,6 @@ import (
"github.com/labring/sealos/pkg/utils/confirm"
"github.com/labring/sealos/pkg/utils/logger"
"github.com/labring/sealos/pkg/utils/maps"
"github.com/labring/sealos/pkg/utils/rand"
)

var ForceOverride bool
Expand Down Expand Up @@ -145,11 +146,12 @@ func (c *InstallProcessor) PreProcess(cluster *v2.Cluster) error {
if !ForceOverride {
continue
}
ctrName = mount.Name
logger.Debug("trying to override app %s", img)
} else {
ctrName = rand.Generator(8)
if err := c.Buildah.Delete(mount.Name); err != nil {
return err
}
}
ctrName = rand.Generator(8)
cluster.Spec.Image = merge(cluster.Spec.Image, img)
bderInfo, err := c.Buildah.Create(ctrName, img)
if err != nil {
Expand Down

0 comments on commit 9398bb1

Please sign in to comment.