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

bugfix: set pool status based on name rather than index based #2161

Merged
Merged
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
31 changes: 22 additions & 9 deletions pkg/controller/main-controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -960,11 +960,17 @@ func (c *Controller) syncHandler(key string) (Result, error) {
// Get the StatefulSet with the name specified in Tenant.status.pools[i].SSName

// if this index is in the status of pools use it, else capture the desired name in the status and store it
var ssName string
if len(tenant.Status.Pools) > i {
ssName = tenant.Status.Pools[i].SSName
} else {
ssName = tenant.PoolStatefulsetName(&pool)
ssName := tenant.PoolStatefulsetName(&pool)

poolInStatus := false
for _, poolStatus := range tenant.Status.Pools {
if poolStatus.SSName == ssName {
poolInStatus = true
break
}
}

if !poolInStatus {
tenant.Status.Pools = append(tenant.Status.Pools, miniov2.PoolStatus{
SSName: ssName,
State: miniov2.PoolNotCreated,
Expand Down Expand Up @@ -1209,10 +1215,17 @@ func (c *Controller) syncHandler(key string) (Result, error) {
for i, pool := range tenant.Spec.Pools {
// Get the StatefulSet with the name specified in Tenant.status.pools[i].SSName
// if this index is in the status of pools use it, else capture the desired name in the status and store it
var ssName string
if len(tenant.Status.Pools) > i {
ssName = tenant.Status.Pools[i].SSName
} else {
ssName := tenant.PoolStatefulsetName(&pool)

poolInStatus := false
for _, poolStatus := range tenant.Status.Pools {
if poolStatus.SSName == ssName {
poolInStatus = true
break
}
}

if !poolInStatus {
ssName = tenant.PoolStatefulsetName(&pool)
tenant.Status.Pools = append(tenant.Status.Pools, miniov2.PoolStatus{
SSName: ssName,
Expand Down
Loading