Skip to content

Commit

Permalink
remove other collasets podContext if nesscessary
Browse files Browse the repository at this point in the history
  • Loading branch information
ColdsteelRail committed Jan 7, 2025
1 parent 00f1c9a commit bae2a85
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
2 changes: 1 addition & 1 deletion config/manager/kustomization.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,5 @@ apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization
images:
- name: controller
newName: kusionstack/kuperator
newName: coldsteelrail/kusion-kuperator
newTag: test
8 changes: 5 additions & 3 deletions pkg/controllers/collaset/podcontext/podcontext.go
Original file line number Diff line number Diff line change
Expand Up @@ -62,9 +62,11 @@ func AllocateID(c client.Client, instance *appsv1alpha1.CollaSet, defaultRevisio
detail := &podContext.Spec.Contexts[i]
if detail.Contains(OwnerContextKey, instance.Name) {
ownedIDs[detail.ID] = detail
existingIDs[detail.ID] = detail
} else if instance.Spec.ScaleStrategy.Context != "" {
// add other collaset podContexts only if context pool enabled
existingIDs[detail.ID] = detail
}

existingIDs[detail.ID] = detail
}

// if owner has enough ID, return
Expand Down Expand Up @@ -150,7 +152,7 @@ func doUpdatePodContext(c client.Client, instance *appsv1alpha1.CollaSet, ownedI
// store all IDs crossing all workload
existingIDs := map[int]*appsv1alpha1.ContextDetail{}

// add other collaset podContexts only when instance enables context pool
// add other collaset podContexts only if context pool enabled
if instance.Spec.ScaleStrategy.Context != "" {
for i := range podContext.Spec.Contexts {
detail := podContext.Spec.Contexts[i]
Expand Down

0 comments on commit bae2a85

Please sign in to comment.