Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ require (
k8s.io/utils v0.0.0-20241104100929-3ea5e8cea738
kusionstack.io/kube-api v0.7.4-0.20250909095208-496f60eea9b5
kusionstack.io/kube-utils v0.2.1-0.20251120063041-6043805ee00d
kusionstack.io/kube-xset v0.0.0-20251111060928-069410a15229
kusionstack.io/kube-xset v0.0.2-0.20251127122852-ae98b507b2cc
kusionstack.io/resourceconsist v0.0.1
sigs.k8s.io/controller-runtime v0.17.3
)
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -1081,8 +1081,8 @@ kusionstack.io/kube-api v0.7.4-0.20250909095208-496f60eea9b5 h1:/jbKYMeXiYnuxyJQ
kusionstack.io/kube-api v0.7.4-0.20250909095208-496f60eea9b5/go.mod h1:e1jtrQH2LK5fD2nTyfIXG6nYrYbU8VXShRxTRwVPaLk=
kusionstack.io/kube-utils v0.2.1-0.20251120063041-6043805ee00d h1:iQtnK03ia/MN4K/6O75EMI91ep7jpcIG0pWyeREBqtg=
kusionstack.io/kube-utils v0.2.1-0.20251120063041-6043805ee00d/go.mod h1:KEHTfo1Y8SWMODnckF6daO2cSIW0FJ8fkk8PBA5O2GU=
kusionstack.io/kube-xset v0.0.0-20251111060928-069410a15229 h1:fTXG+HNxgM982pU/SnETY1fTRIcrrovs0Apn6h//zIo=
kusionstack.io/kube-xset v0.0.0-20251111060928-069410a15229/go.mod h1:FceKgqapMHhwiyIqCziTQRW27fsSXpPS611AApnyiYI=
kusionstack.io/kube-xset v0.0.2-0.20251127122852-ae98b507b2cc h1:wOqqe15yj1EeXKzAtVMRNRa4Iw2N59hLOgnu3u0p5SI=
kusionstack.io/kube-xset v0.0.2-0.20251127122852-ae98b507b2cc/go.mod h1:FceKgqapMHhwiyIqCziTQRW27fsSXpPS611AApnyiYI=
kusionstack.io/resourceconsist v0.0.1 h1:+k/jriq5Ld7fQUYfWSMGynz/FesHtl3Rk2fmQPjBe0g=
kusionstack.io/resourceconsist v0.0.1/go.mod h1:816xS/fY6EOUbPFjXIWW/TGs8/YE46qP4ElKeIiwFdU=
modernc.org/cc v1.0.0/go.mod h1:1Sk4//wdnYJiUIxnW8ddKpaOJCF37yAdqYnkxUpaYxw=
Expand Down
2 changes: 1 addition & 1 deletion pkg/controllers/collaset/collaset_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ const (

func Add(mgr manager.Manager) error {
xSetController := &CollaSetController{}
synccontrols.RegisterInPlaceIfPossibleUpdater(&inPlaceIfPossibleUpdater{})
synccontrols.RegisterInPlaceIfPossibleUpdater(NewInPlaceIfPossibleUpdater)
return kubexset.SetUpWithManager(mgr, xSetController)
}

Expand Down
19 changes: 18 additions & 1 deletion pkg/controllers/collaset/collaset_controller_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1308,6 +1308,23 @@ var _ = Describe("collaset controller", func() {
Eventually(func() error {
return expectedStatusReplicas(c, cs, 0, 0, 0, 3, 2, 0, 0, 0)
}, 10*time.Second, 1*time.Second).Should(BeNil())

// scale out partition and replicas parallel
Expect(updateCollaSetWithRetry(c, cs.Namespace, cs.Name, func(cls *appsv1alpha1.CollaSet) bool {
cls.Spec.Replicas = int32Pointer(10)
cls.Spec.UpdateStrategy.RollingUpdate = &appsv1alpha1.RollingUpdateCollaSetStrategy{
ByPartition: &appsv1alpha1.ByPartition{
Partition: int32Pointer(8),
},
}
cls.Spec.Template.Spec.Containers[0].Image = "nginx:v2"
return true
})).Should(BeNil())

// scale out 7 replicas with current revision
Eventually(func() error {
return expectedStatusReplicas(c, cs, 0, 0, 0, 10, 2, 0, 0, 0)
}, 10*time.Second, 1*time.Second).Should(BeNil())
})

It("scale failed and update parallel", func() {
Expand Down Expand Up @@ -4259,7 +4276,7 @@ var _ = Describe("collaset controller", func() {
// wait for replace completed
Eventually(func() error {
return expectedStatusReplicas(c, cs, 0, 0, 0, 1, 1, 0, 0, 0)
}, 5*time.Second, 1*time.Second).Should(BeNil())
}, 10*time.Second, 1*time.Second).Should(BeNil())

// origin pod is deleted
Expect(c.List(context.TODO(), podList, client.InNamespace(cs.Namespace))).Should(BeNil())
Expand Down
4 changes: 4 additions & 0 deletions pkg/controllers/collaset/pod_updater.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,10 @@ import (

var _ synccontrols.TargetUpdater = &inPlaceIfPossibleUpdater{}

func NewInPlaceIfPossibleUpdater() synccontrols.TargetUpdater {
return &inPlaceIfPossibleUpdater{}
}

type inPlaceIfPossibleUpdater struct {
synccontrols.GenericTargetUpdater
}
Expand Down
10 changes: 9 additions & 1 deletion pkg/controllers/poddecoration/poddecoration_controller_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ package poddecoration
import (
"context"
"fmt"
"net/url"
"os"
"path/filepath"
"strings"
Expand Down Expand Up @@ -59,7 +60,7 @@ var (
)

const (
timeoutInterval = 5 * time.Second
timeoutInterval = 10 * time.Second
pollInterval = 500 * time.Millisecond
)

Expand Down Expand Up @@ -900,6 +901,13 @@ var _ = BeforeSuite(func() {

env = &envtest.Environment{
CRDDirectoryPaths: []string{filepath.Join("..", "..", "..", "config", "crd", "bases")},
ControlPlane: envtest.ControlPlane{
APIServer: &envtest.APIServer{
URL: &url.URL{
Host: "127.0.0.1:64431",
},
},
},
}

config, err := env.Start()
Expand Down
Loading