Skip to content

Commit

Permalink
fix(affinity): fixed the logic to extract affinities
Browse files Browse the repository at this point in the history
  • Loading branch information
powerfooI committed Nov 6, 2024
1 parent a7bf911 commit 3d65332
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions internal/dashboard/business/oceanbase/obcluster.go
Original file line number Diff line number Diff line change
Expand Up @@ -203,8 +203,7 @@ func buildOBClusterTopologyResp(ctx context.Context, obcluster *v1alpha1.OBClust
affinities := make([]modelcommon.AffinitySpec, 0)
if obzone.Spec.Topology.Affinity != nil {
zoneAffinity := obzone.Spec.Topology.Affinity
switch {
case zoneAffinity.NodeAffinity != nil:
if zoneAffinity.NodeAffinity != nil {
zn := zoneAffinity.NodeAffinity
if zn.RequiredDuringSchedulingIgnoredDuringExecution != nil {
for _, term := range zn.RequiredDuringSchedulingIgnoredDuringExecution.NodeSelectorTerms {
Expand Down Expand Up @@ -234,7 +233,8 @@ func buildOBClusterTopologyResp(ctx context.Context, obcluster *v1alpha1.OBClust
})
}
}
case zoneAffinity.PodAffinity != nil:
}
if zoneAffinity.PodAffinity != nil {
zp := zoneAffinity.PodAffinity
for _, term := range zp.RequiredDuringSchedulingIgnoredDuringExecution {
for _, req := range term.LabelSelector.MatchExpressions {
Expand Down Expand Up @@ -262,7 +262,8 @@ func buildOBClusterTopologyResp(ctx context.Context, obcluster *v1alpha1.OBClust
})
}
}
case zoneAffinity.PodAntiAffinity != nil:
}
if zoneAffinity.PodAntiAffinity != nil {
zpa := zoneAffinity.PodAntiAffinity
for _, term := range zpa.RequiredDuringSchedulingIgnoredDuringExecution {
for _, req := range term.LabelSelector.MatchExpressions {
Expand Down

0 comments on commit 3d65332

Please sign in to comment.