Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: CollaSet supports exclude and include pod #258

Merged
merged 35 commits into from
Nov 4, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
35 commits
Select commit Hold shift + click to select a range
c5d74de
remove progress FinishingOpsLifecycle
ColdsteelRail Aug 18, 2024
0eef86e
refactor operateTargets
ColdsteelRail Aug 20, 2024
cab946a
refactor sync pods
ColdsteelRail Aug 24, 2024
f1198ac
add orphan pod pvc
ColdsteelRail Aug 28, 2024
588aeef
exclude include done, todo (1) recreate pod if revision not exists; (…
ColdsteelRail Aug 28, 2024
10de68b
clean AllowPodExclude AllowPodInclude func
ColdsteelRail Aug 28, 2024
8511d5e
fix replace and exclude
ColdsteelRail Aug 28, 2024
a504759
ensure toDelete toReplace toExclude priority
ColdsteelRail Aug 28, 2024
df4d3f5
default to recreate pod when update, if currentRevision not found
ColdsteelRail Aug 29, 2024
9239af7
add recorder
ColdsteelRail Aug 29, 2024
11bb94d
add expectation for exclude include
ColdsteelRail Aug 29, 2024
64a57ad
remove scaleStrategy check
ColdsteelRail Aug 29, 2024
e10a6a9
fix replace panic
ColdsteelRail Aug 29, 2024
d17ad1f
fix resourcecontext bug
ColdsteelRail Aug 29, 2024
b1c94b8
do not clean podToDelete in scaleStrategy
ColdsteelRail Aug 29, 2024
510612e
add ut: podToExclude
ColdsteelRail Aug 29, 2024
d5dc0c2
add e2e: exclude include pod
ColdsteelRail Aug 29, 2024
9b1cf49
add ut: exclude origin pod
ColdsteelRail Aug 30, 2024
8aea860
refactor allocate ID
ColdsteelRail Sep 1, 2024
10057a8
add replacePods func
ColdsteelRail Sep 1, 2024
942d920
refactor replace func
ColdsteelRail Sep 1, 2024
9e996e1
add ut for utils
ColdsteelRail Sep 2, 2024
01fc494
refactor injectRevision
ColdsteelRail Sep 2, 2024
6cbce53
exclude pods which have to-exclude label
ColdsteelRail Oct 14, 2024
7bfd0ab
refactor getPodsToDelete comment
ColdsteelRail Oct 15, 2024
33cff34
improve exclude include event
ColdsteelRail Oct 15, 2024
1022f40
fix ut: TestAllowResourceInclude
ColdsteelRail Oct 23, 2024
93a04a0
Merge branch 'main' into ex-include-pod
Eikykun Oct 29, 2024
a4724f7
fix kube-api
ColdsteelRail Oct 29, 2024
23cf697
fix compile
ColdsteelRail Oct 29, 2024
e08e459
fix compile
ColdsteelRail Oct 29, 2024
0afe520
bump kube-api v0.6.5
Eikykun Oct 31, 2024
d7b4ab0
add cls validating for exinclude intersection
ColdsteelRail Oct 31, 2024
4404fc2
rephrase recoder when rv label not effective
ColdsteelRail Nov 1, 2024
09eac01
check intersection for all pod lists in validating
ColdsteelRail Nov 1, 2024
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
4 changes: 2 additions & 2 deletions .github/workflows/e2e.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ jobs:
run: |
make ginkgo
set -e
KUBECONFIG=/tmp/kind/kubeconfig.yaml ./bin/ginkgo -timeout 10m -v --focus='\[apps\] CollaSet' test/e2e
KUBECONFIG=/tmp/kind/kubeconfig.yaml ./bin/ginkgo -timeout 15m -v --focus='\[apps\] CollaSet' test/e2e
restartCount=$(kubectl get pod -n kusionstack-system -l control-plane=controller-manager --no-headers | awk '{print $4}')
if [ "${restartCount}" -eq "0" ];then
echo "Kusionstack-manager has not restarted"
Expand Down Expand Up @@ -146,7 +146,7 @@ jobs:
run: |
make ginkgo
set -e
KUBECONFIG=/tmp/kind/kubeconfig.yaml ./bin/ginkgo -timeout 10m -v --focus='\[apps\] OperationJob' test/e2e
KUBECONFIG=/tmp/kind/kubeconfig.yaml ./bin/ginkgo -timeout 15m -v --focus='\[apps\] OperationJob' test/e2e
- name: Check Operating Manager
run: |
restartCount=$(kubectl get pod -n kusionstack-system -l control-plane=controller-manager --no-headers | awk '{print $4}')
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ require (
k8s.io/klog/v2 v2.100.1
k8s.io/kubernetes v0.0.0-00010101000000-000000000000
k8s.io/utils v0.0.0-20230726121419-3b25d923346b
kusionstack.io/kube-api v0.6.5
kusionstack.io/resourceconsist v0.0.1
sigs.k8s.io/controller-runtime v0.15.1
)
Expand Down Expand Up @@ -94,7 +95,6 @@ require (
k8s.io/apiserver v0.22.6 // indirect
k8s.io/kube-openapi v0.0.0-20230717233707-2695361300d9 // indirect
k8s.io/kubectl v0.29.0
kusionstack.io/kube-api v0.6.3
sigs.k8s.io/structured-merge-diff/v4 v4.2.3 // indirect
sigs.k8s.io/yaml v1.3.0 // indirect
)
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -1139,8 +1139,8 @@ k8s.io/utils v0.0.0-20201110183641-67b214c5f920/go.mod h1:jPW/WVKK9YHAvNhRxK0md/
k8s.io/utils v0.0.0-20210819203725-bdf08cb9a70a/go.mod h1:jPW/WVKK9YHAvNhRxK0md/EJ228hCsBRufyofKtW8HA=
k8s.io/utils v0.0.0-20230726121419-3b25d923346b h1:sgn3ZU783SCgtaSJjpcVVlRqd6GSnlTLKgpAAttJvpI=
k8s.io/utils v0.0.0-20230726121419-3b25d923346b/go.mod h1:OLgZIPagt7ERELqWJFomSt595RzquPNLL48iOWgYOg0=
kusionstack.io/kube-api v0.6.3 h1:HKgB6E95DVRGkZ2OjXkuV4YE327gGt24sBFJRB+tc6A=
kusionstack.io/kube-api v0.6.3/go.mod h1:J0+EHiroG/88X904Y9TV9iMRcoEuD5tXMTLMBDSwM+Y=
kusionstack.io/kube-api v0.6.5 h1:aVF6YsejHd1ujpI5oW6rdu2bhsYzX0PM5OnoHvAtIzs=
kusionstack.io/kube-api v0.6.5/go.mod h1:J0+EHiroG/88X904Y9TV9iMRcoEuD5tXMTLMBDSwM+Y=
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
13 changes: 10 additions & 3 deletions pkg/controllers/collaset/collaset_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -235,6 +235,11 @@
return podWrappers, nil, err
}

podWrappers, ownedIDs, err = r.syncControl.Replace(ctx, instance, podWrappers, ownedIDs, resources)
if err != nil {
return podWrappers, nil, err
}

Check warning on line 241 in pkg/controllers/collaset/collaset_controller.go

View check run for this annotation

Codecov / codecov/patch

pkg/controllers/collaset/collaset_controller.go#L240-L241

Added lines #L240 - L241 were not covered by tests

_, scaleRequeueAfter, scaleErr := r.syncControl.Scale(ctx, instance, resources, podWrappers, ownedIDs)
_, updateRequeueAfter, updateErr := r.syncControl.Update(ctx, instance, resources, podWrappers, ownedIDs)

Expand Down Expand Up @@ -361,10 +366,12 @@
needReclaimPvcs = append(needReclaimPvcs, pvcs[i])
}
}
if len(needReclaimPvcs) > 0 {
_, err = pvcControl.ReleasePvcsOwnerRef(cls, needReclaimPvcs)
for i := range needReclaimPvcs {
if err = pvcControl.OrphanPvc(cls, needReclaimPvcs[i]); err != nil {
return err
}

Check warning on line 372 in pkg/controllers/collaset/collaset_controller.go

View check run for this annotation

Codecov / codecov/patch

pkg/controllers/collaset/collaset_controller.go#L371-L372

Added lines #L371 - L372 were not covered by tests
}
return err
return nil
}

func (r *CollaSetReconciler) ensureReclaimPodOwnerReferences(cls *appsv1alpha1.CollaSet) error {
Expand Down
Loading
Loading